Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | | -define( "REPORTING_INTERVAL", 50 ); |
4 | | -define( "PAUSE_INTERVAL", 50 ); |
5 | 3 | |
6 | 4 | require_once( "commandLine.inc" ); |
| 5 | +require_once( "refreshLinks.inc" ); |
| 6 | + |
7 | 7 | error_reporting( E_ALL & (~E_NOTICE) ); |
8 | 8 | |
9 | 9 | |
— | — | @@ -12,43 +12,8 @@ |
13 | 13 | $start = 1; |
14 | 14 | } |
15 | 15 | |
16 | | -$res = wfQuery("SELECT max(cur_id) as m FROM cur", DB_READ); |
17 | | -$row = wfFetchObject( $res ); |
18 | | -$end = $row->m; |
| 16 | +refreshLinks( $start ); |
19 | 17 | |
20 | | -print("Refreshing link table. Starting from cur_id $start of $end.\n"); |
21 | | - |
22 | | -# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) |
23 | | -$wgUser->setOption("math", 3); |
24 | | - |
25 | | -for ($id = $start; $id <= $end; $id++) { |
26 | | - if ( !($id % REPORTING_INTERVAL) ) { |
27 | | - print "$id\n"; |
28 | | - } |
29 | | - |
30 | | - if ( !($id % PAUSE_INTERVAL) ) { |
31 | | - sleep(1); |
32 | | - } |
33 | | - |
34 | | - $wgTitle = Title::newFromID( $id ); |
35 | | - if ( is_null( $wgTitle ) ) { |
36 | | - continue; |
37 | | - } |
38 | | - |
39 | | - $wgArticle = new Article( $wgTitle ); |
40 | | - $text = $wgArticle->getContent( true ); |
41 | | - $wgLinkCache = new LinkCache; |
42 | | - @$wgOut->addWikiText( $text ); |
43 | | - |
44 | | - if ( $wgEnablePersistentLC ) { |
45 | | - $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) ); |
46 | | - } |
47 | | - |
48 | | - $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() ); |
49 | | - $linksUpdate->doDumbUpdate(); |
50 | | - $linksUpdate->fixBrokenLinks(); |
51 | | -} |
52 | | - |
53 | 18 | exit(); |
54 | 19 | |
55 | 20 | ?> |
Index: trunk/phase3/maintenance/attribute.php |
— | — | @@ -1,32 +1,21 @@ |
2 | 2 | <?php |
| 3 | +# Script for re-attributing edits |
| 4 | +require_once( "commandLine.inc" ); |
3 | 5 | |
4 | 6 | # Parameters |
5 | | - |
6 | | -if ($argc < 4) { |
| 7 | +if ( count( $args ) < 2 ) { |
7 | 8 | print "Not enough parameters\n"; |
8 | | - print "Usage: php attribute.php <lang> <source> <destination>\n"; |
| 9 | + if ( $wgWikiFarm ) { |
| 10 | + print "Usage: php attribute.php <language> <site> <source> <destination>\n"; |
| 11 | + } else { |
| 12 | + print "Usage: php attribute.php <source> <destination>\n"; |
| 13 | + } |
9 | 14 | exit; |
10 | 15 | } |
11 | 16 | |
12 | | -$lang = $argv[1]; |
13 | | -$source = $argv[2]; |
14 | | -$dest = $argv[3]; |
| 17 | +$source = $args[0]; |
| 18 | +$dest = $args[1]; |
15 | 19 | |
16 | | -# Initialisation |
17 | | - |
18 | | -$wgCommandLineMode = true; |
19 | | -$DP = "../includes"; |
20 | | - |
21 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
22 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
23 | | - |
24 | | -require_once( "/apache/htdocs/$lang/w/LocalSettings.php" ); |
25 | | -require_once( "Setup.php" ); |
26 | | - |
27 | | -$wgTitle = Title::newFromText( "Changing attribution script" ); |
28 | | -set_time_limit(0); |
29 | | -$wgCommandLineMode = true; |
30 | | - |
31 | 20 | $eSource = wfStrencode( $source ); |
32 | 21 | $eDest = wfStrencode( $dest ); |
33 | 22 | |
Index: trunk/phase3/maintenance/commandLine.inc |
— | — | @@ -1,47 +1,118 @@ |
2 | 2 | <?php |
3 | | -if ( strpos( `hostname -a`, "wikimedia.org" ) !== false ) { |
4 | | - require_once( "liveCmdLine.inc" ); |
5 | | -} else { |
6 | | - # Turn off output buffering if it's on |
7 | | - @ob_end_flush(); |
8 | | - |
9 | | - if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) { |
10 | | - print "This script must be run from the command line\n"; |
11 | | - exit(); |
| 3 | + |
| 4 | +# Abort if called from a web server |
| 5 | +if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) { |
| 6 | + print "This script must be run from the command line\n"; |
| 7 | + exit(); |
| 8 | +} |
| 9 | + |
| 10 | +# Process command line arguments |
| 11 | +# $options becomes an array with keys set to the option names |
| 12 | +# $optionsWithArgs is an array of GNU-style options that take an argument. The arguments are returned |
| 13 | +# in the values of $options. |
| 14 | + |
| 15 | +if ( !isset( $optionsWithArgs ) ) { |
| 16 | + $optionsWithArgs = array(); |
| 17 | +} |
| 18 | + |
| 19 | +$self = array_shift( $argv ); |
| 20 | +$IP = realpath( dirname( $self ) . "/.." ); |
| 21 | +chdir( $IP ); |
| 22 | + |
| 23 | +$options = array(); |
| 24 | +$args = array(); |
| 25 | + |
| 26 | +for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) { |
| 27 | + if ( substr( $arg, 0, 2 ) == '--' ) { |
| 28 | + # Long options |
| 29 | + $option = substr( $arg, 2 ); |
| 30 | + if ( in_array( $option, $optionsWithArgs ) ) { |
| 31 | + $param = next( $argv ); |
| 32 | + if ( $param === false ) { |
| 33 | + die( "$arg needs an value after it\n" ); |
| 34 | + } |
| 35 | + $options[$option] = $param; |
| 36 | + } else { |
| 37 | + $options[$option] = 1; |
| 38 | + } |
| 39 | + } elseif ( $arg{0} == '-' ) { |
| 40 | + # Short options |
| 41 | + for ( $p=1; $p<strlen( $arg ); $p++ ) { |
| 42 | + $option = $arg{$p}; |
| 43 | + if ( in_array( $option, $optionsWithArgs ) ) { |
| 44 | + $param = next( $argv ); |
| 45 | + if ( $param === false ) { |
| 46 | + die( "$arg needs an value after it\n" ); |
| 47 | + } |
| 48 | + $options[$option] = $param; |
| 49 | + } else { |
| 50 | + $options[$option] = 1; |
| 51 | + } |
| 52 | + } |
| 53 | + } else { |
| 54 | + $args[] = $arg; |
12 | 55 | } |
| 56 | +} |
13 | 57 | |
14 | | - $wgCommandLineMode = true; |
| 58 | +# General initialisation |
15 | 59 | |
16 | | - $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
17 | | - if ( @$argv[1] && @$argv[1] != "-" ) { |
18 | | - $self = array_shift( $argv ); |
19 | | - $lang = array_shift( $argv ); |
20 | | - putenv( "wikilang=$lang"); |
21 | | - $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php"; |
22 | | - $newpath = "/apache/common/php$sep"; |
| 60 | +$wgCommandLineMode = true; |
| 61 | +# Turn off output buffering if it's on |
| 62 | +@ob_end_flush(); |
| 63 | +$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
| 64 | + |
| 65 | +if ( $sep == ":" && strpos( `hostname -a`, "wikimedia.org" ) !== false ) { |
| 66 | + $wgWikiFarm = true; |
| 67 | + if ( isset( $args[0] ) ) { |
| 68 | + $lang = array_shift( $args ); |
23 | 69 | } else { |
24 | | - $settingsFile = "../LocalSettings.php"; |
25 | | - $newpath = ""; |
| 70 | + $lang = "aa"; |
26 | 71 | } |
| 72 | + if ( isset( $args[0] ) ) { |
| 73 | + $site = array_shift( $args ); |
| 74 | + } else { |
| 75 | + $site = "wikipedia"; |
| 76 | + } |
27 | 77 | |
| 78 | + # This is for the IRC scripts, which now run as the apache user |
| 79 | + # The apache user doesn't have access to the wikiadmin_pass command |
| 80 | + if ( $_ENV['USER'] != "apache" ) { |
| 81 | + $wgDBadminuser = "wikiadmin"; |
| 82 | + $wgDBadminpassword = trim(`wikiadmin_pass`); |
| 83 | + } |
| 84 | + |
| 85 | + putenv( "wikilang=$lang"); |
| 86 | + |
| 87 | + $DP = $IP; |
| 88 | + ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" ); |
| 89 | + |
| 90 | + require_once( "/home/wikipedia/common/php-new/CommonSettings.php" ); |
| 91 | +} else { |
| 92 | + $wgWikiFarm = false; |
| 93 | + $settingsFile = "$IP/LocalSettings.php"; |
| 94 | + |
28 | 95 | if ( ! is_readable( $settingsFile ) ) { |
29 | 96 | print "A copy of your installation's LocalSettings.php\n" . |
30 | 97 | "must exist in the source directory.\n"; |
31 | 98 | exit(); |
32 | 99 | } |
33 | | - |
34 | | - |
35 | 100 | $wgCommandLineMode = true; |
36 | | - $DP = "../includes"; |
| 101 | + $DP = $IP; |
37 | 102 | include_once( $settingsFile ); |
38 | | - ini_set( "include_path", "../includes$sep../languages$sep$newpath$IP$sep$include_path" ); |
| 103 | + ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" ); |
| 104 | + include_once( "$IP/AdminSettings.php" ); |
| 105 | +} |
39 | 106 | |
40 | | - $wgUsePHPTal = false; |
41 | | - define("MEDIAWIKI",true); |
42 | | - include_once( "Setup.php" ); |
43 | | - include_once( "../install-utils.inc" ); |
44 | | - $wgTitle = Title::newFromText( "Command line script" ); |
45 | | - $wgCommandLineMode = true; |
46 | | - set_time_limit(0); |
47 | | -} |
| 107 | +# Turn off output buffering again, it might have been turned on in the settings files |
| 108 | +@ob_end_flush(); |
| 109 | +# Same with this one |
| 110 | +$wgCommandLineMode = true; |
| 111 | + |
| 112 | +$wgUsePHPTal = false; |
| 113 | +define("MEDIAWIKI",true); |
| 114 | +require_once( "Setup.php" ); |
| 115 | +require_once( "install-utils.inc" ); |
| 116 | +$wgTitle = Title::newFromText( "Command line script" ); |
| 117 | +set_time_limit(0); |
| 118 | + |
48 | 119 | ?> |
Index: trunk/phase3/maintenance/DiffLanguage.php |
— | — | @@ -40,8 +40,8 @@ |
41 | 41 | $wgLanguageCode = strtoupper(substr($wgLanguageCode,0,1)).strtolower(substr($wgLanguageCode,1)); |
42 | 42 | |
43 | 43 | # read command line argument |
44 | | -if ( isset($argv[1]) ) { |
45 | | - $lang = $argv[1]; |
| 44 | +if ( isset($args[0]) ) { |
| 45 | + $lang = $args[0]; |
46 | 46 | |
47 | 47 | # or prompt a simple menu |
48 | 48 | } else { |
Index: trunk/phase3/maintenance/compressOld.inc |
— | — | @@ -1,7 +1,5 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -include_once( "Article.php" ); |
5 | | - |
6 | 4 | function compressOldPages( $start = 0 ) { |
7 | 5 | $chunksize = 50; |
8 | 6 | print "Starting from old_id $start...\n"; |
Index: trunk/phase3/maintenance/rebuildMessages.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | require_once( "commandLine.inc" ); |
4 | | -include_once( "./InitialiseMessages.inc" ); |
| 4 | +include_once( "InitialiseMessages.inc" ); |
5 | 5 | |
6 | 6 | $wgTitle = Title::newFromText( "Rebuild messages script" ); |
7 | 7 | |
8 | | -if ( isset( $argv[0] ) ) { |
9 | | - $response = array_shift( $argv ); |
| 8 | +if ( isset( $args[0] ) ) { |
| 9 | + $response = array_shift( $args ); |
10 | 10 | if ( $response == "update" ) { |
11 | 11 | $response = 1; |
12 | 12 | } elseif ( $response == "rebuild" ) { |
— | — | @@ -14,8 +14,8 @@ |
15 | 15 | } else { |
16 | 16 | $response = 0; |
17 | 17 | } |
18 | | -if ( isset( $argv[0] ) ) { |
19 | | - $messages = loadLanguageFile( array_shift( $argv ) ); |
| 18 | +if ( isset( $args[0] ) ) { |
| 19 | + $messages = loadLanguageFile( array_shift( $args ) ); |
20 | 20 | } else { |
21 | 21 | $messages = false; |
22 | 22 | } |
Index: trunk/phase3/maintenance/rebuildtextindex.php |
— | — | @@ -1,26 +1,10 @@ |
2 | 2 | <?php |
3 | | -define("MEDIAWIKI",true); |
4 | 3 | # Rebuild search index table from scratch. This takes several |
5 | 4 | # hours, depending on the database size and server configuration. |
6 | 5 | |
7 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
8 | | - print "A copy of your installation's LocalSettings.php\n" . |
9 | | - "must exist in the source directory.\n"; |
10 | | - exit(); |
11 | | -} |
12 | | - |
13 | | -$wgCommandLineMode = true; |
14 | | -$DP = "../includes"; |
15 | | -require_once( "../LocalSettings.php" ); |
16 | | -require_once( "../AdminSettings.php" ); |
17 | | - |
18 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
19 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
20 | | - |
21 | | -require_once( "Setup.php" ); |
| 6 | +require_once( "commandLine.inc" ); |
22 | 7 | require_once( "./rebuildtextindex.inc" ); |
23 | 8 | $wgTitle = Title::newFromText( "Rebuild text index script" ); |
24 | | -set_time_limit(0); |
25 | 9 | |
26 | 10 | $wgDBuser = $wgDBadminuser; |
27 | 11 | $wgDBpassword = $wgDBadminpassword; |
Index: trunk/phase3/maintenance/rebuildlinks.php |
— | — | @@ -3,26 +3,10 @@ |
4 | 4 | # Rebuild link tracking tables from scratch. This takes several |
5 | 5 | # hours, depending on the database size and server configuration. |
6 | 6 | |
7 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
8 | | - print "A copy of your installation's LocalSettings.php\n" . |
9 | | - "must exist in the source directory.\n"; |
10 | | - exit(); |
11 | | -} |
12 | | - |
13 | | -$wgCommandLineMode = true; |
14 | | -ini_set("implicit_flush", 1); |
15 | | - |
16 | | -$DP = "../includes"; |
17 | | -require_once( "../LocalSettings.php" ); |
18 | | -require_once( "../AdminSettings.php" ); |
19 | | - |
20 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
21 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
22 | | - |
23 | | -require_once( "Setup.php" ); |
| 7 | +require_once( "commandLine.inc" ); |
24 | 8 | require_once( "./rebuildlinks.inc" ); |
| 9 | + |
25 | 10 | $wgTitle = Title::newFromText( "Rebuild links script" ); |
26 | | -set_time_limit(0); |
27 | 11 | |
28 | 12 | $wgDBuser = $wgDBadminuser; |
29 | 13 | $wgDBpassword = $wgDBadminpassword; |
Index: trunk/phase3/maintenance/compressOld.php |
— | — | @@ -1,30 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -# Rebuild search index table from scratch. This takes several |
5 | | -# hours, depending on the database size and server configuration. |
| 4 | +# Compress the old table, old_flags=gzip |
6 | 5 | |
7 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
8 | | - print "A copy of your installation's LocalSettings.php\n" . |
9 | | - "must exist in the source directory.\n"; |
10 | | - exit(); |
11 | | -} |
| 6 | +require_once( "commandLine.inc" ); |
| 7 | +require_once( "compressOld.inc" ); |
12 | 8 | |
13 | | -$wgCommandLineMode = true; |
14 | | -$DP = "../includes"; |
15 | | -require_once( "../LocalSettings.php" ); |
16 | | -require_once( "../AdminSettings.php" ); |
17 | | - |
18 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
19 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
20 | | - |
21 | | -require_once( "Setup.php" ); |
22 | | -require_once( "./compressOld.inc" ); |
23 | | -$wgTitle = Title::newFromText( "Compress old pages script" ); |
24 | | -set_time_limit(0); |
25 | | - |
26 | | -$wgDBuser = $wgDBadminuser; |
27 | | -$wgDBpassword = $wgDBadminpassword; |
28 | | - |
29 | 9 | if( !function_exists( "gzdeflate" ) ) { |
30 | 10 | print "You must enable zlib support in PHP to compress old revisions!\n"; |
31 | 11 | print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n"; |
Index: trunk/phase3/maintenance/update2.php |
— | — | @@ -1,4 +1,7 @@ |
2 | 2 | <?php |
| 3 | + |
| 4 | +# This script was used to convert the live Wikimedia wikis from 1.2 to 1.3 |
| 5 | + |
3 | 6 | $maintenance = "/home/wikipedia/common/php-new/maintenance"; |
4 | 7 | require_once( "$maintenance/liveCmdLine.inc" ); |
5 | 8 | require_once( "$maintenance/InitialiseMessages.inc" ); |
Index: trunk/phase3/maintenance/trivialCmdLine.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -require_once( "liveCmdLine.inc" ); |
| 3 | +require_once( "commandLine.inc" ); |
4 | 4 | print "DB name: $wgDBname\n"; |
5 | 5 | print "DB user: $wgDBuser\n"; |
6 | 6 | print "DB password: $wgDBpassword\n"; |
Index: trunk/phase3/maintenance/remove-brokenlinks.php |
— | — | @@ -1,25 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | # Remove spurious brokenlinks |
5 | | - |
6 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
7 | | - print "A copy of your installation's LocalSettings.php\n" . |
8 | | - "must exist in the source directory.\n"; |
9 | | - exit(); |
10 | | -} |
11 | | - |
12 | | -$wgCommandLineMode = true; |
13 | | -$DP = "../includes"; |
14 | | -require_once( "../LocalSettings.php" ); |
15 | | -require_once( "../AdminSettings.php" ); |
16 | | - |
17 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
18 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
19 | | - |
20 | | -require_once( "Setup.php" ); |
| 5 | +require_once( "commandLine.inc" ); |
21 | 6 | require_once( "./rebuildrecentchanges.inc" ); |
22 | 7 | $wgTitle = Title::newFromText( "Rebuild brokenlinks script" ); |
23 | | -set_time_limit(0); |
24 | 8 | |
25 | 9 | $wgDBuser = $wgDBadminuser; |
26 | 10 | $wgDBpassword = $wgDBadminpassword; |
Index: trunk/phase3/maintenance/rebuildall.php |
— | — | @@ -3,32 +3,22 @@ |
4 | 4 | # Rebuild link tracking tables from scratch. This takes several |
5 | 5 | # hours, depending on the database size and server configuration. |
6 | 6 | |
7 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
8 | | - print "A copy of your installation's LocalSettings.php\n" . |
9 | | - "must exist in the source directory.\n"; |
10 | | - exit(); |
11 | | -} |
| 7 | +require_once( "commandLine.inc" ); |
12 | 8 | |
13 | | -$wgCommandLineMode = true; |
14 | | -$DP = "../includes"; |
15 | | -require_once( "../LocalSettings.php" ); |
16 | | -require_once( "../AdminSettings.php" ); |
| 9 | +#require_once( "rebuildlinks.inc" ); |
| 10 | +require_once( "refreshlinks.inc" ); |
| 11 | +require_once( "rebuildtextindex.inc" ); |
| 12 | +require_once( "rebuildrecentchanges.inc" ); |
17 | 13 | |
18 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
19 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
20 | | - |
21 | | -require_once( "Setup.php" ); |
22 | | -require_once( "./rebuildlinks.inc" ); |
23 | | -require_once( "./rebuildtextindex.inc" ); |
24 | | -require_once( "./rebuildrecentchanges.inc" ); |
25 | | -$wgTitle = Title::newFromText( "Rebuild links script" ); |
26 | | -set_time_limit(0); |
27 | | - |
28 | 14 | $wgDBuser = $wgDBadminuser; |
29 | 15 | $wgDBpassword = $wgDBadminpassword; |
30 | 16 | |
31 | | -rebuildLinkTables(); |
| 17 | +# Doesn't work anymore |
| 18 | +# rebuildLinkTables(); |
32 | 19 | |
| 20 | +# Use the slow incomplete one instead. It's designed to work in the background |
| 21 | +#refreshLinks( 1 ); |
| 22 | + |
33 | 23 | dropTextIndex(); |
34 | 24 | rebuildTextIndex(); |
35 | 25 | createTextIndex(); |
Index: trunk/phase3/maintenance/rebuildrecentchanges.php |
— | — | @@ -3,24 +3,9 @@ |
4 | 4 | # Rebuild link tracking tables from scratch. This takes several |
5 | 5 | # hours, depending on the database size and server configuration. |
6 | 6 | |
7 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
8 | | - print "A copy of your installation's LocalSettings.php\n" . |
9 | | - "must exist in the source directory.\n"; |
10 | | - exit(); |
11 | | -} |
12 | | - |
13 | | -$wgCommandLineMode = true; |
14 | | -$DP = "../includes"; |
15 | | -require_once( "../LocalSettings.php" ); |
16 | | -require_once( "../AdminSettings.php" ); |
17 | | - |
18 | | -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; |
19 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
20 | | - |
21 | | -require_once( "Setup.php" ); |
| 7 | +require_once( "commandLine.inc" ); |
22 | 8 | require_once( "./rebuildrecentchanges.inc" ); |
23 | 9 | $wgTitle = Title::newFromText( "Rebuild recent changes script" ); |
24 | | -set_time_limit(0); |
25 | 10 | |
26 | 11 | $wgDBuser = $wgDBadminuser; |
27 | 12 | $wgDBpassword = $wgDBadminpassword; |
Index: trunk/phase3/maintenance/convertLinks.php |
— | — | @@ -3,8 +3,6 @@ |
4 | 4 | # The wiki should be put into read-only mode while this script executes |
5 | 5 | |
6 | 6 | require_once( "commandLine.inc" ); |
7 | | -# the below should probably be moved into commandLine.inc at some point |
8 | | -require_once( "../AdminSettings.php" ); |
9 | 7 | require_once( "convertLinks.inc" ); |
10 | 8 | |
11 | 9 | convertLinks(); |
Index: trunk/phase3/maintenance/refreshLinks.inc |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +define( "REPORTING_INTERVAL", 50 ); |
| 5 | +define( "PAUSE_INTERVAL", 50 ); |
| 6 | + |
| 7 | +function refreshLinks( $start ) { |
| 8 | + global $wgUser, $wgTitle, $wgArticle, $wgEnablePersistentLC, $wgLinkCache, $wgOut; |
| 9 | + |
| 10 | + $res = wfQuery("SELECT max(cur_id) as m FROM cur", DB_READ); |
| 11 | + $row = wfFetchObject( $res ); |
| 12 | + $end = $row->m; |
| 13 | + |
| 14 | + print("Refreshing link table. Starting from cur_id $start of $end.\n"); |
| 15 | + |
| 16 | + # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) |
| 17 | + $wgUser->setOption("math", 3); |
| 18 | + |
| 19 | + for ($id = $start; $id <= $end; $id++) { |
| 20 | + if ( !($id % REPORTING_INTERVAL) ) { |
| 21 | + print "$id\n"; |
| 22 | + } |
| 23 | + |
| 24 | + if ( !($id % PAUSE_INTERVAL) ) { |
| 25 | + sleep(1); |
| 26 | + } |
| 27 | + |
| 28 | + $wgTitle = Title::newFromID( $id ); |
| 29 | + if ( is_null( $wgTitle ) ) { |
| 30 | + continue; |
| 31 | + } |
| 32 | + |
| 33 | + $wgArticle = new Article( $wgTitle ); |
| 34 | + $text = $wgArticle->getContent( true ); |
| 35 | + $wgLinkCache = new LinkCache; |
| 36 | + $wgOut->addWikiText( $text ); |
| 37 | + |
| 38 | + if ( $wgEnablePersistentLC ) { |
| 39 | + $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) ); |
| 40 | + } |
| 41 | + |
| 42 | + $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() ); |
| 43 | + $linksUpdate->doDumbUpdate(); |
| 44 | + $linksUpdate->fixBrokenLinks(); |
| 45 | + } |
| 46 | +} |
| 47 | +?> |
Property changes on: trunk/phase3/maintenance/refreshLinks.inc |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 48 | + native |
Added: svn:keywords |
2 | 49 | + Author Date Id Revision |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -243,3 +243,10 @@ |
244 | 244 | unique key (keyname), |
245 | 245 | key (exptime) |
246 | 246 | ); |
| 247 | + |
| 248 | +-- For storing revision text |
| 249 | +CREATE TABLE blobs ( |
| 250 | + blob_index char(255) binary NOT NULL default '', |
| 251 | + blob_data longblob NOT NULL default '', |
| 252 | + UNIQUE key blob_index (blob_index), |
| 253 | +); |