Ticket #23122: patch.diff
File patch.diff, 10.0 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-direct.php
16 16 */ 17 17 class WP_Filesystem_Direct extends WP_Filesystem_Base { 18 18 var $errors = null; 19 19 20 /** 20 21 * constructor 21 22 * … … 25 26 $this->method = 'direct'; 26 27 $this->errors = new WP_Error(); 27 28 } 29 28 30 /** 29 31 * connect filesystem. 30 32 * … … 33 35 function connect() { 34 36 return true; 35 37 } 38 36 39 /** 37 40 * Reads entire file into a string 38 41 * … … 42 45 function get_contents($file) { 43 46 return @file_get_contents($file); 44 47 } 48 45 49 /** 46 50 * Reads entire file into an array 47 51 * … … 51 55 function get_contents_array($file) { 52 56 return @file($file); 53 57 } 58 54 59 /** 55 60 * Write a string to a file 56 61 * … … 67 72 $this->chmod($file, $mode); 68 73 return true; 69 74 } 75 70 76 /** 71 77 * Gets the current working directory 72 78 * … … 75 81 function cwd() { 76 82 return @getcwd(); 77 83 } 84 78 85 /** 79 86 * Change directory 80 87 * … … 84 91 function chdir($dir) { 85 92 return @chdir($dir); 86 93 } 94 87 95 /** 88 96 * Changes file group 89 97 * … … 107 115 108 116 return true; 109 117 } 118 110 119 /** 111 120 * Changes filesystem permissions 112 121 * … … 135 144 136 145 return true; 137 146 } 147 138 148 /** 139 149 * Changes file owner 140 150 * … … 157 167 } 158 168 return true; 159 169 } 170 160 171 /** 161 172 * Gets file owner 162 173 * 163 174 * @param string $file Path to the file. 164 * @return string Username of the user. 175 * @return mixed Username string of the user, int user ID if posix_getpwuid isn't available, 176 * or bool False if fileowner check fails. 165 177 */ 166 178 function owner($file) { 167 179 $owneruid = @fileowner($file); … … 172 184 $ownerarray = posix_getpwuid($owneruid); 173 185 return $ownerarray['name']; 174 186 } 187 175 188 /** 176 189 * Gets file permissions 177 190 * … … 183 196 function getchmod($file) { 184 197 return substr(decoct(@fileperms($file)),3); 185 198 } 199 200 /** 201 * Gets file group. 202 * 203 * @param string $file Path to the file. 204 * @return mixed String group name, int group ID if posix_getgrgid isn't available, 205 * or bool False if filegroup check fails. 206 */ 186 207 function group($file) { 187 208 $gid = @filegroup($file); 188 209 if ( ! $gid ) … … 192 213 $grouparray = posix_getgrgid($gid); 193 214 return $grouparray['name']; 194 215 } 195 216 217 /** 218 * Copy a file. 219 * 220 * @param string $source Path to the file. 221 * @param string $destination Path to the new file. 222 * @param bool $overwrite (optional) Whether to overwrite file at $destination if it exists. 223 * @param int $mode (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs. 224 * @return bool True if file copied successfully, False otherwise. 225 */ 196 226 function copy($source, $destination, $overwrite = false, $mode = false) { 197 227 if ( ! $overwrite && $this->exists($destination) ) 198 228 return false; … … 202 232 $this->chmod($destination, $mode); 203 233 return $rtval; 204 234 } 205 235 236 /** 237 * Move a file. 238 * 239 * @param string $source Path to the file. 240 * @param string $destination Path to the file destination. 241 * @param bool $overwrite (optional) Whether to overwrite file at $destination if it exists. 242 * @return bool True if file copied successfully, False otherwise. 243 */ 206 244 function move($source, $destination, $overwrite = false) { 207 245 if ( ! $overwrite && $this->exists($destination) ) 208 246 return false; … … 219 257 } 220 258 } 221 259 260 /** 261 * Delete a file or directory. 262 * 263 * @param string $file Path to File/directory. 264 * @param bool $recursive (optional) Whether to recursively remove files. 265 * @param string $type (optional) The type of resource being removed (values are 'f' or 'd'). 266 * @return bool True if deleted successfully, false otherwise. 267 */ 222 268 function delete($file, $recursive = false, $type = false) { 223 269 if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem. 224 270 return false; … … 244 290 return $retval; 245 291 } 246 292 293 /** 294 * Check if file or directory exists. 295 * 296 * @param string $file Path to file/directory. 297 * @return bool Whether $file exists or not. 298 */ 247 299 function exists($file) { 248 300 return @file_exists($file); 249 301 } 250 302 303 /** 304 * Check if file. 305 * 306 * @param string $file File path. 307 * @return bool Whether $file is a file. 308 */ 251 309 function is_file($file) { 252 310 return @is_file($file); 253 311 } 254 312 313 /** 314 * Check if directory. 315 * 316 * @param string $path Directory path. 317 * @return bool Whether $path is a directory. 318 */ 255 319 function is_dir($path) { 256 320 return @is_dir($path); 257 321 } 258 322 323 /** 324 * Check if file is readable. 325 * 326 * @param string $file Path to file. 327 * @return bool Whether $file is readable. 328 */ 259 329 function is_readable($file) { 260 330 return @is_readable($file); 261 331 } 262 332 333 /** 334 * Check if file/directory is writable. 335 * 336 * @param string $path Path to file/directory. 337 * @return bool Whether $file is writable. 338 */ 263 339 function is_writable($file) { 264 340 return @is_writable($file); 265 341 } 266 342 343 /** 344 * Gets the file last access time. 345 * 346 * @param string $file Path to file. 347 * @return int Unix timestamp representing last access time. 348 */ 267 349 function atime($file) { 268 350 return @fileatime($file); 269 351 } 270 352 353 /** 354 * Gets the file modification time. 355 * 356 * @param string $file Path to file. 357 * @return int Unix timestamp representing modification time. 358 */ 271 359 function mtime($file) { 272 360 return @filemtime($file); 273 361 } 362 363 /** 364 * Gets the file size (in bytes). 365 * 366 * @param string $file Path to file. 367 * @return int Size of the file in bytes. 368 */ 274 369 function size($file) { 275 370 return @filesize($file); 276 371 } 277 372 373 /** 374 * Set the access and modification times of a file. 375 * 376 * Note: If $file doesn't exist, it will be created. 377 * 378 * @param string $file Path to file. 379 * @param int $time (Optional) Modified time to set for file. 380 * @param int $atime (Optional) Access time to set for file. 381 * @return bool Whether operation was successful or not. 382 */ 278 383 function touch($file, $time = 0, $atime = 0) { 279 384 if ($time == 0) 280 385 $time = time(); … … 283 388 return @touch($file, $time, $atime); 284 389 } 285 390 391 /** 392 * Create a directory. 393 * 394 * @param string $path Path for new directory. 395 * @param mixed $chmod (Optional) The permissions as octal number, (or False to skip chmod) 396 * @param mixed $chown (Optional) A user name or number (or False to skip chown) 397 * @param mixed $chgrp (Optional) A group name or number (or False to skip chgrp). 398 * @return bool False if directory cannot be created, true otherwise. 399 */ 286 400 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 287 401 // safe mode fails with a trailing slash under certain PHP versions. 288 402 $path = untrailingslashit($path); … … 302 416 return true; 303 417 } 304 418 419 /** 420 * Delete a directory. 421 * 422 * @param string $path Path to directory. 423 * @param bool $recursive Whether to recursively remove files/directories. 424 * @return bool Whether directory is deleted successfully or not. 425 */ 305 426 function rmdir($path, $recursive = false) { 306 427 return $this->delete($path, $recursive); 307 428 } 308 429 430 /** 431 * Gets details for files in a directory or a specific file. 432 * 433 * The returned array of files is keyed by file/directory name with arrays keyed as follows: 434 * 'name' - Name of the file/directory 435 * 'perms' - String *nix representation of permissions 436 * 'permsn' - Octal representation of permissions 437 * 'owner' - Owner name or ID 438 * 'group' - Group name or ID 439 * 'size' - Size of file (in bytes) 440 * 'lastmodunix' - Last modified unix timestamp 441 * 'lastmod' - Last modified month (3 letter) and Day (without leading 0) 442 * 'time' - Last modified time 443 * 'type' - Type of resource ('f' for file, 'd' for directory) 444 * 'files' - If a directory and $recursive is true, contains another array of files 445 * 446 * @param string $path Path to directory or file. 447 * @param bool $include_hidden (Optional) Whether to include details of hidden ("." prefixed) files. 448 * @param bool $recursive (Optional) Whether to recursively include file details in nested directories. 449 * @return array|bool False if unable to list directory contents, array otherwise. 450 */ 309 451 function dirlist($path, $include_hidden = true, $recursive = false) { 310 452 if ( $this->is_file($path) ) { 311 453 $limit_file = basename($path); -
wp-admin/includes/class-wp-list-table.php
352 352 } 353 353 354 354 /** 355 * Display a monthly dropdown for filtering items 355 * Display a monthly dropdown for filtering items. 356 356 * 357 * Only includes months during which a $post_type was posted. 358 * 357 359 * @since 3.1.0 358 360 * @access protected 361 * 362 * @param string $post_type 359 363 */ 360 364 function months_dropdown( $post_type ) { 361 365 global $wpdb, $wp_locale; … … 401 405 * 402 406 * @since 3.1.0 403 407 * @access protected 408 * 409 * @param string $current_mode 404 410 */ 405 411 function view_switcher( $current_mode ) { 406 412 $modes = array( … … 465 471 * @since 3.1.0 466 472 * @access protected 467 473 * 474 * @param string $option Name of the user option. 475 * @param int $default Default number of items to show per page. 468 476 * @return int 469 477 */ 470 478 function get_items_per_page( $option, $default = 20 ) { … … 480 488 * 481 489 * @since 3.1.0 482 490 * @access protected 491 * 492 * @param string $which Position of the pagination being displayed (values are 'top' or 'bottom'). 483 493 */ 484 494 function pagination( $which ) { 485 495 if ( empty( $this->_pagination_args ) ) … … 757 767 * 758 768 * @since 3.1.0 759 769 * @access protected 770 * 771 * @param string $which Position of the table navigation being generated 772 * (values are 'top' or 'bottom'). 760 773 */ 761 774 function display_tablenav( $which ) { 762 775 if ( 'top' == $which ) … … 782 795 * 783 796 * @since 3.1.0 784 797 * @access protected 798 * 799 * @param string $which Position of the table navigation being displayed 800 * (values are 'top' or 'bottom'). 785 801 */ 786 802 function extra_tablenav( $which ) {} 787 803