EQdkp Plus Navigation:   Home  |   Forum  |   Wiki  |   Translate  |   Bugtracker  |   WebSVN  |  USVN

PluginUpdater

From EQdkp Plus Wiki

Artikel Veraltet.png The information in this article refers to an older version of EQdkp Plus / of the plugin. It is not used any longer. See the information Box for further information.


Information
min. EQDKP-PLUS Version 0.6.2.0 or higher
max. EQDKP-PLUS Version 0.7.0.0



What is the Plugin Updater?

Most plugin updates needs database changes. Because of the missing upgrade functionality of the plugin API of eqdkp, i wrote a simple possibility to add SQL updates. Simply add this after the permission check on the settings page...

How to use it

$rupdater = new PluginUpdater('raidbanker','rb_','raidbanker_config','includes');

1. Name of the plugin 2. Prefix of the plugin database tables 3. Name of the configuration Table without prefix 4. Name of the folder where the /updates folder is located

All you have to do now, is to set the output to the template and insert it into the settings.html template file

'UPDATE_BOX'			  => $rupdater->OutputHTML(),

Now, we’re ready to add the updates folder in the include(s) folder. Add a new file: versions.php. This files contains an array with ALL new versions require database updates. If a version bump do not need Database changes, simply do not add it to this file.

$up_updates 	= array(
      '2.0.0'   => array(
                      'file'  => '100_to_200.php',
                      'old'   => '1.0.0',
      ),
);

The structure is pretty simple:

 
$up_updates 	= array(
      'NEW VERSION'   => array(
                      'file'  => 'FILE WITH DATABASE CHANGES',
                      'old'   => 'OLD VERSION',
      ), // you can add more than one... for each version one value....
);

All you have to do now is to add the file provided in the updates folder. $new_version The new Version after the update $updateFunction Do you want to use an update function? If yes, provide an UNIQUE function name, p.e. “raidplan400to410” $updateSQL The update array, each value = one SQL statement

$new_version    = '2.0.0';
$updateFunction = false;
$updateSQL = array("ALTER TABLE `".$table_prefix."raidplan_raids` ADD raid_date_invite int(11) NOT NULL default '0';",
	"ALTER TABLE `".$table_prefix."raidplan_raid_attendees` ADD attendees_note text default NULL;",
);

Kategorie:Libraries