awesome9 / updates
WordPress update manager.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:Shell
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-05-10 08:19:18 UTC
README
📃 About Updates
This package provides ease of running update routines within a plugin.
💾 Installation
composer require awesome9/updates
🕹 Usage
First, you need to spin out configuration for your updates.
Awesome9\Updates\Updates::get() ->set_folder( dirname( __FILE__ ) . '/updates' ) // Directory where you store your update routine files. ->set_version( '1.0.0' ) // Your plugin version. ->set_option_name( 'awesome9_plugin_version' ); // Option name to store version number in database.
Now, let's add some updates routines we want to run.
Awesome9\Updates\Updates::get() ->add_updates( array( '1.1.0' => 'update-1.1.0.php', '1.1.1' => 'update-1.1.1.php', ) );
Let's assume your plugin tree looks like this:
my-plugin/
└── updates/
├── update-1.1.0.php
└── update-1.1.1.php
The update file could look like this:
<?php /** * Update routine * * @since 1.1.0 */ /** * Update new roles and capabilities * * @since 1.1.0 * * @return void */ function awesome9_update_1_1_0_remove_role() { remove_role( 'awesome9_manager' ); remove_role( 'awesome9_employee' ); } awesome9_update_1_1_0_remove_role();