wp/wp-admin/includes/class-wp-filesystem-base.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   120 
   120 
   121 	/**
   121 	/**
   122 	 * Locates a folder on the remote filesystem.
   122 	 * Locates a folder on the remote filesystem.
   123 	 *
   123 	 *
   124 	 * @since 2.5.0
   124 	 * @since 2.5.0
   125 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
   125 	 * @deprecated 2.7.0 use WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir() instead.
   126 	 * @see WP_Filesystem::abspath()
   126 	 * @see WP_Filesystem_Base::abspath()
   127 	 * @see WP_Filesystem::wp_content_dir()
   127 	 * @see WP_Filesystem_Base::wp_content_dir()
   128 	 * @see WP_Filesystem::wp_plugins_dir()
   128 	 * @see WP_Filesystem_Base::wp_plugins_dir()
   129 	 * @see WP_Filesystem::wp_themes_dir()
   129 	 * @see WP_Filesystem_Base::wp_themes_dir()
   130 	 * @see WP_Filesystem::wp_lang_dir()
   130 	 * @see WP_Filesystem_Base::wp_lang_dir()
   131 	 *
   131 	 *
   132 	 * @param string $base The folder to start searching from.
   132 	 * @param string $base The folder to start searching from.
   133 	 * @param bool   $echo True to display debug information.
   133 	 * @param bool   $echo True to display debug information.
   134 	 *                     Default false.
   134 	 *                     Default false.
   135 	 * @return string The location of the remote path.
   135 	 * @return string The location of the remote path.
   136 	 */
   136 	 */
   137 	public function find_base_dir( $base = '.', $echo = false ) {
   137 	public function find_base_dir( $base = '.', $echo = false ) {
   138 		_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   138 		_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
   139 		$this->verbose = $echo;
   139 		$this->verbose = $echo;
   140 		return $this->abspath();
   140 		return $this->abspath();
   141 	}
   141 	}
   142 
   142 
   143 	/**
   143 	/**
   144 	 * Locates a folder on the remote filesystem.
   144 	 * Locates a folder on the remote filesystem.
   145 	 *
   145 	 *
   146 	 * @since 2.5.0
   146 	 * @since 2.5.0
   147 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
   147 	 * @deprecated 2.7.0 use WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir() methods instead.
   148 	 * @see WP_Filesystem::abspath()
   148 	 * @see WP_Filesystem_Base::abspath()
   149 	 * @see WP_Filesystem::wp_content_dir()
   149 	 * @see WP_Filesystem_Base::wp_content_dir()
   150 	 * @see WP_Filesystem::wp_plugins_dir()
   150 	 * @see WP_Filesystem_Base::wp_plugins_dir()
   151 	 * @see WP_Filesystem::wp_themes_dir()
   151 	 * @see WP_Filesystem_Base::wp_themes_dir()
   152 	 * @see WP_Filesystem::wp_lang_dir()
   152 	 * @see WP_Filesystem_Base::wp_lang_dir()
   153 	 *
   153 	 *
   154 	 * @param string $base The folder to start searching from.
   154 	 * @param string $base The folder to start searching from.
   155 	 * @param bool   $echo True to display debug information.
   155 	 * @param bool   $echo True to display debug information.
   156 	 * @return string The location of the remote path.
   156 	 * @return string The location of the remote path.
   157 	 */
   157 	 */
   158 	public function get_base_dir( $base = '.', $echo = false ) {
   158 	public function get_base_dir( $base = '.', $echo = false ) {
   159 		_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   159 		_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
   160 		$this->verbose = $echo;
   160 		$this->verbose = $echo;
   161 		return $this->abspath();
   161 		return $this->abspath();
   162 	}
   162 	}
   163 
   163 
   164 	/**
   164 	/**
   272 		$last_path        = $folder_parts[ $last_index ];
   272 		$last_path        = $folder_parts[ $last_index ];
   273 
   273 
   274 		$files = $this->dirlist( $base );
   274 		$files = $this->dirlist( $base );
   275 
   275 
   276 		foreach ( $folder_parts as $index => $key ) {
   276 		foreach ( $folder_parts as $index => $key ) {
   277 			if ( $index == $last_index ) {
   277 			if ( $index === $last_index ) {
   278 				continue; // We want this to be caught by the next code block.
   278 				continue; // We want this to be caught by the next code block.
   279 			}
   279 			}
   280 
   280 
   281 			/*
   281 			/*
   282 			 * Working from /home/ to /user/ to /wordpress/ see if that file exists within
   282 			 * Working from /home/ to /user/ to /wordpress/ see if that file exists within
   341 	 * @return string The *nix-style representation of permissions.
   341 	 * @return string The *nix-style representation of permissions.
   342 	 */
   342 	 */
   343 	public function gethchmod( $file ) {
   343 	public function gethchmod( $file ) {
   344 		$perms = intval( $this->getchmod( $file ), 8 );
   344 		$perms = intval( $this->getchmod( $file ), 8 );
   345 
   345 
   346 		if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket.
   346 		if ( ( $perms & 0xC000 ) === 0xC000 ) { // Socket.
   347 			$info = 's';
   347 			$info = 's';
   348 		} elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link.
   348 		} elseif ( ( $perms & 0xA000 ) === 0xA000 ) { // Symbolic Link.
   349 			$info = 'l';
   349 			$info = 'l';
   350 		} elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular.
   350 		} elseif ( ( $perms & 0x8000 ) === 0x8000 ) { // Regular.
   351 			$info = '-';
   351 			$info = '-';
   352 		} elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special.
   352 		} elseif ( ( $perms & 0x6000 ) === 0x6000 ) { // Block special.
   353 			$info = 'b';
   353 			$info = 'b';
   354 		} elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory.
   354 		} elseif ( ( $perms & 0x4000 ) === 0x4000 ) { // Directory.
   355 			$info = 'd';
   355 			$info = 'd';
   356 		} elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special.
   356 		} elseif ( ( $perms & 0x2000 ) === 0x2000 ) { // Character special.
   357 			$info = 'c';
   357 			$info = 'c';
   358 		} elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe.
   358 		} elseif ( ( $perms & 0x1000 ) === 0x1000 ) { // FIFO pipe.
   359 			$info = 'p';
   359 			$info = 'p';
   360 		} else { // Unknown.
   360 		} else { // Unknown.
   361 			$info = 'u';
   361 			$info = 'u';
   362 		}
   362 		}
   363 
   363 
   785 	 * Creates a directory.
   785 	 * Creates a directory.
   786 	 *
   786 	 *
   787 	 * @since 2.5.0
   787 	 * @since 2.5.0
   788 	 * @abstract
   788 	 * @abstract
   789 	 *
   789 	 *
   790 	 * @param string     $path  Path for new directory.
   790 	 * @param string           $path  Path for new directory.
   791 	 * @param int|false  $chmod Optional. The permissions as octal number (or false to skip chmod).
   791 	 * @param int|false        $chmod Optional. The permissions as octal number (or false to skip chmod).
   792 	 *                          Default false.
   792 	 *                                Default false.
   793 	 * @param string|int $chown Optional. A user name or number (or false to skip chown).
   793 	 * @param string|int|false $chown Optional. A user name or number (or false to skip chown).
   794 	 *                          Default false.
   794 	 *                                Default false.
   795 	 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
   795 	 * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
   796 	 *                          Default false.
   796 	 *                                Default false.
   797 	 * @return bool True on success, false on failure.
   797 	 * @return bool True on success, false on failure.
   798 	 */
   798 	 */
   799 	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
   799 	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
   800 		return false;
   800 		return false;
   801 	}
   801 	}