Don't call the size function count() as part of a test condition in loops. Compute the size beforehand, and not on each iteration.
Scrutinizer added a Performance label: these are the only violations. See #30799. Built from https://develop.svn.wordpress.org/trunk@31554 git-svn-id: http://core.svn.wordpress.org/trunk@31535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1516,7 +1516,7 @@ function wp_mkdir_p( $target ) {
|
||||
*/
|
||||
if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
|
||||
$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
|
||||
for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
|
||||
for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
|
||||
@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user