_upgrade_422_find_genericons_files_in_folder( string $directory ): string[]
- Since
- 4.2.2
- Source
wp-admin/includes/update-core.php:2102
Compatibility
- WordPress
- since 4.2.2
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$directorystring- Directory path. Expects trailingslashed.
Return value
string[]
Performance profile
How much work a call to _upgrade_422_find_genericons_files_in_folder() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 4
- Plugin surface
- None
- Called by
- 2
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5. The body compiles to 51.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost _upgrade_422_find_genericons_files_in_folder() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 4 | none |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 51 | 4 | 5 | |
| 8.5 | 51 | 4 | 5 | |
| 8.4 | 51 | 4 | 5 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 57 | 7 | 5 | |
| 8.2 | 57 | 7 | 5 | |
| 8.1 | 57 | 7 | 5 | |
| 7.4 | 57 | 7 | 5 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 2
- trailingslashit()Appends a trailing slash.
- _upgrade_422_find_genericons_files_in_folder()Recursively find Genericons example files in a given folder.
Used by · 2
- _upgrade_422_find_genericons_files_in_folder()Recursively find Genericons example files in a given folder.
- _upgrade_422_remove_genericons()Cleans up Genericons example files.
Source code
function _upgrade_422_find_genericons_files_in_folder( $directory ) { $directory = trailingslashit( $directory ); $files = array(); if ( file_exists( "{$directory}example.html" ) /* * Note: str_contains() is not used here, as this file is included * when updating from older WordPress versions, in which case * the polyfills from wp-includes/compat.php may not be available. */ && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) { $files[] = "{$directory}example.html"; } $dirs = glob( $directory . '*', GLOB_ONLYDIR ); $dirs = array_filter( $dirs, static function ( $dir ) { /* * Skip any node_modules directories. * * Note: str_contains() is not used here, as this file is included * when updating from older WordPress versions, in which case * the polyfills from wp-includes/compat.php may not be available. */ return false === strpos( $dir, 'node_modules' ); } ); if ( $dirs ) { foreach ( $dirs as $dir ) { $files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) ); } } return $files;}Changelog
Introduced in 4.2.2. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
array to string[].verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-admin/includes/update-core.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.