public function execute( $par ) { global $wgOut, $wgUser; # only sysops and bureaucrats can update the DB if ( !$this->userCanExecute( $wgUser ) ) { $wgOut->addHTML( 'You have to be a member of the following group(s) to perform web install:' . implode( ', ', $this->allowed_groups ) ); return; } # display update result $wgOut->addHTML( qp_SchemaUpdater::checkAndUpdate() ); }
/** * Initializes missed tables grouped by their related sets */ private static function initializeTables() { $db = & wfGetDB( DB_MASTER ); /* check whether the tables were initialized */ $result = true; foreach ( self::$sql_tables as $sourceFile => &$tableset ) { $tablesNotFound = self::tablesExists( $tableset ); if ( count( $tablesNotFound ) === count( $tableset ) ) { # all of the tables in set are missing self::$tablesInit = array_merge( self::$tablesInit, $tableset ); # no tables were found, initialize the DB completely with minimal version if ( ( $r = $db->sourceFile( qp_Setup::$ExtDir . "/tables/{$sourceFile}" ) ) !== true ) { throw new Exception( $r ); } } elseif ( count( $tablesNotFound ) > 0 ) { # some tables are missing, serious DB error throw new Exception( "The following extension's database tables are missing: " . implode( ', ', $tablesNotFound ) . "<br />Please restore from backup or drop the remaining extension tables, then reload this page." ); } } }