Changeset 51910 for trunk/src/wp-includes/functions.php
- Timestamp:
- 10/15/2021 10:23:35 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r51885 r51910 8222 8222 * 8223 8223 * @since 5.6.0 8224 * @since 5.9.0 Added input validation with a notice for invalid input. 8224 8225 * 8225 8226 * @param string $path Full path of a directory or file. 8226 8227 */ 8227 8228 function clean_dirsize_cache( $path ) { 8229 if ( ! is_string( $path ) || empty( $path ) ) { 8230 trigger_error( 8231 sprintf( 8232 /* translators: 1: Function name, 2: A variable type, like "boolean" or "integer". */ 8233 __( '%1$s only accepts a non-empty path string, received %2$s.' ), 8234 '<code>clean_dirsize_cache()</code>', 8235 '<code>' . gettype( $path ) . '</code>' 8236 ) 8237 ); 8238 return; 8239 } 8240 8228 8241 $directory_cache = get_transient( 'dirsize_cache' ); 8229 8242 … … 8232 8245 } 8233 8246 8234 $path = untrailingslashit( $path ); 8247 if ( 8248 strpos( $path, '/' ) === false && 8249 strpos( $path, '\\' ) === false 8250 ) { 8251 unset( $directory_cache[ $path ] ); 8252 set_transient( 'dirsize_cache', $directory_cache ); 8253 return; 8254 } 8255 8256 $last_path = null; 8257 $path = untrailingslashit( $path ); 8235 8258 unset( $directory_cache[ $path ] ); 8236 8259 8237 while ( DIRECTORY_SEPARATOR !== $path && '.' !== $path && '..' !== $path ) { 8238 $path = dirname( $path ); 8260 while ( 8261 $last_path !== $path && 8262 DIRECTORY_SEPARATOR !== $path && 8263 '.' !== $path && 8264 '..' !== $path 8265 ) { 8266 $last_path = $path; 8267 $path = dirname( $path ); 8239 8268 unset( $directory_cache[ $path ] ); 8240 8269 }
Note: See TracChangeset
for help on using the changeset viewer.