You appear to be a bot. Output may be restricted
Description
Locate the wp-config.php they expected to useFILE may be a symlinked directory but we need to work based on the current directory so we work our way up the directory path until we find a wp-config.php and treat that directory as abspath
The ABSPATH constant refers to the directory in which WP is installed. as we see in the comment in wp-config.php Absolute path to the WordPress directory.
Usage
$string = oik_batch_locate_wp_config();
Parameters
Returns
string the normalized path to the wp-config.php fileTO DO
What if we move wp-config.php to the directory above? Do we have to set ABSPATH differently? A. It depends on the presence of wp-settings.php in that folder.Source
File name: oik-batch/libs/oik-cli.phpLines:
1 to 23 of 23
function oik_batch_locate_wp_config() { $owd = getcwd(); $owd = oik_normalize_path( $owd ); $abspath = null; while ( $owd ) { if ( file_exists( $owd . "/wp-config.php" ) ) { $abspath = $owd . '/'; $owd = null; } else { $next = dirname( $owd ); //echo "Checking $next after $owd" . PHP_EOL; if ( $next == $owd ) { $owd = null; } else { $owd = $next; } } } //echo "wp-config in: $abspath" . PHP_EOL; //echo "ABSPATH: $abspath" . PHP_EOL; return( $abspath ); }View on GitHub