From: Chad Horohoe Date: Mon, 3 Jan 2011 23:56:49 +0000 (+0000) Subject: Add new addExtensionTable() wrapper for adding new tables for extensions: way easier... X-Git-Tag: 1.31.0-rc.0~32849 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=0243ff103f37cfd8b3a0bd6d16050b879e878e75;p=lhc%2Fweb%2Fwiklou.git Add new addExtensionTable() wrapper for adding new tables for extensions: way easier than remembering array syntax for addExtensionUpdate() --- diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 65f2ddcc38..b13331939d 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -128,13 +128,23 @@ abstract class DatabaseUpdater { * first item is the callback function, it also can be a * simple string with the name of a function in this class, * following elements are parameters to the function. - * Note that callback functions will recieve this object as + * Note that callback functions will receive this object as * first parameter. */ public function addExtensionUpdate( Array $update ) { $this->extensionUpdates[] = $update; } + /** + * Convenience wrapper for addExtensionUpdate() when adding a new table (which + * is the most common usage of updaters in an extension) + * @param $tableName String Name of table to create + * @param $sqlPath String Full path to the schema file + */ + public function addExtensionTable( $tableName, $sqlPath ) { + $this->extensionUpdates[] = array( 'addTable', $tableName, $sqlPath, true ); + } + /** * Get the list of extension-defined updates *