• Resolved larus-argentatus

    (@ecce-homo)


    Hello there

    What is the correct way to import blogs using wp cli?

    I’d like to import all the blogs in a single pass. But a single blog

    wp multisite_aggregate aggregate_blog_id=3

    gives

    Error: ‘aggregate_blog_id=3’ is not a registered subcommand of ‘multisite_aggregate’. See ‘wp help multisite_aggregate’ for available subcommands. Did you mean ‘aggregate_blog_id’?

    and

    wp multisite_aggregate aggregate_blog_id

    without parameters, just bombs out …

    Notice: Trying to get property of non-object in /Users/pi/Documents/Websites/divitests.dev.cc/wp-content/plugins/wds-multisite-aggregate/includes/WDS_Multisite_Aggregate_CLI.php on line 87
    Fatal error: Uncaught Error: Call to a member function get() on null in /Users/pi/Documents/Websites/divitests.dev.cc/wp-content/plugins/wds-multisite-aggregate/includes/WDS_Multisite_Aggregate_CLI.php:63
    Stack trace:
    #0 [internal function]: WDS_Multisite_Aggregate_CLI->aggregate_blog_id(Array, Array)
    #1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
    #2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
    #3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
    #4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(365): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
    #5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(388): WP_CLI\Runner->run_command(Array, Array)
    #6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1113): WP_CLI\Runner->_run_command_and_ex in /Users/pi/Documents/Websites/divitests.dev.cc/wp-content/plugins/wds-multisite-aggregate/includes/WDS_Multisite_Aggregate_CLI.php on line 63

    Am I missing something?

    Also the ../includes/WDS_Multisite_Aggregate_CLI.php implies blog_id should be used but this may be a typo

    * ## EXAMPLES
    * wp multisite_aggregate blog_id=1

    I have been relying on the predecessor wordpress-mu-sitewide-tags, from which this plugin is forked, but this implementation is obviously quite a lot better and may permit an almost seamless transition …

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Based on the example pasted at the very end, you want something like this:

    wp multisite_aggregate blog_id=3
    

    while you were trying

    wp multisite_aggregate aggregate_blog_id=3
    

    Looks like you were maybe using “aggregate” too much.

    Worth a quick try.

    Thread Starter larus-argentatus

    (@ecce-homo)

    Thank you Michael for the quick reply

    wp multisite_aggregate blog_id=3

    gives an error too:

    Error: ‘blog_id=3’ is not a registered subcommand of ‘multisite_aggregate’.

    See ‘wp help multisite_aggregate’ for available subcommands.

    Also, is it possible to import all the blogs at once?

    Playing the wp cli, I can get –help, activate and deactivate the plugin but not much else.

    Maybe I need to update my wp cli!?

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Looking at the actual CLI file for the plugin that implements things, the immediate docs shown above may be a bit inaccurate for what it actually expects.

    From the code:

    WP_CLI::error( '"--id=BLOG_ID" is required and must be a numeric value' );
    

    this has me thinking it may be:

    wp multisite_aggregate --id=3
    

    Worth another attempt.

    Thread Starter larus-argentatus

    (@ecce-homo)

    OK … that results in:

    usage: wp multisite_aggregate aggregate_blog_id
    or: wp multisite_aggregate blogs_to_aggregate
    or: wp multisite_aggregate from_blog [–id=<int>] [–post_count=<int>]
    or: wp multisite_aggregate get_option [–key=<string>]

    See ‘wp help multisite_aggregate <command>’ for more information on a specific command.

    I had in fact already given that a spin and this …

    wp multisite_aggregate from_blog --id=3

    Fatal error: Uncaught Error: Call to a member function _populate_posts_from_blog() on null in /Users/pi/Documents/Websites/divitests.dev.cc/wp-content/plugins/wds-multisite-aggregate/includes/WDS_Multisite_Aggregate_CLI.php:28
    Stack trace:
    #0 [internal function]: WDS_Multisite_Aggregate_CLI->from_blog(Array, Array)
    #1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
    #2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
    #3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
    #4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(365): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
    #5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(388): WP_CLI\Runner->run_command(Array, Array)
    #6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1113): WP_CLI\Runner->_run_ in /Users/pi/Documents/Websites/divitests.dev.cc/wp-content/plugins/wds-multisite-aggregate/includes/WDS_Multisite_Aggregate_CLI.php on line 28

    The plugin seems to work OKish from the WP admin panel. I was getting some intermittent PHP warnings, which is why I was trying the wp cli route. The warnings actually have gone away after I reimported one larger site and then started the populating process on a fresh global tags site.

    On a different topic, is there anything at all in the WDS aggregator code that might cause the main wp_options table to get updated. This is where my investigations started when I found that an admin user by adding a post would pass their theme settings to the aggregator site (they are using their own child themes).

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    I don’t know the internals of the plugin as well as I could, and I don’t believe we have anyone actively working on it. That said, based on that error, it seems that line 86 from WDS_Multisite_Aggregate_CLI.php isn’t finding a global object. This is despite it being instantiated in the main plugin file, and right before we load the CLI file.

    Not seeing anything relating to wp_options in the code with a quick grep of “options” It’s mostly all references to a getter method on an object named “$options” which is storing our own options for a given aggregation.

    Thread Starter larus-argentatus

    (@ecce-homo)

    Thank you so much for chipping in.

    I will test some other things too, as my localhost is running PHP 7.1. I’ll try it on 5.6 and turn debug on.

    The wp_options problem is a complete mystery to me, and the theme it affects has a wonderful support team that seem to be incentivised to say disable this or that plugin, as if that is not the first thing I thought of!

    Once again thank you for your support.

    ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp cli question’ is closed to new replies.