awesome9/updates

WordPress update manager.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:Shell

1.0.3 2021-07-10 02:14 UTC

This package is auto-updated.

Last update: 2024-05-10 08:19:18 UTC


README

Awesome9 Latest Stable Version PHP from Packagist Total Downloads License

68747470733a2f2f696d672e69636f6e73382e636f6d2f6e6f6c616e2f3235362f617070726f76652d616e642d7570646174652e706e67

📃 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();

📖 Changelog

See the changelog file