Ticket #18201: 18201.diff
| File 18201.diff, 5.1 KB (added by , 13 years ago) |
|---|
-
wp-admin/includes/class-wp-filesystem-base.php
39 39 var $method = ''; 40 40 41 41 /** 42 * Whether this filesystem supports file MD5s 43 * 44 * @since 3.7 45 * @access public 46 * @var bool 47 */ 48 var $supports_md5 = false; 49 50 /** 42 51 * Returns the path on the remote filesystem of ABSPATH 43 52 * 44 53 * @since 2.7 -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
266 266 return false; 267 267 } 268 268 269 function md5( $file ) { 270 return false; 271 } 272 269 273 function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) { 270 274 $path = untrailingslashit($path); 271 275 if ( empty($path) ) -
wp-admin/includes/update-core.php
656 656 return new WP_Error( 'insane_distro', __('The update could not be unpacked') ); 657 657 } 658 658 659 // Check if we have the correct files 660 include_once( $from . $distro . 'wp-admin/includes/update-core-file-hashes.php' ); 661 if ( empty( $file_hashes ) ) { 662 $wp_filesystem->delete( $from, true ); 663 return new WP_Error( 'no_file_hashes', __( 'The update did not contain file hashes' ) ); 664 } 665 666 if ( $wp_filesystem->supports_md5 ) { 667 foreach ( $file_hashes as $file => $hash ) { 668 if ( $hash !== $wp_filesystem->md5( $file ) ) { 669 $wp_filesystem->delete( $from, true ); 670 return new WP_Error( 'bad_file_hashes', __( 'The update did not match the included file hashes' ) ); 671 } 672 } 673 } 674 659 675 // Import $wp_version, $required_php_version, and $required_mysql_version from the new version 660 676 // $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 661 677 $versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php'; -
wp-admin/includes/class-wp-filesystem-direct.php
22 22 * @param mixed $arg ignored argument 23 23 */ 24 24 function __construct($arg) { 25 $this->method = 'direct'; 26 $this->errors = new WP_Error(); 25 $this->method = 'direct'; 26 $this->errors = new WP_Error(); 27 $this->supports_md5 = true; 27 28 } 28 29 /** 29 30 * connect filesystem. … … 283 284 return @touch($file, $time, $atime); 284 285 } 285 286 287 function md5( $file ) { 288 return @md5_file( $file ); 289 } 290 286 291 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 287 292 // safe mode fails with a trailing slash under certain PHP versions. 288 293 $path = untrailingslashit($path); … … 346 351 $struc['lastmod'] = date('M j',$struc['lastmodunix']); 347 352 $struc['time'] = date('h:i:s',$struc['lastmodunix']); 348 353 $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; 354 $struc['md5'] = $this->md5( $path . '/' . $entry ); 349 355 350 356 if ( 'd' == $struc['type'] ) { 351 357 if ( $recursive ) -
wp-admin/includes/class-wp-filesystem-ftpext.php
246 246 function touch($file, $time = 0, $atime = 0) { 247 247 return false; 248 248 } 249 250 function md5( $file ) { 251 return false; 252 } 253 249 254 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 250 255 $path = untrailingslashit($path); 251 256 if ( empty($path) ) -
wp-admin/includes/class-wp-filesystem-ssh2.php
49 49 var $options = array(); 50 50 51 51 function __construct($opt='') { 52 $this->method = 'ssh2'; 53 $this->errors = new WP_Error(); 52 $this->method = 'ssh2'; 53 $this->errors = new WP_Error(); 54 $this->supports_md5 = true; 54 55 55 56 //Check if possible to use ssh2 functions. 56 57 if ( ! extension_loaded('ssh2') ) { … … 309 310 //Not implemented. 310 311 } 311 312 313 function md5( $file ) { 314 $file = ltrim( $file, '/' ); 315 return md5_file( 'ssh2.sftp://' . $this->sftp_link . '/' . $file ); 316 } 317 312 318 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 313 319 $path = untrailingslashit($path); 314 320 if ( empty($path) ) … … 369 375 $struc['lastmod'] = date('M j',$struc['lastmodunix']); 370 376 $struc['time'] = date('h:i:s',$struc['lastmodunix']); 371 377 $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; 378 $struc['md5'] = $this->md5( $path . '/' . $entry ); 372 379 373 380 if ( 'd' == $struc['type'] ) { 374 381 if ( $recursive )