• Resolved krut1

    (@krut1)


    If I try to execute a WP CLI command, sometimes I get this error (and command is not executed):

    Warning: Some code is trying to do a URL redirect. Backtrace:
    #0  WP_CLI\Utils\wp_redirect_handler(/?repeat=w3tc) called at [/wordpress/wp-includes/class-wp-hook.php:290]
    #1  WP_Hook->apply_filters(/?repeat=w3tc, Array ([0] => /?repeat=w3tc,[1] => 302)) called at [/wordpress/wp-includes/plugin.php:206]
    #2  apply_filters(wp_redirect, /?repeat=w3tc, 302) called at [/wordpress/wp-includes/pluggable.php:1230]
    #3  wp_redirect(/?repeat=w3tc, 302, WordPress) called at [/wordpress/wp-includes/pluggable.php:1373]
    #4  wp_safe_redirect(/?repeat=w3tc, 302) called at [/wordpress/wp-content/plugins/w3-total-cache/Util_Environment.php:1021]
    #5  W3TC\Util_Environment::safe_redirect_temp(/?repeat=w3tc) called at [/wordpress/wp-content/plugins/w3-total-cache/Generic_Plugin.php:208]
    #6  W3TC\Generic_Plugin->init() called at [/wordpress/wp-includes/class-wp-hook.php:288]
    #7  WP_Hook->apply_filters(, Array ([0] => )) called at [/wordpress/wp-includes/class-wp-hook.php:312]
    #8  WP_Hook->do_action(Array ([0] => )) called at [/wordpress/wp-includes/plugin.php:478]
    #9  do_action(init) called at [/wordpress/wp-settings.php:523]
    #10 require(/wordpress/wp-settings.php) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1237]
    #11 WP_CLI\Runner->load_wordpress() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1158]
    #12 WP_CLI\Runner->start() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23]
    #13 WP_CLI\Bootstrap\LaunchRunner->process(WP_CLI\Bootstrap\BootstrapState Object ([WP_CLI\Bootstrap\BootstrapStatestate] => Array ())) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74]
    #14 WP_CLI\bootstrap() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27]
    #15 include(phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php) called at [phar:///usr/local/bin/wp/php/boot-phar.php:11]
    #16 include(phar:///usr/local/bin/wp/php/boot-phar.php) called at [/usr/local/bin/wp:4]

    Could you please do not any redirects in AJAX / CLI / ADMIN-PANEL / … ?

    • This topic was modified 4 years, 10 months ago by krut1.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @krut1

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    That redirect repeat=w3tc, which is temporary is issued once under normal conditions.
    wp-content/w3tc-config/blogs.php file is created on that redirect with blog URLs mapping info. permanent redirect usually caused by the inability to create that file (locked down permissions). When blogs.php is there and filled in – it should not make redirects.
    Check if that file exists and also check your permissions.
    Thank you!

    Thread Starter krut1

    (@krut1)

    Hi @vmarko,

    Do yuo mean the file wp-content/cache/blogs.php? The file wp-content/w3tc-config/blogs.php doesn’t exist, and I see this in the code:

    define( 'W3TC_CACHE_DIR', WP_CONTENT_DIR . '/cache' );
    ...
    define( 'W3TC_CACHE_BLOGMAP_FILENAME', W3TC_CACHE_DIR . '/blogs.php' );

    If you mean wp-content/cache/blogs.php, then the file exists and have right access permissions.

    We are using multisite and we have more than 5 000 blogs. We start oft wp cli commants for each blog.

    What happens with blogs.php, can it be cleared? If yes, than it is possible, that the blog is not yet in blogs.php.

    My idea is: do not any redirects in AJAX / CLI / ADMIN-PANEL / … ?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @krut1

    Thank you for the info.
    Is it some specific W3TC wp-cli command or does it happen after every command?
    Thanks!

    Thread Starter krut1

    (@krut1)

    Last time it happened with: wp --url=https://*.com wc update.

    Before it has happened with wp core update-db --network.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @krut1

    Checking this. I’ll get back to you as soon as we investigate.
    Thanks!

    Thread Starter krut1

    (@krut1)

    Ok, thanks. We are waiting for it.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @krut1
    Thank you for your patience.
    What happens is that plugin may not initialize when there’s no entry for this URL in blogs.php, so it adds it there and issues redirect.
    In this case, you may try to execute command twice when the redirect happens.
    I’ve created an issues in our Github Repository on your behalf. Please make sure to follow the progress of the issue regularly.
    Thank you!

    Thread Starter krut1

    (@krut1)

    Thanks a lot. Yes, today we execute the code twice. But it needs more time. One script works 6 hours. Because we have the problem with W3TC, we invest 12 hours to execute it twice ??

    Thread Starter krut1

    (@krut1)

    I would like to have this topic unresolved till it will be resolved there: https://github.com/W3EDGE/w3-total-cache/issues/182 ??

    I would like to second this become unresolved as it is not until that issue 182 is fixed. My team is also experiencing this issue and it is quite the problem.

    Thread Starter krut1

    (@krut1)

    Why is this topic resolved? This issue is not ready: https://github.com/W3EDGE/w3-total-cache/issues/182

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @krut1 @kevinu

    We just published a release candidate including a fix for this issue.
    Please check the GitHub issue for more details.
    Thanks!

    Thread Starter krut1

    (@krut1)

    Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WP CLI: Some code is trying to do a URL redirect’ is closed to new replies.