Open zvanderbilt opened 8 years ago
Thanks for reporting. I'll have look on this.
Sorry for responding this late, but I forgot this. Also, I've decided not to continue of developing this gem, as I personally haven't use it in years.
If this is something you're able to fix, please send a PR or comment the solution in here. Thank you.
It seems there is a path issue when using a non standard directory tree. Consider the following tree output:
tree -L 2
. ├── content │ ├── cache │ ├── index.php │ ├── plugins │ ├── themes │ ├── upgrade │ ├── uploads -> ../shared/content/uploads │ ├── w3tc-config │ └── wpalchemy ├── index.php ├── local-config.php ├── shared │ └── content ├── wp │ ├── index.php │ ├── license.txt │ ├── wp-activate.php │ ├── wp-admin │ ├── wp-blog-header.php │ ├── wp-comments-post.php │ ├── wp-config-sample.php │ ├── wp-content │ ├── wp-cron.php │ ├── wp-includes │ ├── wp-links-opml.php │ ├── wp-load.php │ ├── wp-login.php │ ├── wp-mail.php │ ├── wp-settings.php │ ├── wp-signup.php │ ├── wp-trackback.php │ └── xmlrpc.php ├── wp-config.php └── somesite-cron.php
Running wp option get siteurl from the command line will correctly produce the site url while using the gem in irb or a script will bail on a path issue. See below for example:
pwd /var/www/vhosts/somesite/stage/html
wp option get siteurl --allow-root PHP Notice: Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(792) : eval()'d code on line 24 http://stage.somesite.com/wp
/usr/bin/irb2.3 irb(main):001:0> require 'wpcli' => true irb(main):002:0> @wpcli = Wpcli::Client.new Dir.pwd => Wpcli::Client:0x00000000ca12f0 @path="/var/www/vhosts/somesite/stage/html" irb(main):005:0> site_name = @wpcli.run "option get siteurl --allow-root --debug" Debug: No readable global config found (0.011s) Debug: No project config found (0.012s) Debug: No package autoload found to load. (0.015s) Debug: ABSPATH defined: /var/www/vhosts/somesite/stage/html/ (0.015s) Error: This does not seem to be a WordPress install. Pass --path=
path/to/wordpress
or runwp core download
. => []