/**
* Script to initialise the MediaWiki namespace
*
- * This script is included from update.php and install.php. Do not run it
+ * This script is included from update.php and install.php. Do not run it
* by itself.
*
* @deprecated
global $wgLanguageNames;
global $IP;
- # overwrite language conversion option so that all variants
+ # overwrite language conversion option so that all variants
# of the messages are initialised
$wgDisableLangConversion = false;
} else {
$sortedArray = $wgAllMessagesEn;
}
-
+
ksort( $sortedArray );
$messages=array();
foreach ($variants as $v) {
$langclass = 'Language'. str_replace( '-', '_', ucfirst( $v ) );
if( !class_exists($langclass) ) {
- die ("class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?");
+ wfDie( "class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?" );
}
$lang = new $langclass;
$wgUser = new User;
$wgUser->setLoaded( true ); # Don't load from DB
$wgUser->setName( 'MediaWiki default' );
-
+
# Don't try to draw messages from the database we're initialising
$wgMessageCache->disable();
$wgMessageCache->disableTransform();
$fname = 'initialiseMessages';
$ns = NS_MEDIAWIKI;
# cur_user_text responsible for the modifications
- # Don't change it unless you're prepared to update the DBs accordingly, otherwise the
+ # Don't change it unless you're prepared to update the DBs accordingly, otherwise the
# default messages won't be overwritte
$username = 'MediaWiki default';
-
+
print "Initialising \"MediaWiki\" namespace...\n";
-
+
$dbr =& wfGetDB( DB_SLAVE );
$dbw =& wfGetDB( DB_MASTER );
$page = $dbr->tableName( 'page' );
} else {
$sortedArray = $wgAllMessagesEn;
}
-
+
ksort( $sortedArray );
# SELECT all existing messages
if ($maxitems)
$chunks = array_chunk($sortedArray, $maxitems);
else
- $chucks = array($sortedArray);
+ $chunks = array($sortedArray);
foreach ($chunks as $chunk) {
$first = true;
while ($row = $dbr->fetchObject($res))
$rows[] = $row;
}
-
+
# Read the results into an array
# Decide whether or not each one needs to be overwritten
$existingTitles = array();
$arr = array();
$talk = $wgContLang->getNsText( NS_TALK );
$mwtalk = $wgContLang->getNsText( NS_MEDIAWIKI_TALK );
-
+
+ # Merge these into a single transaction for speed
+ $dbw->begin();
+
# Process each message
foreach ( $sortedArray as $key => $enMsg ) {
if ( $key == '' ) {
$article->updateRevisionOn( $dbw, $revision );
}
}
+ $dbw->commit();
# Clear the relevant memcached key
print 'Clearing message cache...';