*/
protected $extensionUpdates = array();
- /**
- * Used to hold schema files during installation process
- * @var array
- */
- protected $newExtensions = array();
-
/**
* Handle to the database subclass
*
}
$this->maintenance->setDB( $db );
$this->initOldGlobals();
+ $this->loadExtensions();
wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
}
$wgExtModifiedFields = array(); // table, index, dir
}
+ /**
+ * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook
+ */
+ private function loadExtensions() {
+ if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
+ return; // already loaded
+ }
+ $vars = Installer::getExistingLocalSettings();
+ if ( !$vars ) {
+ return; // no LocalSettings found
+ }
+ if ( !isset( $vars['wgHooks'] ) || !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
+ return;
+ }
+ global $wgHooks, $wgAutoloadClasses;
+ $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates'];
+ $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses'];
+ }
+
/**
* @throws MWException
* @param DatabaseBase $db
$this->extensionUpdates[] = array( 'addTable', $tableName, $sqlPath, true );
}
- /**
- * Add a brand new extension to MediaWiki. Used during the initial install
- * @param $ext String Name of extension
- * @param $sqlPath String Full path to the schema file
- */
- public function addNewExtension( $ext, $sqlPath ) {
- $this->newExtensions[ strtolower( $ext ) ] = $sqlPath;
- }
-
- /**
- * Get the list of extensions that registered a schema with our DB type
- * @return array
- */
- public function getNewExtensions() {
- return $this->newExtensions;
- }
-
/**
* Get the list of extension-defined updates
*
}
protected function setAppliedUpdates( $version, $updates = array() ) {
+ $this->db->clearFlag( DBO_DDLMODE );
if( !$this->canUseNewUpdatelog() ) {
return;
}
$this->db->insert( 'updatelog',
array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
__METHOD__ );
+ $this->db->setFlag( DBO_DDLMODE );
}
/**
* @param $val String [optional] value to insert along with the key
*/
public function insertUpdateRow( $key, $val = null ) {
+ $this->db->clearFlag( DBO_DDLMODE );
$values = array( 'ul_key' => $key );
if( $val && $this->canUseNewUpdatelog() ) {
$values['ul_value'] = $val;
}
$this->db->insert( 'updatelog', $values, __METHOD__, 'IGNORE' );
+ $this->db->setFlag( DBO_DDLMODE );
}
/**