Changeset 12998
- Timestamp:
- 02/07/2010 01:31:40 AM (15 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-direct.php
r12997 r12998 117 117 */ 118 118 function chmod($file, $mode = false, $recursive = false) { 119 if ( ! $this->exists($file) )120 return false;121 122 119 if ( ! $mode ) { 123 120 if ( $this->is_file($file) ) … … 129 126 } 130 127 131 if ( ! $recursive ) 132 return @chmod($file, $mode); 133 if ( ! $this->is_dir($file) ) 128 if ( ! $recursive || ! $this->is_dir($file) ) 134 129 return @chmod($file, $mode); 135 130 //Is a directory, and we want recursive … … 299 294 300 295 function rmdir($path, $recursive = false) { 301 //Currently unused and untested, Use delete() instead. 302 if ( ! $recursive ) 303 return @rmdir($path); 304 //recursive: 305 $filelist = $this->dirlist($path); 306 foreach ($filelist as $filename => $det) { 307 if ( '/' == substr($filename, -1, 1) ) 308 $this->rmdir($path . '/' . $filename, $recursive); 309 @rmdir($filename); 310 } 311 return @rmdir($path); 296 return $this->delete($path, $recursive); 312 297 } 313 298 -
trunk/wp-admin/includes/class-wp-filesystem-ftpext.php
r12997 r12998 143 143 } 144 144 function chmod($file, $mode = false, $recursive = false) { 145 if ( ! $this->exists($file) && ! $this->is_dir($file) )146 return false;147 148 145 if ( ! $mode ) { 149 146 if ( $this->is_file($file) ) … … 246 243 } 247 244 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 248 if ( !ftp_mkdir($this->link, $path) ) 249 return false; 250 if ( ! $chmod ) 251 $chmod = FS_CHMOD_DIR; 252 $this->chmod($path, $chmod); 245 if ( !ftp_mkdir($this->link, $path) ) 246 return false; 247 $this->chmod($path); 253 248 if ( $chown ) 254 249 $this->chown($path, $chown); … … 264 259 static $is_windows; 265 260 if ( is_null($is_windows) ) 266 $is_windows = strpos( strtolower( ftp_systype($this->link)), 'win') !== false;267 268 if ( $is_windows && preg_match( "/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer) ) {261 $is_windows = strpos( strtolower( ftp_systype($this->link) ), 'win') !== false; 262 263 if ( $is_windows && preg_match('/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/', $line, $lucifer) ) { 269 264 $b = array(); 270 if ( $lucifer[3] < 70 ) { $lucifer[3] +=2000; } else { $lucifer[3] += 1900; } // 4digit year fix 271 $b['isdir'] = ($lucifer[7]=="<DIR>"); 265 if ( $lucifer[3] < 70 ) 266 $lucifer[3] +=2000; 267 else 268 $lucifer[3] += 1900; // 4digit year fix 269 $b['isdir'] = ( $lucifer[7] == '<DIR>'); 272 270 if ( $b['isdir'] ) 273 271 $b['type'] = 'd'; … … 280 278 $b['hour'] = $lucifer[4]; 281 279 $b['minute'] = $lucifer[5]; 282 $b['time'] = @mktime($lucifer[4] +(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);280 $b['time'] = @mktime($lucifer[4] + (strcasecmp($lucifer[6], "PM") == 0 ? 12 : 0), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3]); 283 281 $b['am/pm'] = $lucifer[6]; 284 282 $b['name'] = $lucifer[8]; 285 } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {283 } elseif ( !$is_windows && $lucifer = preg_split('/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY)) { 286 284 //echo $line."\n"; 287 $lcount=count($lucifer); 288 if ($lcount<8) return ''; 285 $lcount = count($lucifer); 286 if ( $lcount < 8 ) 287 return ''; 289 288 $b = array(); 290 289 $b['isdir'] = $lucifer[0]{0} === "d"; … … 301 300 $b['group'] = $lucifer[3]; 302 301 $b['size'] = $lucifer[4]; 303 if ( $lcount==8) {304 sscanf($lucifer[5], "%d-%d-%d",$b['year'],$b['month'],$b['day']);305 sscanf($lucifer[6], "%d:%d",$b['hour'],$b['minute']);306 $b['time'] = @mktime($b['hour'], $b['minute'],0,$b['month'],$b['day'],$b['year']);302 if ( $lcount == 8 ) { 303 sscanf($lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day']); 304 sscanf($lucifer[6], '%d:%d', $b['hour'], $b['minute']); 305 $b['time'] = @mktime($b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year']); 307 306 $b['name'] = $lucifer[7]; 308 307 } else { 309 308 $b['month'] = $lucifer[5]; 310 309 $b['day'] = $lucifer[6]; 311 if ( preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {310 if ( preg_match('/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2) ) { 312 311 $b['year'] = date("Y"); 313 312 $b['hour'] = $l2[1]; … … 318 317 $b['minute'] = 0; 319 318 } 320 $b['time'] = strtotime( sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));319 $b['time'] = strtotime( sprintf('%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute']) ); 321 320 $b['name'] = $lucifer[8]; 322 321 } -
trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r12997 r12998 155 155 156 156 function chmod($file, $mode = false, $recursive = false ) { 157 158 157 if ( ! $mode ) { 159 158 if ( $this->is_file($file) ) … … 278 277 279 278 function rmdir($path, $recursive = false ) { 280 if ( ! $recursive ) 281 return $this->ftp->rmdir($path); 282 283 return $this->ftp->mdel($path); 279 $this->delete($path, $recursive); 284 280 } 285 281
Note: See TracChangeset
for help on using the changeset viewer.