Merge "Silence warnings about deprecation by ContentHandler."
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index d411a27..a575334 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Deployment
  */
 
-require_once( dirname(__FILE__) . '/../../maintenance/Maintenance.php' );
+require_once( __DIR__ . '/../../maintenance/Maintenance.php' );
 
 /**
  * Class for handling database updates. Roughly based off of updaters.inc, with
@@ -177,7 +177,7 @@ abstract class DatabaseUpdater {
         *                Note that callback functions will receive this object as
         *                first parameter.
         */
-       public function addExtensionUpdate( Array $update ) {
+       public function addExtensionUpdate( array $update ) {
                $this->extensionUpdates[] = $update;
        }
 
@@ -558,13 +558,28 @@ abstract class DatabaseUpdater {
        }
 
        /**
+        * If the specified table exists, drop it, or execute the
+        * patch if one is provided.
+        *
+        * Public @since 1.20
+        *
         * @param $table string
-        * @param $patch string
+        * @param $patch string|false
         * @param $fullpath bool
         */
-       protected function dropTable( $table, $patch, $fullpath = false ) {
+       public function dropTable( $table, $patch = false, $fullpath = false ) {
                if ( $this->db->tableExists( $table, __METHOD__ ) ) {
-                       $this->applyPatch( $patch, $fullpath, "Dropping table $table" );
+                       $msg = "Dropping table $table";
+
+                       if ( $patch === false ) {
+                               $this->output( "$msg ..." );
+                               $this->db->dropTable( $table, __METHOD__ );
+                               $this->output( "done.\n" );
+                       }
+                       else {
+                               $this->applyPatch( $patch, $fullpath, $msg );
+                       }
+
                } else {
                        $this->output( "...$table doesn't exist.\n" );
                }