exit();
}
+$wgCommandLineMode = true;
$DP = "../includes";
include_once( "../LocalSettings.php" );
include_once( "{$IP}/Setup.php" );
$wgTitle = Title::newFromText( "Translation checking script" );
-$wgCommandLineMode = true;
$count = $total = 0;
$msgarray = "wgAllMessages" . ucfirst( $wgLanguageCode );
# Creating a new empty database; either this or the conversion
# script from the old format needs to be run, but not both.
-global $IP;
+$wgCommandLineMode = true;
include_once( "../LocalSettings.php" );
-include_once( "$IP/Setup.php" );
+
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
+
+include_once( "Setup.php" );
$wgTitle = Title::newFromText( "Database creation script" );
include_once( "./buildTables.inc" );
exit();
}
+$wgCommandLineMode = true;
$DP = "../includes";
include_once( "../LocalSettings.php" );
include_once( "../AdminSettings.php" );
-include_once( "{$IP}/Setup.php" );
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
+
+include_once( "Setup.php" );
include_once( "./rebuildlinks.inc" );
include_once( "./rebuildtextindex.inc" );
include_once( "./rebuildrecentchanges.inc" );
# See rebuildlinks.php, for example.
#
+# Turn this on if you've got memory to burn
+$wgUseMemoryTables = false;
+
function rebuildLinkTablesPass1()
{
- global $wgLang;
+ global $wgLang, $wgUseMemoryTables;
$count = 0;
print "Rebuilding link tables (pass 1).\n";
rl_f_id int(8) unsigned NOT NULL default 0,
rl_f_title varchar(255) binary NOT NULL default '',
rl_to varchar(255) binary NOT NULL default '',
- INDEX rl_to (rl_to) ) TYPE=MyISAM";
+ INDEX rl_to (rl_to) )";
+ if( $wgUseMemoryTables ) $sql .= " TYPE=heap";
wfQuery( $sql, DB_WRITE );
- $sql = "LOCK TABLES cur READ, rebuildlinks WRITE, interwiki READ";
+ $sql = "LOCK TABLES cur READ, rebuildlinks WRITE, interwiki READ, user_newtalk READ";
wfQuery( $sql, DB_WRITE );
$sql = "DELETE FROM rebuildlinks";
$first = true;
$sql = "INSERT INTO rebuildlinks (rl_f_id,rl_f_title,rl_to) VALUES ";
for ( $i = 0; $i < $numlinks; ++$i ) {
+ if( preg_match( '/^(http|https|ftp|mailto|news):/', $m[1][$i] ) ) {
+ # an URL link; not for us!
+ continue;
+ }
+ # FIXME: Handle subpage links
$nt = Title::newFromText( $m[1][$i] );
if (! $nt)
{
print "error in '$ns:{$row->cur_title}' :\t'$txt'\n";
continue;
}
+ if( $nt->getInterwiki() != "" ) {
+ # Interwiki links are not stored in the link tables
+ continue;
+ }
+ if( $nt->getNamespace() == Namespace::getSpecial() ) {
+ # Special links not stored in link tables
+ continue;
+ }
+ if( $nt->getNamespace() == Namespace::getMedia() ) {
+ # treat media: links as image: links
+ $nt = Title::makeTitle( Namespace::getImage(), $nt->getDBkey() );
+ }
if (!$first)
$sql .= ",";
$to = addslashes( $row->rl_to );
if ( 0 == $id ) {
- $sql = "SELECT rl_f_id FROM rebuildlinks WHERE rl_to='{$to}'";
+ $sql = "SELECT DISTINCT rl_f_id FROM rebuildlinks WHERE rl_to='{$to}'";
$res2 = wfQuery( $sql, DB_WRITE );
$sql = "INSERT INTO brokenlinks (bl_from,bl_to) VALUES ";
wfFreeResult( $res2 );
if ( ! $first ) { wfQuery( $sql, DB_WRITE ); }
} else {
- $sql = "SELECT rl_f_title FROM rebuildlinks WHERE rl_to='{$to}'";
+ $sql = "SELECT DISTINCT rl_f_title FROM rebuildlinks WHERE rl_to='{$to}'";
$res2 = wfQuery( $sql, DB_WRITE );
$sql = "INSERT INTO links (l_from,l_to) VALUES ";
exit();
}
+$wgCommandLineMode = true;
$DP = "../includes";
include_once( "../LocalSettings.php" );
include_once( "../AdminSettings.php" );
-include_once( "{$IP}/Setup.php" );
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
+
+include_once( "Setup.php" );
include_once( "./rebuildlinks.inc" );
$wgTitle = Title::newFromText( "Rebuild links script" );
set_time_limit(0);
function rebuildRecentChangesTablePass1()
{
$sql = "DROP TABLE IF EXISTS recentchanges";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
$sql = "CREATE TABLE recentchanges (
rc_timestamp varchar(14) binary NOT NULL default '',
INDEX rc_namespace (rc_namespace),
INDEX rc_title (rc_title)
) TYPE=MyISAM PACK_KEYS=1;";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
print( "Loading from CUR table...\n" );
"cur_timestamp,cur_user,cur_user_text,cur_namespace,cur_title," .
"cur_comment,cur_minor_edit,0,cur_is_new,cur_id,0,0 FROM cur " .
"ORDER BY cur_timestamp DESC LIMIT 5000";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
print( "Loading from OLD table...\n" );
"old_user,old_user_text,old_namespace,old_title,old_comment," .
"old_minor_edit,0,0,0,old_id,0 FROM old ORDER BY old_timestamp " .
"DESC LIMIT 5000";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
$sql = "SELECT rc_timestamp FROM recentchanges " .
"ORDER BY rc_timestamp DESC LIMIT 5000,1";
- $res = wfQuery( $sql );
+ $res = wfQuery( $sql, DB_WRITE );
$obj = wfFetchObject( $res );
$ts = $obj->rc_timestamp;
$sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$ts}'";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
}
function rebuildRecentChangesTablePass2()
$sql = "SELECT rc_namespace,rc_title,rc_timestamp FROM recentchanges " .
"ORDER BY rc_namespace,rc_title,rc_timestamp DESC";
- $res = wfQuery( $sql );
+ $res = wfQuery( $sql, DB_WRITE );
while ( $obj = wfFetchObject( $res ) ) {
if ( ! ( $ns == $obj->rc_namespace &&
$sql = "SELECT cur_id,cur_timestamp FROM cur WHERE " .
"cur_namespace={$ns} AND cur_title='{$title}'";
- $res2 = wfQuery( $sql );
+ $res2 = wfQuery( $sql, DB_WRITE );
$obj2 = wfFetchObject( $res2 );
$id = $obj2->cur_id;
$sql = "SELECT old_id FROM old WHERE old_namespace={$ns} " .
"AND old_title='{$title}' AND old_timestamp < '" .
"{$obj->rc_timestamp}' ORDER BY old_timestamp DESC LIMIT 1";
- $res2 = wfQuery( $sql );
+ $res2 = wfQuery( $sql, DB_WRITE );
if ( 0 != wfNumRows( $res2 ) ) {
$obj2 = wfFetchObject( $res2 );
"'{$ct}',rc_last_oldid={$obj2->old_id} WHERE " .
"rc_namespace={$ns} AND rc_title='{$title}' AND " .
"rc_timestamp='{$obj->rc_timestamp}'";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
} else {
$sql = "UPDATE recentchanges SET rc_cur_id={$id},rc_cur_time=" .
"'{$ct}' WHERE rc_namespace={$ns} AND rc_title='{$title}' " .
"AND rc_timestamp='{$obj->rc_timestamp}'";
- wfQuery( $sql );
+ wfQuery( $sql, DB_WRITE );
}
if ( 0 == ( ++$count % 500 ) ) {
exit();
}
+$wgCommandLineMode = true;
$DP = "../includes";
include_once( "../LocalSettings.php" );
include_once( "../AdminSettings.php" );
-include_once( "{$IP}/Setup.php" );
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
+
+include_once( "Setup.php" );
include_once( "./rebuildrecentchanges.inc" );
$wgTitle = Title::newFromText( "Rebuild recent changes script" );
set_time_limit(0);
<?
-# Rebuild link tracking tables from scratch. This takes several
+# Rebuild search index table from scratch. This takes several
# hours, depending on the database size and server configuration.
if ( ! is_readable( "../LocalSettings.php" ) ) {
exit();
}
+$wgCommandLineMode = true;
$DP = "../includes";
include_once( "../LocalSettings.php" );
include_once( "../AdminSettings.php" );
-include_once( "{$IP}/Setup.php" );
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
+
+include_once( "Setup.php" );
include_once( "./rebuildtextindex.inc" );
$wgTitle = Title::newFromText( "Rebuild text index script" );
set_time_limit(0);
ini_set( "allow_url_fopen", 0 ); # For security...
include_once( "./LocalSettings.php" );
-$include_path = ini_get( "include_path" );
# Windows requires ';' as separator, ':' for Unix
-if( strchr( $include_path, ";" ) ) $sep = ";"; else $sep = ":";
-ini_set( "include_path", $IP . $sep . ini_get( "include_path" ) );
+$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
+ini_set( "include_path", "$IP$sep$include_path" );
include_once( "Setup.php" );