• Resolved danbeach

    (@danbeach)


    Recently, we’ve been getting a lot (every 5 seconds or so)of PHP errors related to NS-Cloner. They all look like:

    Cron reschedule event error for hook: ns_cloner_cron, Error code: invalid_schedule, Error message: Event schedule does not exist., Data: {"schedule":"ns_cloner_cron_interval","args":[],"interval":120}

    I’m not exactly sure when they started, by guess is in the last couple of weeks, since either the 4.4.6 or 4.4.7 update. Is there something we can do to get rid of these?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Never Settle

    (@neversettle)

    Hello @danbeach

    The latest release that went out yesterday should not have the php notice. Please confirm

    Thread Starter danbeach

    (@danbeach)

    We are running the latest version (4.4.7) and continue to see the php errors.

    jdarbuckle

    (@jdarbuckle)

    Following for updates, thanks.

    I’m also seeing this warning in the debug.log file after upgrading to the most recent NS Cloner version and WP 6.6.1.

    It seems that the NS Cloner’s register_interval() hook is not active when wp-cron.php calls wp_reschedule_event()

    Plugin Author Never Settle

    (@neversettle)

    Hello,

    We have pushed version 4.4.7.1 that fixes this issue. Thank you for your patience on this

    Sounds great!

    But according to my testing, this unfortunately doesn’t fix the issue. I still see the warnings in my debug.log file after installing v4.4.7.1 when the background cron jobs are running.

    It seems that the an extra check for wp_doing_cron() should be added to the $should_load variable in the __construct() method of the NS_Cloner class.

    If I manually add such a check, then I no longer see the warnings.

    Plugin Author Never Settle

    (@neversettle)

    Hello @keepmovingdk

    Which PHP version are you using? I have tested with PHP version from 7.x to 8.2 and there are no notices.

    The problem is not related to PHP version (I’m on PHP 8.2).

    The problem happens if using the built-in WP cron. You can manually trigger this by accessing this URL:
    https://<hostname>/wp-cron.php?doing_wp_cron

    Then you should (hopefully) see the warning in the debug.log file. But let me know if you don’t, then I’ll be happy to see if I can provide additional troubleshooting steps.

    Plugin Author Never Settle

    (@neversettle)

    Hello @keepmovingdk,

    I still cannot replicate this. The cron is instantiated once all plugins are active and enabled. If you can, try disabling other plugins and only using cloner to check if the notice appears. Alternatively if this is not possible, you can try on a different installation of WordPress.

    Thank you for your patience. I’m able to reproduce it on two different installations (one a local installation, the other our production site).

    The notice also appears with no other plugins active.

    I’m not sure why you are not able to reproduce it. Maybe because the wp-cron.php only causes the warning if there are active cron jobs ready for execution and if the ns_cloner_cron needs to be rescheduled.

    It’s correct that the cron is instantiated after plugins are active and enabled. But in the the?__construct()?method of the?NS_Cloner?class you have the following line 178:

    $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();

    When wp-cron.php is being run in my environment, none of these conditions are true which leads to the warning.

    To fix this, the line could be changed to also check for wp_doing_cron():

    $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();

    It’s fair enough if you don’t want to make this change unless other people also report the problem ??
    But I hope you find a way to reproduce it.

    Plugin Author Never Settle

    (@neversettle)

    Hey @keepmovingdk,

    Thanks for the assistance. Yes, this should fix the issue

    Great stuff @keepmovingdk !

    Hi Authors,

    I have a value which return null when I call ns_cloner()->schedule->add() to clone my site via API in my plugin and i have active cloner pro plugin and site copier plugin but it isn’t work. Can you show me how to fix this error ?

    My request data:

    [template_blog_id] => 2 [subdomain] => jodi [title] => Jodi Orosz [options] => {“owner_key”:”52c1e6cb377600412bc81978ad677bf43eb2b54e”,”api_key”:”Y2IzZGVhOWFiMGZlYWM1NTU2Y2E4NDBmOTkyYTc2Zjg1ZTViZjFlOQ==”,”api_password”:”ZmU4NWZhZTJlODgyZmY0MzJiMzM4MDc4MDhjNjE4MDY4Zjc1MTJhMw==”,”owner_username”:”jodi”,”owner_365_email”:”[email protected]”} [wp_new_user] => {“username”:”jodi”,”email”:”[email protected]”}

    My url endpoint: ttps://example.com/wp-json/365villas/api/v1/sites/create

    My Errors:

    <b>Fatal error</b>: Uncaught Error: Call to a member function add() on null in /home/sierralite/public_html/wp-content/plugins/villas-365-api/api/class-villas-365-api-sites.php:760 Stack trace: #0 /home/sierralite/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): Villas_365_API_Sites-&gt;siteCreate() #1 /home/sierralite/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server-&gt;respond_to_request() #2 /home/sierralite/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server-&gt;dispatch() #3 /home/sierralite/public_html/wp-includes/rest-api.php(420): WP_REST_Server-&gt;serve_request() #4 /home/sierralite/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded() #5 /home/sierralite/public_html/wp-includes/class-wp-hook.php(348): WP_Hook-&gt;apply_filters() #6 /home/sierralite/public_html/wp-includes/plugin.php(565): WP_Hook-&gt;do_action() #7 /home/sierralite/public_html/wp-includes/class-wp.php(418): do_action_ref_array() #8 /home/sierralite/public_html/wp-includes/class-wp.php in <b>/home/sierralite/public_html/wp-content/plugins/villas-365-api/api/class-villas-365-api-sites.php</b> on line <b>760</b><br />

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.