From 0243ff103f37cfd8b3a0bd6d16050b879e878e75 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 3 Jan 2011 23:56:49 +0000 Subject: [PATCH] Add new addExtensionTable() wrapper for adding new tables for extensions: way easier than remembering array syntax for addExtensionUpdate() --- includes/installer/DatabaseUpdater.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 * -- 2.20.1