Patches and Upgrades
Introduction
The repository allows a way to have patches or upgrades to existing plugins offered for one-click automatic installation via. the repository. However, there is a certain file format that must be followed for patches and upgrades.
Since the act of patching and upgrading are almost the same (Both add/edit/remove files and / or SQL), the only difference is that an upgrade updates your plugin version number as well. Hence the structure of both are identical.
In the root directory of the patch / upgrade, there has to be the following directories and files:
- admin - This folder holds the files that you would like to be moved to the public_html/admin/plugins/yourplugin folder. Files with the same name will overwrite existing ones.
- public_html - All files that you would like copied to /public_html/yourplugin folder.
- plugins - All files you would like to be copied to /plugins/yourplugin folder.
- updates.php -- See below for information on this file
UPDATES.PHP
This file contains the instructions for the update / upgrade process to follow. This file is mandatory, and without it your patches / upgrades will not be able to be offered for automatic one-click install, instead will have to be manually installed by the user.
The structure of the file is as follows:
The file MUST include a static class named UpdatePlugin, that implements the PluginUpdateInterface interface.
PluginUpdateInterface interface:
interface PluginUpdateInterface { public static function init(); }
The sample class is below, with explanations:
class UpdatePlugin implements PluginUpdateInterface { public static $_SQL_DATA = array(); public static $_SQL_PTABLES = array(); public static $PLUGIN_NAME = 'repositorylisting'; public static function init() { // do nothing return true; } }
- public static $_SQL_DATA -