Index: trunk/phase3/maintenance/dumpReplayLog.php |
— | — | @@ -1,116 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * @addtogroup Maintenance |
5 | | - */ |
6 | | -error_reporting(E_ALL); |
7 | | - |
8 | | -/** */ |
9 | | -require_once( "commandLine.inc" ); |
10 | | - |
11 | | -/** */ |
12 | | -function dumpReplayLog( $start ) { |
13 | | - $dbw = wfGetDB( DB_MASTER ); |
14 | | - $recentchanges = $dbw->tableName( 'recentchanges' ); |
15 | | - $result =& $dbw->safeQuery( "SELECT * FROM $recentchanges WHERE rc_timestamp >= " |
16 | | - . $dbw->timestamp( $start ) . ' ORDER BY rc_timestamp'); |
17 | | - |
18 | | - global $wgInputEncoding; |
19 | | - echo '<' . '?xml version="1.0" encoding="' . $wgInputEncoding . '" ?' . ">\n"; |
20 | | - echo "<wikilog version='experimental'>\n"; |
21 | | - echo "<!-- Do not use this script for any purpose. It's scary. -->\n"; |
22 | | - while( $row = $dbw->fetchObject( $result ) ) { |
23 | | - echo dumpReplayEntry( $row ); |
24 | | - } |
25 | | - echo "</wikilog>\n"; |
26 | | - $dbw->freeResult( $result ); |
27 | | -} |
28 | | - |
29 | | -/** */ |
30 | | -function dumpReplayEntry( $row ) { |
31 | | - $title = Title::MakeTitle( $row->rc_namespace, $row->rc_title ); |
32 | | - switch( $row->rc_type ) { |
33 | | - case RC_EDIT: |
34 | | - case RC_NEW: |
35 | | - # Edit |
36 | | - $dbr = wfGetDB( DB_MASTER ); |
37 | | - |
38 | | - $out = " <edit>\n"; |
39 | | - $out .= " <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n"; |
40 | | - |
41 | | - # Get previous edit timestamp |
42 | | - if( $row->rc_last_oldid ) { |
43 | | - $s = $dbr->selectRow( 'old', |
44 | | - array( 'old_timestamp' ), |
45 | | - array( 'old_id' => $row->rc_last_oldid ) ); |
46 | | - $out .= " <lastedit>" . wfTimestamp2ISO8601( $s->old_timestamp ) . "</lastedit>\n"; |
47 | | - } else { |
48 | | - $out .= " <newpage/>\n"; |
49 | | - } |
50 | | - |
51 | | - if( $row->rc_this_oldid ) { |
52 | | - $s = $dbr->selectRow( 'old', array( 'old_id as id','old_timestamp as timestamp', |
53 | | - 'old_user as user', 'old_user_text as user_text', 'old_comment as comment', |
54 | | - 'old_text as text', 'old_flags as flags' ), |
55 | | - array( 'old_id' => $row->rc_this_oldid ) ); |
56 | | - $out .= revision2xml( $s, true, false ); |
57 | | - } else { |
58 | | - $s = $dbr->selectRow( 'cur', array( 'cur_id as id','cur_timestamp as timestamp','cur_user as user', |
59 | | - 'cur_user_text as user_text', 'cur_restrictions as restrictions','cur_comment as comment', |
60 | | - 'cur_text as text' ), |
61 | | - array( 'cur_id' => $row->rc_cur_id ) ); |
62 | | - $out .= revision2xml( $s, true, true ); |
63 | | - } |
64 | | - $out .= " </edit>\n"; |
65 | | - break; |
66 | | - case RC_LOG: |
67 | | - $dbr = wfGetDB( DB_MASTER ); |
68 | | - $s = $dbr->selectRow( 'logging', |
69 | | - array( 'log_type', 'log_action', 'log_timestamp', 'log_user', |
70 | | - 'log_namespace', 'log_title', 'log_comment' ), |
71 | | - array( 'log_timestamp' => $row->rc_timestamp, |
72 | | - 'log_user' => $row->rc_user ) ); |
73 | | - $ts = wfTimestamp2ISO8601( $row->rc_timestamp ); |
74 | | - $target = Title::MakeTitle( $s->log_namespace, $s->log_title ); |
75 | | - $out = " <log>\n"; |
76 | | - $out .= " <type>" . xmlsafe( $s->log_type ) . "</type>\n"; |
77 | | - $out .= " <action>" . xmlsafe( $s->log_action ) . "</action>\n"; |
78 | | - $out .= " <timestamp>" . $ts . "</timestamp>\n"; |
79 | | - $out .= " <contributor><username>" . xmlsafe( $row->rc_user_text ) . "</username></contributor>\n"; |
80 | | - $out .= " <target>" . xmlsafe( $target->getPrefixedText() ) . "</target>\n"; |
81 | | - $out .= " <comment>" . xmlsafe( $s->log_comment ) . "</comment>\n"; |
82 | | - $out .= " </log>\n"; |
83 | | - break; |
84 | | - case RC_MOVE: |
85 | | - case RC_MOVE_OVER_REDIRECT: |
86 | | - $target = Title::MakeTitle( $row->rc_moved_to_ns, $row->rc_moved_to_title ); |
87 | | - $out = " <move>\n"; |
88 | | - $out .= " <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n"; |
89 | | - $out .= " <target>" . xmlsafe( $target->getPrefixedText() ) . "</target>\n"; |
90 | | - if( $row->rc_type == RC_MOVE_OVER_REDIRECT ) { |
91 | | - $out .= " <override/>\n"; |
92 | | - } |
93 | | - $ts = wfTimestamp2ISO8601( $row->rc_timestamp ); |
94 | | - $out .= " <id>$row->rc_cur_id</id>\n"; |
95 | | - $out .= " <timestamp>$ts</timestamp>\n"; |
96 | | - if($row->rc_user_text) { |
97 | | - $u = "<username>" . xmlsafe( $row->rc_user_text ) . "</username>"; |
98 | | - $u .= "<id>$row->rc_user</id>"; |
99 | | - } else { |
100 | | - $u = "<ip>" . xmlsafe( $row->rc_user_text ) . "</ip>"; |
101 | | - } |
102 | | - $out .= " <contributor>$u</contributor>\n"; |
103 | | - $out .= " </move>\n"; |
104 | | - } |
105 | | - return $out; |
106 | | -} |
107 | | - |
108 | | - |
109 | | -if( isset( $options['start'] ) ) { |
110 | | - $start = wfTimestamp( TS_MW, $options['start'] ); |
111 | | - dumpReplayLog( $start ); |
112 | | -} else { |
113 | | - echo "This is an experimental script to encapsulate data from recent edits.\n"; |
114 | | - echo "Usage: php dumpReplayLog.php --start=20050118032544\n"; |
115 | | -} |
116 | | - |
117 | | -?> |
\ No newline at end of file |
Index: trunk/phase3/maintenance/cleanupDupes.php |
— | — | @@ -1,36 +0,0 @@ |
2 | | -<?php |
3 | | -# Copyright (C) 2004 Brion Vibber <brion@pobox.com> |
4 | | -# http://www.mediawiki.org/ |
5 | | -# |
6 | | -# This program is free software; you can redistribute it and/or modify |
7 | | -# it under the terms of the GNU General Public License as published by |
8 | | -# the Free Software Foundation; either version 2 of the License, or |
9 | | -# (at your option) any later version. |
10 | | -# |
11 | | -# This program is distributed in the hope that it will be useful, |
12 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | -# GNU General Public License for more details. |
15 | | -# |
16 | | -# You should have received a copy of the GNU General Public License along |
17 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
18 | | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | | -# http://www.gnu.org/copyleft/gpl.html |
20 | | - |
21 | | -/** |
22 | | - * If on the old non-unique indexes, check the cur table for duplicate |
23 | | - * entries and remove them... |
24 | | - * |
25 | | - * @addtogroup Maintenance |
26 | | - */ |
27 | | - |
28 | | -$options = array( 'fix', 'index' ); |
29 | | - |
30 | | -/** */ |
31 | | -require_once( 'commandLine.inc' ); |
32 | | -require_once( 'cleanupDupes.inc' ); |
33 | | -$wgTitle = Title::newFromText( 'Dupe cur entry cleanup script' ); |
34 | | - |
35 | | -checkDupes( isset( $options['fix'] ), isset( $options['index'] ) ); |
36 | | - |
37 | | -?> |
Index: trunk/phase3/maintenance/importPhase2.php |
— | — | @@ -1,368 +0,0 @@ |
2 | | -<?php |
3 | | -# MediaWiki 'phase 2' to current format import script |
4 | | -# (import format current as of 1.2.0, March 2004) |
5 | | -# |
6 | | -# Copyright (C) 2004 Brion Vibber <brion@pobox.com> |
7 | | -# Portions by Lee Daniel Crocker, 2002 |
8 | | -# http://www.mediawiki.org/ |
9 | | -# |
10 | | -# This program is free software; you can redistribute it and/or modify |
11 | | -# it under the terms of the GNU General Public License as published by |
12 | | -# the Free Software Foundation; either version 2 of the License, or |
13 | | -# (at your option) any later version. |
14 | | -# |
15 | | -# This program is distributed in the hope that it will be useful, |
16 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | | -# GNU General Public License for more details. |
19 | | -# |
20 | | -# You should have received a copy of the GNU General Public License along |
21 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
22 | | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 | | -# http://www.gnu.org/copyleft/gpl.html |
24 | | - |
25 | | -/** |
26 | | - * @todo document |
27 | | - * @deprecated |
28 | | - * @addtogroup Maintenance |
29 | | - */ |
30 | | - |
31 | | -/** */ |
32 | | -die( "This import script is not currently maintained. |
33 | | -If you need it you'll have to modify it as necessary.\n"); |
34 | | - |
35 | | -if ( ! is_readable( "../LocalSettings.php" ) ) { |
36 | | - print "A copy of your installation's LocalSettings.php\n" . |
37 | | - "must exist in the source directory.\n"; |
38 | | - exit(); |
39 | | -} |
40 | | - |
41 | | -$wgCommandLineMode = true; |
42 | | -ini_set("implicit_flush", 1); |
43 | | - |
44 | | -$DP = "../includes"; |
45 | | -require_once( "../LocalSettings.php" ); |
46 | | -require_once( "../AdminSettings.php" ); |
47 | | - |
48 | | -$wgDBuser = $wgDBadminuser; |
49 | | -$wgDBpassword = $wgDBadminpassword; |
50 | | - |
51 | | -$sep = ( DIRECTORY_SEPARATOR == "\\" ) ? ";" : ":"; |
52 | | -ini_set( "include_path", "$IP$sep$include_path" ); |
53 | | - |
54 | | -require_once( "Setup.php" ); |
55 | | - |
56 | | -require_once( "../install-utils.inc" ); |
57 | | -require_once( "InitialiseMessages.inc" ); |
58 | | -require_once( "rebuildlinks.inc" ); |
59 | | -require_once( "rebuildrecentchanges.inc" ); |
60 | | -require_once( "rebuildtextindex.inc" ); |
61 | | - |
62 | | -/** |
63 | | - * @todo document |
64 | | - * @addtogroup Maintenance |
65 | | - */ |
66 | | -class Phase2Importer { |
67 | | - var $olddb, $titleCache; |
68 | | - |
69 | | - function Phase2Importer( $database ) { |
70 | | - $this->olddb = $database; |
71 | | - $this->titleCache = new TitleCache; |
72 | | - } |
73 | | - |
74 | | - function importAll() { |
75 | | - $this->importCurData(); |
76 | | - $this->fixCurTitles(); |
77 | | - |
78 | | - $this->importOldData(); |
79 | | - $this->fixOldTitles(); |
80 | | - |
81 | | - $this->importUserData(); |
82 | | - $this->fixUserOptions(); |
83 | | - |
84 | | - $this->importWatchlists(); |
85 | | - |
86 | | - $this->importLinkData(); |
87 | | - |
88 | | - /* |
89 | | - # For some reason this is broken. RecentChanges will just start anew... |
90 | | - rebuildRecentChangesTablePass1(); |
91 | | - rebuildRecentChangesTablePass2(); |
92 | | - */ |
93 | | - |
94 | | - print "Rebuilding search index:\n"; |
95 | | - dropTextIndex(); |
96 | | - rebuildTextIndex(); |
97 | | - createTextIndex(); |
98 | | - |
99 | | - initialiseMessages(); |
100 | | - } |
101 | | - |
102 | | - # Simple import functions; for the most part these are pretty straightforward. |
103 | | - # MySQL copies everything over to the new database and tweaks a few things. |
104 | | - function importCurData() { |
105 | | - print "Clearing pages from default install, if any...\n"; |
106 | | - wfQuery( "DELETE FROM cur", DB_MASTER ); |
107 | | - |
108 | | - print "Importing current revision data...\n"; |
109 | | - wfQuery( "INSERT INTO cur (cur_id,cur_namespace,cur_title,cur_text,cur_comment, |
110 | | - cur_user,cur_user_text,cur_timestamp,cur_restrictions,cur_counter, |
111 | | - cur_is_redirect,cur_minor_edit,cur_is_new,cur_random,cur_touched) |
112 | | - SELECT cur_id,0,cur_title,cur_text,cur_comment, |
113 | | - cur_user,cur_user_text,cur_timestamp,REPLACE(cur_restrictions,'is_',''),cur_counter, |
114 | | - cur_text like '#redirect%',cur_minor_edit,0,RAND(),NOW()+0, |
115 | | - FROM {$this->olddb}.cur", DB_MASTER ); |
116 | | - $n = mysql_affected_rows(); |
117 | | - print "$n rows imported.\n"; |
118 | | - } |
119 | | - |
120 | | - function importOldData() { |
121 | | - print "Clearing old revision data from default install, if any...\n"; |
122 | | - wfQuery( "DELETE FROM old", DB_MASTER ); |
123 | | - |
124 | | - print "Importing old revision data...\n"; |
125 | | - wfQuery( "INSERT INTO old (old_id,old_namespace,old_title,old_text,old_comment, |
126 | | - old_user,old_user_text,old_timestamp,old_minor_edit,old_flags) |
127 | | - SELECT old_id,0,old_title,old_text,old_comment, |
128 | | - old_user,old_user_text,old_timestamp,old_minor_edit,'' |
129 | | - FROM {$this->olddb}.old", DB_MASTER ); |
130 | | - $n = mysql_affected_rows(); |
131 | | - print "$n rows imported.\n"; |
132 | | - } |
133 | | - |
134 | | - function importUserData() { |
135 | | - print "Clearing users from default install, if any...\n"; |
136 | | - wfQuery( "DELETE FROM user", DB_MASTER ); |
137 | | - |
138 | | - print "Importing user data...\n"; |
139 | | - wfQuery( "INSERT INTO user (user_id,user_name,user_rights, |
140 | | - user_password,user_newpassword,user_email,user_options,user_touched) |
141 | | - SELECT user_id,user_name,REPLACE(user_rights,'is_',''), |
142 | | - MD5(CONCAT(user_id,'-',MD5(user_password))),'',user_email,user_options,NOW()+0 |
143 | | - FROM {$this->olddb}.user", DB_MASTER ); |
144 | | - $n = mysql_affected_rows(); |
145 | | - print "$n rows imported.\n"; |
146 | | - } |
147 | | - |
148 | | - # A little less clean... |
149 | | - function importWatchlists() { |
150 | | - print "Clearing watchlists from default install, if any...\n"; |
151 | | - wfQuery( "DELETE FROM watchlist", DB_MASTER ); |
152 | | - |
153 | | - print "Importing watchlists..."; |
154 | | - $res = wfQuery( "SELECT user_id,user_watch FROM {$this->olddb}.user WHERE user_watch != ''", DB_MASTER ); |
155 | | - $total = wfNumRows( $res ); |
156 | | - $n = 0; |
157 | | - print " ($total total)\n"; |
158 | | - |
159 | | - while( $row = wfFetchObject( $res ) ) { |
160 | | - $id = intval( $row->user_id ); |
161 | | - $list = explode( "\n", $row->user_watch ); |
162 | | - foreach( $list as $page ) { |
163 | | - $title = $this->titleCache->fetch( $page ); |
164 | | - if( is_null( $title ) ) { |
165 | | - print "Caught bad title '{$row->title}'\n"; |
166 | | - } else { |
167 | | - $ns = $title->getNamespace(); |
168 | | - $t = wfStrencode( $title->getDBkey() ); |
169 | | - wfQuery( "INSERT INTO watchlist(wl_user,wl_namespace,wl_title) VALUES ($id,$ns,'$t')", DB_MASTER ); |
170 | | - } |
171 | | - } |
172 | | - if( ++$n % 50 == 0 ) { |
173 | | - print "$n\n"; |
174 | | - } |
175 | | - } |
176 | | - wfFreeResult( $res ); |
177 | | - } |
178 | | - |
179 | | - function importLinkData() { |
180 | | - # MUST BE CALLED BEFORE! fixCurTitles() |
181 | | - print "Clearing links from default install, if any...\n"; |
182 | | - wfQuery( "DELETE FROM links", DB_MASTER ); |
183 | | - wfQuery( "DELETE FROM brokenlinks", DB_MASTER ); |
184 | | - |
185 | | - print "Importing live links..."; |
186 | | - wfQuery( "INSERT INTO links (l_from, l_to) |
187 | | - SELECT DISTINCT linked_from,cur_id |
188 | | - FROM {$this->olddb}.linked,{$this->olddb}.cur |
189 | | - WHERE linked_to=cur_title", DB_MASTER ); |
190 | | - $n = mysql_affected_rows(); |
191 | | - print "$n rows imported.\n"; |
192 | | - |
193 | | - print "Importing broken links..."; |
194 | | - wfQuery( "INSERT INTO brokenlinks (bl_from, bl_to) |
195 | | - SELECT DISTINCT cur_id,unlinked_to |
196 | | - FROM {$this->olddb}.unlinked,{$this->olddb}.cur |
197 | | - WHERE unlinked_from=cur_title", DB_MASTER ); |
198 | | - $n = mysql_affected_rows(); |
199 | | - print "$n rows imported.\n"; |
200 | | - } |
201 | | - |
202 | | - # Fixup functions: munge data that's already been brought into tables |
203 | | - function fixCurTitles() { |
204 | | - $this->fixTitles( "cur" ); |
205 | | - } |
206 | | - |
207 | | - function fixOldTitles() { |
208 | | - $this->fixTitles( "old" ); |
209 | | - } |
210 | | - |
211 | | - function fixTitles( $table ) { |
212 | | - print "Fixing titles in $table..."; |
213 | | - $res = wfQuery( "SELECT DISTINCT {$table}_title AS title FROM $table", DB_MASTER ); |
214 | | - $total = wfNumRows( $res ); |
215 | | - $n = 0; |
216 | | - print " ($total total)\n"; |
217 | | - |
218 | | - while( $row = wfFetchObject( $res ) ) { |
219 | | - $xt = wfStrencode( $row->title ); |
220 | | - $title = $this->titleCache->fetch( $row->title ); |
221 | | - if( is_null( $title ) ) { |
222 | | - print "Caught bad title '{$row->title}'\n"; |
223 | | - } else { |
224 | | - $ns = $title->getNamespace(); |
225 | | - $t = wfStrencode( $title->getDBkey() ); |
226 | | - wfQuery( "UPDATE $table SET {$table}_namespace=$ns,{$table}_title='$t' |
227 | | - WHERE {$table}_namespace=0 AND {$table}_title='$xt'", DB_MASTER ); |
228 | | - } |
229 | | - if( ++$n % 50 == 0 ) { |
230 | | - print "$n\n"; |
231 | | - } |
232 | | - } |
233 | | - wfFreeResult( $res ); |
234 | | - } |
235 | | - |
236 | | - function rewriteUserOptions( $in ) |
237 | | - { |
238 | | - $s = urldecode( $in ); |
239 | | - $a = explode( "\n", $s ); |
240 | | - |
241 | | - foreach ( $a as $l ) { |
242 | | - $m = array(); |
243 | | - if ( preg_match( "/^([A-Za-z0-9_]+)=(.*)/", $l, $m ) ) { |
244 | | - $ops[$m[1]] = $m[2]; |
245 | | - } |
246 | | - } |
247 | | - $nops = array(); |
248 | | - |
249 | | - $q = strtolower( $ops["quickBar"] ); |
250 | | - if ( $q == "none" ) { $q = 0; } |
251 | | - else { $q = 1; } # Default to left |
252 | | - $nops["quickbar"] = $q; |
253 | | - |
254 | | - if ( $ops["markupNewTopics"] == "inverse" ) { |
255 | | - $nops["highlightbroken"] = 1; |
256 | | - } |
257 | | - $sk = substr( strtolower( $ops["skin"] ), 0, 4 ); |
258 | | - if ( "star" == $sk ) { $sk = 0; } |
259 | | - else if ( "nost" == $sk ) { $sk = 1; } |
260 | | - else if ( "colo" == $sk ) { $sk = 2; } |
261 | | - else { $sk = 0; } |
262 | | - $nops["skin"] = $sk; |
263 | | - |
264 | | - $u = strtolower( $ops["underlineLinks"] ); |
265 | | - if ( "yes" == $u || "on" == $u ) { $nops["underline"] = 1; } |
266 | | - else { $nops["underline"] = 0; } |
267 | | - |
268 | | - $t = ( (int) ($ops["hourDiff"]) ); |
269 | | - if ( $t < -23 || $t > 23 ) { $t = 0; } |
270 | | - if ( 0 != $t ) { $nops["timecorrection"] = $t; } |
271 | | - |
272 | | - $j = strtolower( $ops["justify"] ); |
273 | | - if ( "yes" == $j || "on" == $j ) { $nops["justify"] = 1; } |
274 | | - $n = strtolower( $ops["numberHeadings"] ); |
275 | | - if ( "yes" == $n || "on" == $n ) { $nops["numberheadings"] = 1; } |
276 | | - $h = strtolower( $ops["hideMinor"] ); |
277 | | - if ( "yes" == $h || "on" == $h ) { $nops["hideminor"] = 1; } |
278 | | - $r = strtolower( $ops["rememberPassword"] ); |
279 | | - if ( "yes" == $r || "on" == $r ) { $nops["rememberpassword"] = 1; } |
280 | | - $s = strtolower( $ops["showHover"] ); |
281 | | - if ( "yes" == $s || "on" == $s ) { $nops["hover"] = 1; } |
282 | | - |
283 | | - $c = $ops["cols"]; |
284 | | - if ( $c < 20 || $c > 200 ) { $nops["cols"] = 80; } |
285 | | - else { $nops["cols"] = $c; } |
286 | | - $r = $ops["rows"]; |
287 | | - if ( $r < 5 || $r > 100 ) { $nops["rows"] = 20; } |
288 | | - else { $nops["rows"] = $r; } |
289 | | - $r = $ops["resultsPerPage"]; |
290 | | - if ( $r < 3 || $r > 500 ) { $nops["searchlimit"] = 20; } |
291 | | - else { $nops["searchlimit"] = $r; } |
292 | | - $r = $ops["viewRecentChanges"]; |
293 | | - if ( $r < 10 || $r > 1000 ) { $nops["rclimit"] = 50; } |
294 | | - else { $nops["rclimit"] = $r; } |
295 | | - $nops["rcdays"] = 3; |
296 | | - |
297 | | - $a = array(); |
298 | | - foreach ( $nops as $oname => $oval ) { |
299 | | - array_push( $a, "$oname=$oval" ); |
300 | | - } |
301 | | - $s = implode( "\n", $a ); |
302 | | - return $s; |
303 | | - } |
304 | | - |
305 | | - function fixUserOptions() { |
306 | | - print "Fixing user options..."; |
307 | | - $res = wfQuery( "SELECT user_id,user_options FROM user", DB_MASTER ); |
308 | | - $total = wfNumRows( $res ); |
309 | | - $n = 0; |
310 | | - print " ($total total)\n"; |
311 | | - |
312 | | - while( $row = wfFetchObject( $res ) ) { |
313 | | - $id = intval( $row->user_id ); |
314 | | - $option = wfStrencode( $this->rewriteUserOptions( $row->user_options ) ); |
315 | | - wfQuery( "UPDATE user SET user_options='$option' WHERE user_id=$id LIMIT 1", DB_MASTER ); |
316 | | - if( ++$n % 50 == 0 ) { |
317 | | - print "$n\n"; |
318 | | - } |
319 | | - } |
320 | | - wfFreeResult( $res ); |
321 | | - } |
322 | | - |
323 | | -} |
324 | | - |
325 | | -/** |
326 | | - * @todo document |
327 | | - * @addtogroup Maintenance |
328 | | - */ |
329 | | -class TitleCache { |
330 | | - var $hash = array(); |
331 | | - |
332 | | - function &fetch( $dbkey ) { |
333 | | - if( !isset( $this->hash[$dbkey] ) ) { |
334 | | - $this->hash[$dbkey] = Title::newFromDBkey( $dbkey ); |
335 | | - } |
336 | | - return $this->hash[$dbkey]; |
337 | | - } |
338 | | - |
339 | | -} |
340 | | - |
341 | | -# |
342 | | -print "You should have already run the installer to create a fresh, blank database.\n"; |
343 | | -print "Data will be inserted into '$wgDBname'. THIS SHOULD BE EMPTY AND ANY DATA IN IN WILL BE ERASED!\n"; |
344 | | -print "\nIf that's not what you want, ABORT NOW!\n\n"; |
345 | | - |
346 | | -print "Please enter the name of the old 'phase 2'-format database that will be used as a source:\n"; |
347 | | -print "Old database name [enciclopedia]: "; |
348 | | -$olddb = readconsole(); |
349 | | -if( empty( $olddb ) ) $olddb = "enciclopedia"; |
350 | | - |
351 | | -if( $olddb == $wgDBname ) { |
352 | | - die( "Can't upgrade in-place! You must create a new database and copy data into it.\n" ); |
353 | | -} |
354 | | - |
355 | | -print "\nSource database: '$olddb'\n"; |
356 | | -print " Dest database: '$wgDBname'\n"; |
357 | | -print "Is this correct? Anything in '$wgDBname' WILL BE DESTROYED. [y/N] "; |
358 | | -$response = readconsole(); |
359 | | -if( strtolower( $response{0} ) != 'y' ) { |
360 | | - die( "\nAborted by user.\n" ); |
361 | | -} |
362 | | - |
363 | | -print "Starting import....\n"; |
364 | | - |
365 | | -$wgTitle = Title::newFromText( "Conversion script" ); |
366 | | -$importer = new Phase2Importer( $olddb ); |
367 | | -$importer->importAll(); |
368 | | - |
369 | | -?> |
Index: trunk/phase3/maintenance/userDupes.php |
— | — | @@ -1,41 +0,0 @@ |
2 | | -<?php |
3 | | -# Copyright (C) 2005 Brion Vibber <brion@pobox.com> |
4 | | -# http://www.mediawiki.org/ |
5 | | -# |
6 | | -# This program is free software; you can redistribute it and/or modify |
7 | | -# it under the terms of the GNU General Public License as published by |
8 | | -# the Free Software Foundation; either version 2 of the License, or |
9 | | -# (at your option) any later version. |
10 | | -# |
11 | | -# This program is distributed in the hope that it will be useful, |
12 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | -# GNU General Public License for more details. |
15 | | -# |
16 | | -# You should have received a copy of the GNU General Public License along |
17 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
18 | | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | | -# http://www.gnu.org/copyleft/gpl.html |
20 | | - |
21 | | -$options = array( 'fix' ); |
22 | | - |
23 | | -/** */ |
24 | | -require_once( 'commandLine.inc' ); |
25 | | -require_once( 'maintenance/userDupes.inc' ); |
26 | | - |
27 | | -$wgTitle = Title::newFromText( 'Dupe user entry cleanup script' ); |
28 | | - |
29 | | -$fix = isset( $options['fix'] ); |
30 | | -$dbw = wfGetDB( DB_MASTER ); |
31 | | -$duper = new UserDupes( $dbw ); |
32 | | -$retval = $duper->checkDupes( $fix ); |
33 | | - |
34 | | -if( $retval ) { |
35 | | - echo "\nLooks good!\n"; |
36 | | - exit( 0 ); |
37 | | -} else { |
38 | | - echo "\nOh noeees\n"; |
39 | | - exit( -1 ); |
40 | | -} |
41 | | - |
42 | | -?> |
\ No newline at end of file |