Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Comments

Rebuild update counter#14

Merged
ajotka merged 12 commits intodevfrom
feature/update-counter
Feb 4, 2019
Merged

Rebuild update counter#14
ajotka merged 12 commits intodevfrom
feature/update-counter

Conversation

@ajotka
Copy link
Contributor

@ajotka ajotka commented Jan 30, 2019

Hi :)

I rebuilt the update counter.
When it detects available updates, it saves the update version to the database.
Version checking now takes place only when someone entering the cloud blocks tab in dashboard and once per day using cron.

I also improved some translations and typos.

Before merge, please check if cron works as it should.

@foadyousefi
Copy link
Member

foadyousefi commented Jan 30, 2019

Thanks for great PR. There are some issues:

  1. register_activation_hook and register_deactivation_hook must be called from the plugins entry file, in our case, its cloud-blocks.php in the plugins root folder.

  2. Creating cronjobs on activation hook is the correct way, but what about those who already activated the plugin? In this case, I think it might be good if it was hooked to upgrader_process_complete action which fires after plugin update.

  3. In the Activator.php file on line 17, you forgot to change $current_db_version. Just change it to a higher number than the current number. This makes sure if there are any changes in the database schema.

  4. You forgot to add class to add_action( 'cron_check_updates', 'check_updates' ); in Explore.phpfile. If you are adding an action hook inside a class method, you must add callback as an array. This action should be like:add_action( 'cron_check_updates', array( CLASS, 'check_updates' ) );`

And thanks again for great pull requests

@ajotka
Copy link
Contributor Author

ajotka commented Jan 31, 2019

Hi :)
Thank you for the review!

I fixed those things.

  1. I moved hooks to entry file and I added init action for wp cron (but calmly, cron events will not be duplicated). - Tested. Works on upgrade, activate and removed on deactivate.
  2. As above. 'init' action resolved this problem.
  3. Changed.
  4. Fixed.

I tested, WP CRON works. Calling the method after entering the cloud blocks tab also works.
In addition, I changed the changelog and increased the version to 1.1.4 everywhere.

@ajotka ajotka merged commit 971cdd7 into dev Feb 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants