From: erwanlr Date: Tue, 26 Feb 2013 21:55:40 +0000 (+0100) Subject: Fixes Runner::set_wp_root to handle absolute & relative path X-Git-Tag: v0.9.0~67^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f4260a522c9573163e744b622c199c614899e032;p=wvm%2Fwvm.git Fixes Runner::set_wp_root to handle absolute & relative path --- diff --git a/php/WP_CLI/Runner.php b/php/WP_CLI/Runner.php index 433507c3..ff9ecb27 100644 --- a/php/WP_CLI/Runner.php +++ b/php/WP_CLI/Runner.php @@ -82,11 +82,20 @@ class Runner { } private static function set_wp_root( $config ) { - if ( !empty( $config['path'] ) ) { - define( 'ABSPATH', rtrim( $config['path'], '/' ) . '/' ); - } else { - define( 'ABSPATH', getcwd() . '/' ); + $path = getcwd(); + + if ( !empty( $config['path'] ) ) + { + if ( self::is_absolute_path( $config['path'] ) ) + $path = $config['path']; + else + $path .= $config['path']; } + define( 'ABSPATH', rtrim( $path, '/' ) . '/' ); + } + + private static function is_absolute_path( $path ) { + return $path[0] === '/' ? true : false; } private static function set_url( $assoc_args ) {