r99461 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99460‎ | r99461 | r99462 >
Date:03:57, 11 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Add documentation

Add addExtensionField and addExtensionIndex utility functions
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -172,6 +172,24 @@
173173 }
174174
175175 /**
 176+ * @param $tableName string
 177+ * @param $indexName string
 178+ * @param $sqlPath string
 179+ */
 180+ public function addExtensionIndex( $tableName, $indexName, $sqlPath ) {
 181+ $this->extensionUpdates[] = array( 'addIndex', $tableName, $indexName, $sqlPath, true );
 182+ }
 183+
 184+ /**
 185+ * @param $tableName string
 186+ * @param $columnName string
 187+ * @param $sqlPath string
 188+ */
 189+ public function addExtensionField( $tableName, $columnName, $sqlPath ) {
 190+ $this->extensionUpdates[] = array( 'addField', $tableName, $columnName, $sqlPath );
 191+ }
 192+
 193+ /**
176194 * Get the list of extension-defined updates
177195 *
178196 * @return Array
@@ -180,6 +198,9 @@
181199 return $this->extensionUpdates;
182200 }
183201
 202+ /**
 203+ * @return array
 204+ */
184205 public function getPostDatabaseUpdateMaintenance() {
185206 return $this->postDatabaseUpdateMaintenance;
186207 }
@@ -232,6 +253,10 @@
233254 $this->updates = array_merge( $this->updates, $updates );
234255 }
235256
 257+ /**
 258+ * @param $version
 259+ * @param $updates array
 260+ */
236261 protected function setAppliedUpdates( $version, $updates = array() ) {
237262 $this->db->clearFlag( DBO_DDLMODE );
238263 if( !$this->canUseNewUpdatelog() ) {
@@ -249,6 +274,8 @@
250275 * Obviously, only use this for updates that occur after the updatelog table was
251276 * created!
252277 * @param $key String Name of the key to check for
 278+ *
 279+ * @return bool
253280 */
254281 public function updateRowExists( $key ) {
255282 $row = $this->db->selectRow(
@@ -295,6 +322,8 @@
296323 * $wgExtNewTables/Fields/Indexes. This is nasty :) We refactored a lot
297324 * of this in 1.17 but we want to remain back-compatible for a while. So
298325 * load up these old global-based things into our update list.
 326+ *
 327+ * @return array
299328 */
300329 protected function getOldGlobalUpdates() {
301330 global $wgExtNewFields, $wgExtNewTables, $wgExtModifiedFields,

Status & tagging log