From: jeroendedauw Date: Thu, 23 Aug 2012 20:43:20 +0000 (+0200) Subject: Enable dropping of tables without having to create a file for each if you want correc... X-Git-Tag: 1.31.0-rc.0~22612^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=bdaee6f6594532409ce55e9cde0f942f96ec4181;p=lhc%2Fweb%2Fwiklou.git Enable dropping of tables without having to create a file for each if you want correct output in the console Change-Id: I374885517928430d00446b9711ea5005f58dc2a1 --- diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index d411a272b6..d98942744e 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -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" ); }