$fname = "initialiseMessages";
$ns = NS_MEDIAWIKI;
- if ( !$overwrite ) {
- $sql = "SELECT 1 FROM cur WHERE cur_namespace=$ns LIMIT 1";
- $res = wfQuery( $sql, DB_READ, $fname );
- if ( wfNumRows( $res ) ) {
- print "MediaWiki: namespace already initialised\n";
- return;
- }
- }
$timestamp = wfTimestampNow();
$invTimestamp = wfInvertTimestamp( $timestamp );
$title = $titleObj->getDBkey();
$dbencMsg = wfStrencode( $message );
+ $doInsert = true;
if ( $overwrite ) {
$sql = "DELETE FROM cur WHERE cur_namespace=$ns AND cur_title='$title'";
wfQuery( $sql, DB_WRITE, $fname );
+ } else {
+ $row = wfGetArray("cur", array("1"),
+ array("cur_namespace"=>$ns, "cur_title"=>$title));
+ if ($row) {
+ $doInsert = false;
+ }
+ }
+ if ( $doInsert ) {
+ $sql = "INSERT INTO cur (cur_namespace, cur_title, cur_text,
+ cur_user_text, cur_timestamp, cur_restrictions,
+ cur_is_new, inverse_timestamp, cur_touched) VALUES (
+ $ns,
+ '$title',
+ '$dbencMsg',
+ 'MediaWiki default',
+ '$timestamp',
+ 'sysop',
+ 1,
+ '$invTimestamp',
+ '$timestamp')";
+ wfQuery( $sql, DB_WRITE, $fname );
}
-
- $sql = "INSERT INTO cur (cur_namespace, cur_title, cur_text,
- cur_user_text, cur_timestamp, cur_restrictions,
- cur_is_new, inverse_timestamp, cur_touched) VALUES (
- $ns,
- '$title',
- '$dbencMsg',
- 'MediaWiki default',
- '$timestamp',
- 'sysop',
- 1,
- '$invTimestamp',
- '$timestamp')";
- wfQuery( $sql, DB_WRITE, $fname );
$mwObj =& MagicWord::get( MAG_MSGNW );
$mw = $mwObj->getSynonym( 0 );
$mw = str_replace( "$1", $key, $mw );
$navText = wfStrencode( $navText );
$title = wfMsgNoDB( "allmessages" );
+ $sql = "DELETE FROM cur WHERE cur_namespace=$ns AND cur_title='$title'";
+ wfQuery( $sql, DB_WRITE, $fname );
- if ( $overwrite ) {
- $sql = "DELETE FROM cur WHERE cur_namespace=$ns AND cur_title='$title'";
- wfQuery( $sql, DB_WRITE, $fname );
- }
-
$sql = "INSERT INTO cur (cur_namespace, cur_title, cur_text,
cur_user_text, cur_timestamp, cur_restrictions,
cur_is_new, inverse_timestamp, cur_touched) VALUES (
include_once( "../AdminSettings.php" );
$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-ini_set( "include_path", "$IP$sep$include_path" );
+ini_set( "include_path", "../includes$sep../languages$sep$include_path" );
include_once( "Setup.php" );
include_once( "./InitialiseMessages.inc" );
+include_once( "../install-utils.inc" );
$wgTitle = Title::newFromText( "Rebuild messages script" );
$wgCommandLineMode = true;
set_time_limit(0);
-initialiseMessages( true );
+print "1. Update messages to include latest additions to Language.php\n" .
+ "2. Delete all messages and reinitialise namespace\n" .
+ "3. Quit\n\n".
+
+ "Please enter a number: ";
+
+do {
+ $response = IntVal(readconsole());
+ if ( $response >= 1 && $response <= 3 ) {
+ $good = true;
+ } else {
+ $good = false;
+ print "Please type a number between 1 and 3: ";
+ }
+} while ( !$good );
+
+switch ( $response ) {
+ case 1:
+ initialiseMessages( false );
+ break;
+ case 2:
+ initialiseMessages( true );
+ break;
+}
exit();