Merge "(bug 44160) Fix invalid link of `others` during installation"
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index cd5f90b..9caf168 100644 (file)
@@ -295,6 +295,17 @@ abstract class DatabaseUpdater {
                $this->extensionUpdates[] = array( 'renameIndex', $tableName, $oldIndexName, $newIndexName, $skipBothIndexExistWarning, $sqlPath, true );
        }
 
+       /**
+        * @since 1.21
+        *
+        * @param $tableName string The table name
+        * @param $fieldName string The field to be modified
+        * @param $sqlPath string The path to the SQL change path
+        */
+       public function modifyExtensionField( $tableName, $fieldName, $sqlPath) {
+               $this->extensionUpdates[] = array( 'modifyField', $tableName, $fieldName, $sqlPath, true );
+       }
+
        /**
         *
         * @since 1.20
@@ -564,7 +575,7 @@ abstract class DatabaseUpdater {
         *
         * @return Array
         */
-       protected abstract function getCoreUpdateList();
+       abstract protected function getCoreUpdateList();
 
        /**
         * Append an SQL fragment to the open file handle.
@@ -687,7 +698,6 @@ abstract class DatabaseUpdater {
 
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...skipping: '$table' table doesn't exist yet.\n" );
-                       return false;
                } else if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
                        $this->output( "...index $index already set on $table table.\n" );
                } else {
@@ -752,17 +762,22 @@ abstract class DatabaseUpdater {
         * @return Boolean false if this was skipped because schema changes are skipped
         */
        protected function renameIndex( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath = false ) {
+               if ( !$this->doTable( $table ) ) {
+                       return true;
+               }
+
                // First requirement: the table must exist
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...skipping: '$table' table doesn't exist yet.\n" );
-                       return false;
+                       return true;
                }
 
                // Second requirement: the new index must be missing
                if ( $this->db->indexExists( $table, $newIndex, __METHOD__ ) ) {
                        $this->output( "...index $newIndex already set on $table table.\n" );
                        if ( !$skipBothIndexExistWarning && $this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
-                               $this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n            $oldIndex should be manually removed if not needed anymore.\n" );
+                               $this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n" .
+                                       "            $oldIndex should be manually removed if not needed anymore.\n" );
                        }
                        return true;
                }
@@ -770,7 +785,7 @@ abstract class DatabaseUpdater {
                // Third requirement: the old index must exist
                if ( !$this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
                        $this->output( "...skipping: index $oldIndex doesn't exist.\n" );
-                       return false;
+                       return true;
                }
 
                // Requirements have been satisfied, patch can be applied