Index: trunk/phpwiki/newcodebase/InterText.php |
— | — | @@ -1,3 +0,0 @@ |
2 | | -<? |
3 | | -include_once( "./Language.php" ); |
4 | | -?> |
Index: trunk/phpwiki/newcodebase/SpecialMovepage.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "movepage" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Move page)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/Skin.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | $s .= "a { text-decoration: none; }\n"; |
40 | 40 | } |
41 | 41 | if ( 1 == $wgUser->getOption( "markupNewTopics" ) ) { |
42 | | - $s .= "a.new { color: red; text-decoration: none; }\n"; |
| 42 | + $s .= "a.new { color: white; background: blue; }\n"; |
43 | 43 | } |
44 | 44 | $s .= "//--></style>\n"; |
45 | 45 | return $s; |
— | — | @@ -478,9 +478,9 @@ |
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | | -include_once( "./SkinStandard.php" ); |
483 | | -include_once( "./SkinStarTrek.php" ); |
484 | | -include_once( "./SkinNostalgia.php" ); |
485 | | -include_once( "./SkinCologneBlue.php" ); |
| 482 | +include_once( "SkinStandard.php" ); |
| 483 | +include_once( "SkinStarTrek.php" ); |
| 484 | +include_once( "SkinNostalgia.php" ); |
| 485 | +include_once( "SkinCologneBlue.php" ); |
486 | 486 | |
487 | 487 | ?> |
Index: trunk/phpwiki/newcodebase/SpecialUserlogout.php |
— | — | @@ -5,7 +5,6 @@ |
6 | 6 | global $wgUser, $wgOut, $returnto; |
7 | 7 | |
8 | 8 | $wgUser->logout(); |
9 | | - $wgOut->setPageTitle( wfMsg( "userlogout" ) ); |
10 | 9 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
11 | 10 | $wgOut->addHTML( wfMsg( "logouttext" ) . "\n<p>" ); |
12 | 11 | $wgOut->returnToMain(); |
Index: trunk/phpwiki/newcodebase/sql/buildtables.sql |
— | — | @@ -1,106 +1,85 @@ |
2 | 2 | # MySQL script for creating wikipedia database |
3 | | -# |
4 | 3 | |
5 | | -# |
6 | | -# Table structure for table 'cur' |
7 | | -# |
| 4 | +CREATE TABLE user ( |
| 5 | + user_id int(5) unsigned NOT NULL auto_increment, |
| 6 | + user_name varchar(40) binary NOT NULL, |
| 7 | + user_rights tinyblob, |
| 8 | + user_password tinyblob, |
| 9 | + user_email tinytext, |
| 10 | + user_options blob, |
| 11 | + user_watch mediumblob, |
| 12 | + user_nickname tinyblob, |
| 13 | + UNIQUE KEY user_id (user_id), |
| 14 | + UNIQUE KEY user_name (user_name(20)) |
| 15 | +) TYPE=MyISAM PACK_KEYS=1; |
8 | 16 | |
| 17 | +# "Current" version of each article |
| 18 | +# |
9 | 19 | CREATE TABLE cur ( |
10 | | - cur_id mediumint(8) unsigned NOT NULL auto_increment, |
| 20 | + cur_id int(8) unsigned NOT NULL auto_increment, |
11 | 21 | cur_namespace tinyint(2) unsigned NOT NULL default '0', |
12 | 22 | cur_title varchar(255) binary NOT NULL default '', |
13 | 23 | cur_text mediumtext, |
14 | 24 | cur_comment tinyblob, |
15 | | - cur_user mediumint(8) unsigned default '0', |
16 | | - cur_user_text tinyblob, |
17 | | - cur_old_version mediumint(8) unsigned default '0', |
| 25 | + cur_user int(5) unsigned default '0', |
| 26 | + cur_revision int(5) unsigned default '0', |
18 | 27 | cur_timestamp timestamp(14) NOT NULL, |
19 | 28 | cur_minor_edit tinyint(1) default '0', |
20 | 29 | cur_restrictions tinyblob, |
21 | | - cur_params mediumtext, |
22 | 30 | cur_counter bigint(20) unsigned default '0', |
23 | | - cur_cache mediumtext, |
24 | 31 | cur_ind_title varchar(255) default NULL, |
25 | | - INDEX cur_namespace (cur_namespace), |
26 | | - INDEX cur_title (cur_title), |
27 | 32 | UNIQUE KEY cur_id (cur_id), |
28 | | - INDEX timeind (cur_timestamp), |
29 | | - FULLTEXT KEY cur_ind_title (cur_ind_title), |
30 | | - FULLTEXT KEY cur_text (cur_text) |
| 33 | + INDEX cur_namespace (cur_namespace), |
| 34 | + INDEX cur_title (cur_title(30)), |
| 35 | + INDEX cur_timestamp (cur_timestamp), |
| 36 | + FULLTEXT INDEX cur_ind_title (cur_ind_title), |
| 37 | + FULLTEXT INDEX cur_text (cur_text) |
31 | 38 | ) TYPE=MyISAM PACK_KEYS=1; |
32 | 39 | |
| 40 | +# Historical versions of articles |
33 | 41 | # |
34 | | -# Table structure for table 'linked' |
35 | | -# |
36 | | - |
37 | | -CREATE TABLE linked ( |
38 | | - linked_to varchar(255) binary NOT NULL default '', |
39 | | - linked_from varchar(255) binary NOT NULL default '', |
40 | | - KEY linked_to (linked_to), |
41 | | - KEY linked_from (linked_from) |
42 | | -) TYPE=MyISAM PACK_KEYS=1; |
43 | | - |
44 | | -# |
45 | | -# Table structure for table 'old' |
46 | | -# |
47 | | - |
48 | 42 | CREATE TABLE old ( |
49 | | - old_id mediumint(8) unsigned NOT NULL auto_increment, |
| 43 | + old_id int(8) unsigned NOT NULL auto_increment, |
50 | 44 | old_namespace tinyint(2) unsigned NOT NULL default '0', |
51 | 45 | old_title varchar(255) binary NOT NULL default '', |
52 | 46 | old_text mediumtext, |
53 | 47 | old_comment tinyblob, |
54 | | - old_user mediumint(8) unsigned default '0', |
55 | | - old_user_text tinyblob, |
56 | | - old_old_version mediumint(8) unsigned default '0', |
| 48 | + old_user int(5) unsigned default '0', |
| 49 | + old_revision int(5) unsigned default '0', |
57 | 50 | old_timestamp timestamp(14) NOT NULL, |
58 | 51 | old_minor_edit tinyint(1) default '0', |
59 | 52 | UNIQUE KEY old_id (old_id), |
60 | | - KEY timeind (old_timestamp), |
61 | | - KEY old_title (old_title) |
| 53 | + INDEX old_namespace (old_namespace), |
| 54 | + INDEX old_title (old_title(30)), |
| 55 | + INDEX old_timestamp (old_timestamp) |
62 | 56 | ) TYPE=MyISAM PACK_KEYS=1; |
63 | 57 | |
| 58 | +# Internal links: values are external keys into cur |
64 | 59 | # |
65 | | -# Table structure for table 'unlinked' |
66 | | -# |
| 60 | +CREATE TABLE linked ( |
| 61 | + linked_from int(8) unsigned NOT NULL default '0', |
| 62 | + linked_to int(8) unsigned NOT NULL default '0', |
| 63 | + INDEX linked_from (linked_from), |
| 64 | + INDEX linked_to (linked_to) |
| 65 | +) TYPE=MyISAM; |
67 | 66 | |
68 | | -CREATE TABLE unlinked ( |
69 | | - unlinked_from varchar(255) binary NOT NULL default '', |
70 | | - unlinked_to varchar(255) binary NOT NULL default '', |
71 | | - KEY unlinked_from (unlinked_from), |
72 | | - KEY unlinked_to (unlinked_to) |
73 | | -) TYPE=MyISAM PACK_KEYS=1; |
74 | | - |
| 67 | +# Site-wide statistics. |
75 | 68 | # |
76 | | -# Table structure for table 'user' |
77 | | -# |
78 | | - |
79 | | -CREATE TABLE user ( |
80 | | - user_id mediumint(8) unsigned NOT NULL auto_increment, |
81 | | - user_name varchar(40) binary NOT NULL, |
82 | | - user_rights tinytext, |
83 | | - user_password tinytext, |
84 | | - user_email tinytext, |
85 | | - user_options mediumtext, |
86 | | - user_watch mediumtext, |
87 | | - user_nickname tinytext, |
88 | | - UNIQUE KEY user_id (user_id), |
89 | | - UNIQUE KEY user_name (user_name) |
90 | | -) TYPE=MyISAM PACK_KEYS=1; |
91 | | - |
92 | 69 | CREATE TABLE site_stats ( |
93 | | - ss_row_id mediumint(8) unsigned NOT NULL, |
| 70 | + ss_row_id int(8) unsigned NOT NULL, |
94 | 71 | ss_total_views bigint(20) unsigned default '0', |
95 | 72 | ss_total_edits bigint(20) unsigned default '0', |
96 | 73 | ss_good_articles bigint(20) unsigned default '0', |
97 | 74 | UNIQUE KEY ss_row_id (ss_row_id) |
98 | 75 | ) TYPE=MyISAM; |
99 | 76 | |
| 77 | +# Users and/or IP addresses blocked from editing |
| 78 | +# |
100 | 79 | CREATE TABLE ipblocks ( |
101 | 80 | ipb_address varchar(40) binary default '', |
102 | | - ipb_user mediumint(8) unsigned default '0', |
103 | | - ipb_by mediumint(8) unsigned default '0', |
104 | | - ipb_reason mediumtext default '', |
| 81 | + ipb_user int(8) unsigned default '0', |
| 82 | + ipb_by int(8) unsigned default '0', |
| 83 | + ipb_reason blob default '', |
105 | 84 | INDEX ipb_address (ipb_address), |
106 | 85 | INDEX ipb_user (ipb_user) |
107 | 86 | ) TYPE=MyISAM PACK_KEYS=1; |
Index: trunk/phpwiki/newcodebase/sql/convertdb.php |
— | — | @@ -1,196 +1,268 @@ |
2 | 2 | <? |
3 | 3 | # Script for converting May 2002 version of wikipedia |
4 | 4 | # database into the format for the "newwiki" software. |
5 | | -# Intended to be run from the php command line. |
| 5 | +# Intended to be run from the php command line. It has |
| 6 | +# to be run from the same directory as the code so that |
| 7 | +# all the includes work. |
| 8 | + |
| 9 | +# Must find and include utility classes from main code, |
| 10 | +# and define a few of its globals. |
6 | 11 | # |
7 | | -include_once( "../Namespace.php" ); |
| 12 | +include_once( "LocalSettings.php" ); |
| 13 | +include_once( "GlobalFunctions.php" ); |
| 14 | +include_once( "Language.php" ); |
| 15 | +include_once( "Namespace.php" ); |
| 16 | +include_once( "User.php" ); |
| 17 | +include_once( "Title.php" ); |
| 18 | +include_once( "Article.php" ); |
8 | 19 | |
9 | | -$DBserver = "127.0.0.1"; |
10 | | -$DBname = "wikidb"; |
11 | | -$DBuser = "wikiuser"; |
12 | | -$DBpassword = "xxx"; |
| 20 | +global $wgUser, $wgLang, $wgOut, $wgTitle; |
| 21 | +$wgLangClass = "Language" . ucfirst( $wgLanguageCode ); |
| 22 | +$wgLang = new $wgLangClass(); |
| 23 | + |
| 24 | +# Name of old databse, SQL file to produce, and global progress counter. |
| 25 | +# |
| 26 | +$wgDBname = "wikidb"; |
13 | 27 | $outfilename = "newdb.sql"; |
| 28 | +$count = 0; |
14 | 29 | |
15 | | -$conn = mysql_connect( $DBserver, $DBuser, $DBpassword ) |
16 | | - or die( "Can't connect to database server." ); |
17 | | -mysql_select_db( $DBname, $conn ) or die( "Can't select database." ); |
18 | | -print "Connected to database.\n"; |
| 30 | +# Actual code begins here. Some code may be commented out. |
| 31 | +# |
19 | 32 | |
20 | | -$outf = fopen( $outfilename, "w" ) |
21 | | - or die( "Can't open output file.\n" ); |
22 | | - |
23 | 33 | set_time_limit(0); |
| 34 | +$outf = fopen( $outfilename, "w" ) or die( "Can't open output file.\n" ); |
24 | 35 | |
25 | 36 | |
26 | | -# USER |
27 | | -# |
28 | | -print "Converting USER table.\n"; |
29 | | -$sql = "SELECT * FROM user"; |
30 | | -$res = mysql_query( $sql, $conn ); |
31 | | -if ( ! $res ) die( "Can't open \"user\" table." ); |
| 37 | +convertUserTable(); |
| 38 | +convertCurTable(); |
| 39 | +convertOldTable(); |
32 | 40 | |
33 | | -p_start(); |
34 | | -while ( $row = mysql_fetch_object( $res ) ) { |
35 | 41 | |
36 | | - if ( 0 == ( $progressCount % 100 ) ) { |
37 | | - if ( 0 != $progressCount ) { fwrite( $outf, ";\n" ) ; } |
| 42 | +# All done |
| 43 | +# |
| 44 | +fclose( $outf ); |
| 45 | +print "Done.\n"; |
| 46 | +exit(); |
38 | 47 | |
39 | | - fwrite( $outf, "INSERT INTO user (user_id,user_name,user_rights," . |
40 | | - "user_password,user_email,user_options,user_watch,user_nickname)" . |
41 | | - " VALUES " ); |
42 | | - } else { |
43 | | - fwrite( $outf, "," ); |
44 | | - } |
45 | | - # Need to do some tweaking of options here |
46 | | - # |
47 | | - $ops = strencode(urldecode($row->user_options)); |
48 | | - $name = strencode($row->user_name); |
49 | | - $rights = strencode($row->user_rights); |
50 | | - $email = strencode($row->user_email); |
51 | | - $pwd = strencode($row->user_password); |
52 | | - $watch = strencode($row->user_watch); |
53 | 48 | |
54 | | - fwrite( $outf, "({$row->user_id},'$name','$rights','$pwd','$email'," . |
55 | | - "'$ops','$watch','')" ); |
56 | | - progress(); |
57 | | -} |
58 | | -mysql_free_result( $res ); |
59 | | -fwrite( $outf, ";\n" ); |
60 | | -p_end(); |
61 | | - |
62 | | -# CUR |
63 | 49 | # |
| 50 | +# |
| 51 | +function convertUserTable() |
| 52 | +{ |
| 53 | + global $count, $outf; |
| 54 | + $count = 0; |
64 | 55 | |
65 | | -print "Converting CUR table.\n"; |
66 | | -$sql = "SELECT * FROM cur"; |
67 | | -$res = mysql_query( $sql, $conn ); |
68 | | -if ( ! $res ) die( "Can't open \"cur\" table." ); |
| 56 | + print "Converting USER table.\n"; |
| 57 | + $conn = wfGetDB(); |
| 58 | + $sql = "SELECT user_id,user_name,user_rights,user_password," . |
| 59 | + "user_email,user_options,user_watch FROM user"; |
| 60 | + $res = mysql_query( $sql, $conn ); |
| 61 | + if ( ! $res ) die( "Can't open \"user\" table." ); |
69 | 62 | |
70 | | -p_start(); |
71 | | -while ( $row = mysql_fetch_object( $res ) ) { |
| 63 | + while ( $row = mysql_fetch_object( $res ) ) { |
| 64 | + if ( 0 == ( $count % 100 ) ) { |
| 65 | + if ( 0 != $count ) { fwrite( $outf, ";\n" ) ; } |
72 | 66 | |
73 | | - if ( 0 == ( $progressCount % 100 ) ) { |
74 | | - if ( 0 != $progressCount ) { fwrite( $outf, ";\n" ) ; } |
| 67 | + fwrite( $outf, "INSERT INTO user (user_id,user_name,user_rights," . |
| 68 | + "user_password,user_email,user_options,user_watch,user_nickname)" . |
| 69 | + " VALUES " ); |
| 70 | + } else { |
| 71 | + fwrite( $outf, "," ); |
| 72 | + } |
| 73 | + $ops = fixUserOptions( $row->user_options ); |
| 74 | + $name = wfStrencode( $row->user_name ); |
| 75 | + $rights = wfStrencode( $row->user_rights ); |
| 76 | + $email = wfStrencode( $row->user_email ); |
| 77 | + $pwd = wfStrencode( $row->user_password ); |
| 78 | + $watch = wfStrencode( $row->user_watch ); |
75 | 79 | |
76 | | - fwrite( $outf, "INSERT INTO cur (cur_id,cur_namespace," . |
77 | | - "cur_title,cur_text,cur_comment,cur_user,cur_user_text," . |
78 | | - "cur_old_version,cur_timestamp,cur_minor_edit," . |
79 | | - "cur_restrictions,cur_params,cur_counter," . |
80 | | - "cur_ind_title) VALUES " ); |
81 | | - } else { |
82 | | - fwrite( $outf, "," ); |
| 80 | + fwrite( $outf, "({$row->user_id},'$name','$rights','$pwd','$email'," . |
| 81 | + "'$ops','$watch','')" ); |
| 82 | + |
| 83 | + if ( ( ++$count % 1000 ) == 0 ) { |
| 84 | + print "$count records processed.\r"; |
| 85 | + } |
83 | 86 | } |
84 | | - if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", |
85 | | - $row->cur_title, $m ) ) { |
86 | | - $ns = $m[1]; |
87 | | - $t = $m[2]; |
88 | | - } else { |
89 | | - $ns = ""; |
90 | | - $t = $row->cur_title; |
91 | | - } |
92 | | - $namespace = Namespace::getIndex( $ns ); |
93 | | - $title = strencode( $t ); |
94 | | - $text = strencode( $row->cur_text ); |
95 | | - $com = strencode( $row->cur_comment ); |
96 | | - $cut = strencode( $row->cur_user_text ); |
97 | | - $cr = strencode( $row->cur_restrictions ); |
98 | | - $cp = strencode( $row->cur_params ); |
99 | | - $cit = strencode( $row->cur_ind_title ); |
100 | | - |
101 | | - fwrite( $outf, "({$row->cur_id},$namespace,'$title','$text'," . |
102 | | - "'$com',{$row->cur_user},'$cut',{$row->cur_old_version}," . |
103 | | - "'{$row->cur_timestamp}',{$row->cur_minor_edit},'$cr','$cp'," . |
104 | | - "{$row->cur_counter},'$cit')" ); |
105 | | - progress(); |
| 87 | + print "$count records processed.\n"; |
| 88 | + mysql_free_result( $res ); |
| 89 | + fwrite( $outf, ";\n" ); |
106 | 90 | } |
107 | | -mysql_free_result( $res ); |
108 | | -fwrite( $outf, ";\n" ); |
109 | | -p_end(); |
110 | 91 | |
111 | | -# OLD |
112 | | -# |
113 | 92 | |
114 | | -print "Converting OLD table.\n"; |
115 | | -$sql = "SELECT * FROM old"; |
116 | | -$res = mysql_query( $sql, $conn ); |
117 | | -if ( ! $res ) die( "Can't open \"old\" table." ); |
| 93 | +function convertCurTable() |
| 94 | +{ |
| 95 | + global $count, $outf; |
| 96 | + $count = 0; |
118 | 97 | |
119 | | -p_start(); |
120 | | -while ( $row = mysql_fetch_object( $res ) ) { |
| 98 | + print "Converting CUR table.\n"; |
| 99 | + $conn = wfGetDB(); |
| 100 | + $sql = "SELECT cur_id,cur_title,cur_text,cur_comment,cur_user," . |
| 101 | + "cur_old_version,cur_timestamp,cur_minor_edit,cur_restrictions," . |
| 102 | + "cur_counter,cur_ind_title FROM cur"; |
| 103 | + $res = mysql_query( $sql, $conn ); |
| 104 | + if ( ! $res ) die( "Can't open \"cur\" table." ); |
121 | 105 | |
122 | | - if ( 0 == ( $progressCount % 100 ) ) { |
123 | | - if ( 0 != $progressCount ) { fwrite( $outf, ";\n" ) ; } |
| 106 | + while ( $row = mysql_fetch_object( $res ) ) { |
| 107 | + if ( 0 == ( $count % 100 ) ) { |
| 108 | + if ( 0 != $count ) { fwrite( $outf, ";\n" ) ; } |
124 | 109 | |
125 | | - fwrite( $outf, "INSERT INTO old (old_id,old_namespace," . |
126 | | - "old_title,old_text,old_comment,old_user,old_user_text," . |
127 | | - "old_old_version,old_timestamp,old_minor_edit) VALUES " ); |
128 | | - } else { |
129 | | - fwrite( $outf, "," ); |
| 110 | + fwrite( $outf, "INSERT INTO cur (cur_id,cur_namespace," . |
| 111 | + "cur_title,cur_text,cur_comment,cur_user," . |
| 112 | + "cur_revision,cur_timestamp,cur_minor_edit," . |
| 113 | + "cur_restrictions,cur_counter," . |
| 114 | + "cur_ind_title) VALUES " ); |
| 115 | + } else { |
| 116 | + fwrite( $outf, "," ); |
| 117 | + } |
| 118 | + if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", |
| 119 | + $row->cur_title, $m ) ) { |
| 120 | + $ns = $m[1]; |
| 121 | + $t = $m[2]; |
| 122 | + } else { |
| 123 | + $ns = ""; |
| 124 | + $t = $row->cur_title; |
| 125 | + } |
| 126 | + if ( 0 == strcasecmp( "Log", $ns ) ) { |
| 127 | + $ns = "Wikipedia"; |
| 128 | + $t .= " log"; |
| 129 | + } |
| 130 | + $namespace = Namespace::getIndex( $ns ); |
| 131 | + $title = wfStrencode( $t ); |
| 132 | + $text = wfStrencode( $row->cur_text ); |
| 133 | + $com = wfStrencode( $row->cur_comment ); |
| 134 | + $cr = wfStrencode( $row->cur_restrictions ); |
| 135 | + $cp = wfStrencode( $row->cur_params ); |
| 136 | + $cit = wfStrencode( $row->cur_ind_title ); |
| 137 | + |
| 138 | + fwrite( $outf, "({$row->cur_id},$namespace,'$title','$text'," . |
| 139 | + "'$com',{$row->cur_user},{$row->cur_old_version}," . |
| 140 | + "'{$row->cur_timestamp}',{$row->cur_minor_edit},'$cr'," . |
| 141 | + "{$row->cur_counter},'$cit')" ); |
| 142 | + |
| 143 | + if ( ( ++$count % 1000 ) == 0 ) { |
| 144 | + print "$count records processed.\r"; |
| 145 | + } |
130 | 146 | } |
131 | | - if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", |
132 | | - $row->old_title, $m ) ) { |
133 | | - $ns = $m[1]; |
134 | | - $t = $m[2]; |
135 | | - } else { |
136 | | - $ns = ""; |
137 | | - $t = $row->old_title; |
138 | | - } |
139 | | - $namespace = Namespace::getIndex( $ns ); |
140 | | - $title = strencode( $t ); |
141 | | - $text = strencode( $row->old_text ); |
142 | | - $com = strencode( $row->old_comment ); |
143 | | - $cut = strencode( $row->old_user_text ); |
144 | | - |
145 | | - fwrite( $outf, "({$row->old_id},$namespace,'$title','$text'," . |
146 | | - "'$com',{$row->old_user},'$cut',{$row->old_old_version}," . |
147 | | - "'{$row->old_timestamp}',{$row->old_minor_edit} )" ); |
148 | | - progress(); |
| 147 | + print "$count records processed.\n"; |
| 148 | + mysql_free_result( $res ); |
| 149 | + fwrite( $outf, ";\n" ); |
149 | 150 | } |
150 | | -mysql_free_result( $res ); |
151 | | -fwrite( $outf, ";\n" ); |
152 | | -p_end(); |
153 | 151 | |
154 | 152 | |
| 153 | +function convertOldTable() |
| 154 | +{ |
| 155 | + global $count, $outf; |
| 156 | + $count = 0; |
155 | 157 | |
156 | | -fclose( $outf ); |
| 158 | + print "Converting OLD table.\n"; |
| 159 | + $conn = wfGetDB(); |
| 160 | + $sql = "SELECT old_id,old_title,old_text,old_comment,old_user," . |
| 161 | + "old_old_version,old_timestamp,old_minor_edit FROM old"; |
| 162 | + $res = mysql_query( $sql, $conn ); |
| 163 | + if ( ! $res ) die( "Can't open \"old\" table." ); |
157 | 164 | |
158 | | -# All done |
159 | | -# |
160 | | -print "Database converted. You should now run the |
161 | | -\"updatedb\" script to fill in the derived tables. |
162 | | -"; |
| 165 | + while ( $row = mysql_fetch_object( $res ) ) { |
| 166 | + if ( 0 == ( $count % 100 ) ) { |
| 167 | + if ( 0 != $count ) { fwrite( $outf, ";\n" ) ; } |
163 | 168 | |
164 | | -function p_start() |
165 | | -{ |
166 | | - global $progressCount; |
167 | | - $progressCount = 0; |
168 | | -} |
| 169 | + fwrite( $outf, "INSERT INTO old (old_id,old_namespace," . |
| 170 | + "old_title,old_text,old_comment,old_user," . |
| 171 | + "old_revision,old_timestamp,old_minor_edit) VALUES " ); |
| 172 | + } else { |
| 173 | + fwrite( $outf, "," ); |
| 174 | + } |
| 175 | + if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", |
| 176 | + $row->old_title, $m ) ) { |
| 177 | + $ns = $m[1]; |
| 178 | + $t = $m[2]; |
| 179 | + } else { |
| 180 | + $ns = ""; |
| 181 | + $t = $row->old_title; |
| 182 | + } |
| 183 | + if ( 0 == strcasecmp( "Log", $ns ) ) { |
| 184 | + continue; |
| 185 | + } |
| 186 | + $namespace = Namespace::getIndex( $ns ); |
| 187 | + $title = wfStrencode( $t ); |
| 188 | + $text = wfStrencode( $row->old_text ); |
| 189 | + $com = wfStrencode( $row->old_comment ); |
169 | 190 | |
170 | | -function p_end() |
171 | | -{ |
172 | | - global $progressCount; |
173 | | - print "$progressCount records processed.\n\n"; |
| 191 | + fwrite( $outf, "({$row->old_id},$namespace,'$title','$text'," . |
| 192 | + "'$com',{$row->old_user},{$row->old_old_version}," . |
| 193 | + "'{$row->old_timestamp}',{$row->old_minor_edit} )" ); |
| 194 | + |
| 195 | + if ( ( ++$count % 1000 ) == 0 ) { |
| 196 | + print "$count records processed.\r"; |
| 197 | + } |
| 198 | + } |
| 199 | + print "$count records processed.\n"; |
| 200 | + mysql_free_result( $res ); |
| 201 | + fwrite( $outf, ";\n" ); |
174 | 202 | } |
175 | 203 | |
176 | | -function progress() |
| 204 | +function fixUserOptions( $in ) |
177 | 205 | { |
178 | | - global $progressCount; |
| 206 | + $s = urldecode( $in ); |
| 207 | + $a = explode( "\n", $s ); |
179 | 208 | |
180 | | - ++$progressCount; |
181 | | - if ( 0 == ( $progressCount % 1000 ) ) { |
182 | | - print "$progressCount records processed.\n"; |
| 209 | + foreach ( $a as $l ) { |
| 210 | + if ( preg_match( "/^([A-Za-z0-9_]+)=(.*)/", $l, $m ) ) { |
| 211 | + $ops[$m[1]] = $m[2]; |
| 212 | + } |
183 | 213 | } |
184 | | -} |
| 214 | + unset( $ops["showStructure"] ); |
| 215 | + unset( $ops["autowikify"] ); |
| 216 | + unset( $ops["viewFrames"] ); |
| 217 | + unset( $ops["textTableBackground"] ); |
| 218 | + unset( $ops["text"] ); |
| 219 | + unset( $ops["background"] ); |
| 220 | + unset( $ops["forceQuickbar"] ); |
| 221 | + unset( $ops["tabLine0"] ); |
| 222 | + unset( $ops["tabLine1"] ); |
| 223 | + unset( $ops["tabLine2"] ); |
185 | 224 | |
186 | | -function strencode( $s ) |
187 | | -{ |
188 | | - $s = str_replace( "\\", "\\\\", $s ); |
189 | | - $s = str_replace( "\r", "\\r", $s ); |
190 | | - $s = str_replace( "\n", "\\n", $s ); |
191 | | - $s = str_replace( "\"", "\\\"", $s ); |
192 | | - $s = str_replace( "'", "\\'", $s ); |
193 | | - $s = str_replace( "\0", "\\0", $s ); |
194 | | - return $s; |
| 225 | + if ( $ops["changesLayout"] == "classic" ) { |
| 226 | + $ops["changesLayout"] = 1; |
| 227 | + } else { |
| 228 | + unset( $ops["changesLayout"] ); |
| 229 | + } |
| 230 | + $q = strtolower( $ops["quickBar"] ); |
| 231 | + if ( $q == "none" ) { $q = 0; } |
| 232 | + else if ( $q == "left" ) { $q = 1; } |
| 233 | + else { $q = 2; } |
| 234 | + $ops["quickBar"] = $q; |
| 235 | + |
| 236 | + if ( $ops["markupNewTopics"] == "inverse" ) { |
| 237 | + $ops["markupNewTopics"] = 1; |
| 238 | + } else { |
| 239 | + unset( $ops["markupNewTopics"] ); |
| 240 | + } |
| 241 | + $sk = substr( strtolower( $ops["skin"] ), 0, 4 ); |
| 242 | + if ( "star" == $sk ) { $sk = 1; } |
| 243 | + else if ( "nost" == $sk ) { $sk = 2; } |
| 244 | + else if ( "colo" == $sk ) { $sk = 3; } |
| 245 | + else { $sk = 0; } |
| 246 | + $ops["skin"] = $sk; |
| 247 | + |
| 248 | + $toggles = array( "underlineLinks", "justify", |
| 249 | + "numberHeadings", "hideMinor", "rememberPassword", |
| 250 | + "showHover" ); |
| 251 | + |
| 252 | + foreach ( $toggles as $op ) { |
| 253 | + $lop = strtolower( $op ); |
| 254 | + if ( ( "yes" == $lop ) || ( "on" == $lop ) ) { |
| 255 | + $ops[$op] = 1; |
| 256 | + } else { |
| 257 | + unset( $ops[$op] ); |
| 258 | + } |
| 259 | + } |
| 260 | + $a = array(); |
| 261 | + |
| 262 | + foreach ( $ops as $oname => $oval ) { |
| 263 | + array_push( $a, "$oname=$oval" ); |
| 264 | + } |
| 265 | + $s = implode( "\n", $a ); |
| 266 | + return urlencode( $s ); |
195 | 267 | } |
196 | 268 | |
197 | 269 | ?> |
Index: trunk/phpwiki/newcodebase/SpecialProtectpage.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "protectpage" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Protect page)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialRandompage.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "randompage" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Random page)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/Language.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | /* private */ $wgUserTogglesEn = array( |
18 | 18 | "showHover" => "Show hoverbox over wiki links", |
19 | 19 | "underlineLinks" => "Underline links", |
20 | | - "markupNewTopics" => "Show links to empty topics in red", |
| 20 | + "markupNewTopics" => "Highlight links to empty topics", |
21 | 21 | "justify" => "Justify paragraphs", |
22 | 22 | "hideMinor" => "Hide minor edits in recent changes", |
23 | 23 | "numberHeadings" => "Auto-number headings", |
— | — | @@ -354,6 +354,6 @@ |
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | | -include_once( "./Language" . ucfirst( $wgLanguageCode ) . ".php" ); |
| 358 | +include_once( "Language" . ucfirst( $wgLanguageCode ) . ".php" ); |
359 | 359 | |
360 | 360 | ?> |
Index: trunk/phpwiki/newcodebase/SpecialBlockip.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "blockip" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Block IP)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialAllpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "allpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: All pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/OutputPage.php |
— | — | @@ -105,6 +105,7 @@ |
106 | 106 | $this->setHTMLTitle( wfMsg( "errorpagetitle" ) ); |
107 | 107 | $this->setPageTitle( wfMsg( $title ) ); |
108 | 108 | $this->setRobotpolicy( "noindex,nofollow" ); |
| 109 | + $this->setArticleFlag( false ); |
109 | 110 | |
110 | 111 | $this->mBodytext = ""; |
111 | 112 | $this->addHTML( "<p>" . wfMsg( $msg ) . "\n" ); |
— | — | @@ -113,10 +114,10 @@ |
114 | 115 | |
115 | 116 | function databaseError( $op ) |
116 | 117 | { |
117 | | - $this->mDebugtext .= "MySQL: " . mysql_errno() . ": " . |
118 | | - mysql_error() . "\n"; |
| 118 | + wfDebug( "MySQL: " . mysql_errno() . ": " . mysql_error() . "\n" ); |
119 | 119 | $this->setPageTitle( wfMsg( "databaseerror" ) ); |
120 | 120 | $this->setRobotpolicy( "noindex,nofollow" ); |
| 121 | + $this->setArticleFlag( false ); |
121 | 122 | |
122 | 123 | $this->mBodytext = str_replace( "$1", $op, wfMsg( "dberrortext" ) ); |
123 | 124 | $this->returnToMain(); |
— | — | @@ -717,7 +718,7 @@ |
718 | 719 | } |
719 | 720 | $p = $this->mRobotpolicy; |
720 | 721 | if ( "" == $p ) { $p = "index,follow"; } |
721 | | - $ret .= "<meta name=\"robots\" content=\"$p\">"; |
| 722 | + $ret .= "<meta name=\"robots\" content=\"$p\">\n"; |
722 | 723 | |
723 | 724 | if ( count( $this->keywords ) > 0 ) { |
724 | 725 | $ret .= "<meta name=\"keywords\" content=\"" . |
Index: trunk/phpwiki/newcodebase/SpecialListusers.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "listusers" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: List users)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialAsksql.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "asksql" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Ask SQL)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialDeletepage.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "deletepage" ) ); |
9 | 8 | $wgOut->addHTML( "(TODO: Delete page)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/wiki.phtml |
— | — | @@ -4,15 +4,15 @@ |
5 | 5 | session_register( "wsUserName" ); |
6 | 6 | session_register( "wsUserPassword" ); |
7 | 7 | |
8 | | -include_once( "./LocalSettings.php" ); |
9 | | -include_once( "./GlobalFunctions.php" ); |
10 | | -include_once( "./InterText.php" ); |
11 | | -include_once( "./Namespace.php" ); |
12 | | -include_once( "./Skin.php" ); |
13 | | -include_once( "./OutputPage.php" ); |
14 | | -include_once( "./User.php" ); |
15 | | -include_once( "./Title.php" ); |
16 | | -include_once( "./Article.php" ); |
| 8 | +include_once( "LocalSettings.php" ); |
| 9 | +include_once( "GlobalFunctions.php" ); |
| 10 | +include_once( "Language.php" ); |
| 11 | +include_once( "Namespace.php" ); |
| 12 | +include_once( "Skin.php" ); |
| 13 | +include_once( "OutputPage.php" ); |
| 14 | +include_once( "User.php" ); |
| 15 | +include_once( "Title.php" ); |
| 16 | +include_once( "Article.php" ); |
17 | 17 | |
18 | 18 | global $action, $title, $search, $target; |
19 | 19 | global $target, $returnto; |
Index: trunk/phpwiki/newcodebase/SpecialPreferences.php |
— | — | @@ -86,6 +86,7 @@ |
87 | 87 | global $wpRows, $wpCols, $wpSaveprefs, $wpReset; |
88 | 88 | |
89 | 89 | $wgOut->setPageTitle( wfMsg( "preferences" ) ); |
| 90 | + $wgOut->setArticleFlag( false ); |
90 | 91 | |
91 | 92 | wfDebug( "Prefs: err=\"$err\"\n" ); |
92 | 93 | if ( "" != $err ) { |
Index: trunk/phpwiki/newcodebase/SpecialWantedpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "wantedpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Wanted pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialWatchlist.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "watchlist" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Watch list)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialUserlogin.php |
— | — | @@ -121,6 +121,7 @@ |
122 | 122 | |
123 | 123 | $wgOut->setPageTitle( wfMsg( "loginsuccesstitle" ) ); |
124 | 124 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
| 125 | + $wgOut->setArticleFlag( false ); |
125 | 126 | $wgOut->addHTML( $msg . "\n<p>" ); |
126 | 127 | $wgOut->returnToMain(); |
127 | 128 | } |
— | — | @@ -162,6 +163,7 @@ |
163 | 164 | } |
164 | 165 | $wgOut->setPageTitle( wfMsg( "userlogin" ) ); |
165 | 166 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
| 167 | + $wgOut->setArticleFlag( false ); |
166 | 168 | |
167 | 169 | if ( "" == $err ) { |
168 | 170 | $wgOut->addHTML( "<h2>$li:</h2>\n" ); |
Index: trunk/phpwiki/newcodebase/SpecialWhatlinkshere.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "whatlinkshere" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: What links here)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialNewpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "newpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: New pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialRecentchanges.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "recentchanges" ) ); |
9 | 8 | $wgOut->addWikiText( wfMsg( "recentchangestext" ) ); |
10 | 9 | |
11 | 10 | $wgOut->addHTML( "<p>(TODO: Recent changes list)\n" ); |
Index: trunk/phpwiki/newcodebase/LocalSettings.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | # For local site-specific settings. This should be the |
4 | 4 | # only thing you need to configure to install the software. |
5 | 5 | |
6 | | -include_once( "./DefaultSettings.php" ); |
| 6 | +include_once( "DefaultSettings.php" ); |
7 | 7 | |
8 | 8 | # URLs for the wiki site |
9 | 9 | # |
Index: trunk/phpwiki/newcodebase/SpecialVote.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "vote" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Vote)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialLongpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "longpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Long pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialShortpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "shortpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Short pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialLonelypages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "lonelypages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Orphaned pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/Article.php |
— | — | @@ -4,8 +4,8 @@ |
5 | 5 | class Article { |
6 | 6 | /* private */ var $mTitle; # WikiTitle object |
7 | 7 | /* private */ var $mContent, $mContentLoaded; |
8 | | - /* private */ var $mUser, $mTimestamp, $mParams; |
9 | | - /* private */ var $mCounter, $mComment, $mOldversion; |
| 8 | + /* private */ var $mUser, $mTimestamp; |
| 9 | + /* private */ var $mCounter, $mComment, $mRevision; |
10 | 10 | /* private */ var $mMinorEdit; |
11 | 11 | |
12 | 12 | function Article( $t ) |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | $this->mContentLoaded = false; |
16 | 16 | $this->mUser = $this->mCounter = -1; # Not loaded |
17 | 17 | $this->mTimestamp = $this->mComment = ""; |
18 | | - $this->mOldversion = 0; |
| 18 | + $this->mRevision = 0; |
19 | 19 | } |
20 | 20 | |
21 | 21 | function getContent() |
— | — | @@ -35,8 +35,8 @@ |
36 | 36 | if ( 0 == $id ) return; |
37 | 37 | |
38 | 38 | $conn = wfGetDB(); |
39 | | - $sql = "SELECT cur_text,cur_timestamp,cur_user,cur_counter, " . |
40 | | - "cur_params FROM cur WHERE cur_id=$id"; |
| 39 | + $sql = "SELECT cur_text,cur_timestamp,cur_user,cur_counter " . |
| 40 | + "FROM cur WHERE cur_id=$id"; |
41 | 41 | wfDebug( "Art: 1: $sql\n" ); |
42 | 42 | $res = mysql_query( $sql, $conn ); |
43 | 43 | |
— | — | @@ -47,7 +47,6 @@ |
48 | 48 | $this->mContent = $s->cur_text; |
49 | 49 | $this->mUser = $s->cur_user; |
50 | 50 | $this->mCounter = $s->cur_counter; |
51 | | - $this->mParams = $s->cur_params; |
52 | 51 | $this->mTimestamp = $s->cur_timestamp; |
53 | 52 | } |
54 | 53 | mysql_free_result( $res ); |
— | — | @@ -70,7 +69,7 @@ |
71 | 70 | if ( -1 != $this->mUser ) return; |
72 | 71 | |
73 | 72 | $conn = wfGetDB(); |
74 | | - $sql = "SELECT cur_user,cur_timestamp,cur_old_version," . |
| 73 | + $sql = "SELECT cur_user,cur_timestamp,cur_revision," . |
75 | 74 | "cur_comment,cur_minor_edit FROM cur WHERE " . |
76 | 75 | "cur_id=" . $this->getID(); |
77 | 76 | wfDebug( "Art: 3: $sql\n" ); |
— | — | @@ -81,7 +80,7 @@ |
82 | 81 | $this->mUser = $s->cur_user; |
83 | 82 | $this->mTimestamp = $s->cur_timestamp; |
84 | 83 | $this->mComment = $s->cur_comment; |
85 | | - $this->mOldversion = $s->cur_old_version; |
| 84 | + $this->mRevision = $s->cur_revision; |
86 | 85 | $this->mMinorEdit = $s->cur_minor_edit; |
87 | 86 | } |
88 | 87 | } |
— | — | @@ -241,12 +240,13 @@ |
242 | 241 | |
243 | 242 | $conn = wfGetDB(); |
244 | 243 | $sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text," . |
245 | | - "cur_comment,cur_user,cur_timestamp,cur_minor_edit," . |
246 | | - "cur_old_version,cur_counter) VALUES ('" . |
247 | | - $this->mTitle->getNamespace() . "', '" . |
| 244 | + "cur_comment,cur_user,cur_timestamp,cur_minor_edit,cur_counter," . |
| 245 | + "cur_restrictions,cur_revision,cur_ind_title) VALUES (" . |
| 246 | + $this->mTitle->getNamespace() . ", '" . |
248 | 247 | $this->mTitle->getDBKey() . "', '" . |
249 | 248 | wfStrencode( $text ) . "', '" . wfStrencode( $summary ) . "', '" . |
250 | | - $wgUser->getID() . "', '" . date( "YmdHis" ) . "', 0, 0, 0)"; |
| 249 | + $wgUser->getID() . "', '" . date( "YmdHis" ) . "', 0, 0, '', 0, '" . |
| 250 | + $this->mTitle->getPrefixedText() . "')"; |
251 | 251 | |
252 | 252 | wfDebug( "Art: 2: $sql\n" ); |
253 | 253 | $res = mysql_query( $sql, $conn ); |
— | — | @@ -268,13 +268,13 @@ |
269 | 269 | $this->loadLastEdit(); |
270 | 270 | $conn = wfGetDB(); |
271 | 271 | $sql = "INSERT INTO old (old_namespace,old_title,old_text," . |
272 | | - "old_comment,old_user,old_old_version,old_timestamp," . |
273 | | - "old_minor_edit) VALUES ('" . |
274 | | - $this->mTitle->getNamespace() . "', '" . |
| 272 | + "old_comment,old_user,old_revision,old_timestamp," . |
| 273 | + "old_minor_edit) VALUES (" . |
| 274 | + $this->mTitle->getNamespace() . ", '" . |
275 | 275 | $this->mTitle->getDBKey() . "', '" . |
276 | 276 | wfStrencode( $this->getContent() ) . "', '" . |
277 | 277 | wfStrencode( $this->mComment ) . "', " . |
278 | | - $this->mUser . ", " . $this->mOldversion . ", '" . |
| 278 | + $this->mUser . ", " . $this->mRevision . ", '" . |
279 | 279 | $this->mTimestamp . "', " . $me1 . ")"; |
280 | 280 | |
281 | 281 | wfDebug( "Art: 4: $sql\n" ); |
— | — | @@ -283,9 +283,9 @@ |
284 | 284 | $wgOut->databaseError( wfMsg( "updatingarticle" ) ); |
285 | 285 | return; |
286 | 286 | } |
287 | | - $cond = "(old_namespace='" . $this->mTitle->getNamespace() . |
288 | | - "' AND old_title='" . $this->mTitle->getDBKey() . |
289 | | - "' AND old_old_version={$this->mOldversion})"; |
| 287 | + $cond = "(old_namespace=" . $this->mTitle->getNamespace() . |
| 288 | + " AND old_title='" . $this->mTitle->getDBKey() . |
| 289 | + "' AND old_revision={$this->mRevision})"; |
290 | 290 | $newid = wfGetSQL( "old", "old_id", $cond ); |
291 | 291 | if ( 0 == $newid ) { |
292 | 292 | $wgOut->databaseError( wfMsg( "updatingarticle" ) ); |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | "',cur_comment='" . wfStrencode( $summary ) . |
298 | 298 | "',cur_minor_edit={$me2}, cur_user=" . $wgUser->getID() . |
299 | 299 | ", cur_timestamp='" . date( "YmdHis" ) . |
300 | | - "',cur_old_version=$newid " . |
| 300 | + "',cur_revision=$newid " . |
301 | 301 | "WHERE cur_id=" . $this->getID(); |
302 | 302 | |
303 | 303 | wfDebug( "Art: 5: $sql\n" ); |
— | — | @@ -360,6 +360,8 @@ |
361 | 361 | |
362 | 362 | $wgOut->setPageTitle( wfMsg( "blockedtitle" ) ); |
363 | 363 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
| 364 | + $wgOut->setArticleFlag( false ); |
| 365 | + |
364 | 366 | $id = $wgUser->blockedBy(); |
365 | 367 | $reason = $wgUser->blockedFor(); |
366 | 368 | |
— | — | @@ -378,6 +380,8 @@ |
379 | 381 | |
380 | 382 | $wgOut->setPageTitle( wfMsg( "readonly" ) ); |
381 | 383 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
| 384 | + $wgOut->setArticleFlag( false ); |
| 385 | + |
382 | 386 | $wgOut->addWikiText( wfMsg( "readonlytext" ) ); |
383 | 387 | $wgOut->returnToMain(); |
384 | 388 | } |
Index: trunk/phpwiki/newcodebase/SpecialUpload.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "upload" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Upload)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialSqldump.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "sqldup" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: SQL dump)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialDebug.php |
— | — | @@ -4,8 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( "Debug" ); |
9 | | - |
10 | 8 | $wgOut->addWikiText( " |
11 | 9 | |
12 | 10 | == Heading == |
Index: trunk/phpwiki/newcodebase/GlobalFunctions.php |
— | — | @@ -26,8 +26,8 @@ |
27 | 27 | $wgTotalViews = -1; |
28 | 28 | $wgTotalEdits = -1; |
29 | 29 | |
30 | | -include_once( "./DatabaseFunctions.php" ); |
31 | | -include_once( "./UpdateClasses.php" ); |
| 30 | +include_once( "DatabaseFunctions.php" ); |
| 31 | +include_once( "UpdateClasses.php" ); |
32 | 32 | |
33 | 33 | function wfLocalLink( $a ) |
34 | 34 | { |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | global $wgValidSpecialPages, $wgSysopSpecialPages; |
89 | 89 | |
90 | 90 | $wgOut->setArticleFlag( false ); |
91 | | - $wgOut->setPageTitle( $wgTitle->getText() ); |
| 91 | + $wgOut->setPageTitle( wfMsg( strtolower( $wgTitle->getText() ) ) ); |
92 | 92 | |
93 | 93 | $t = $wgTitle->getDBKey(); |
94 | 94 | if ( in_array( $t, $wgValidSpecialPages ) || |
Index: trunk/phpwiki/newcodebase/SpecialStatistics.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "statistics" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Statistics)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/Namespace.php |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +<? |
| 3 | +# This is a utility class with only static functions |
| 4 | +# for dealing with namespaces. Everything is hardcoded, |
| 5 | +# and will have to be internationalized. |
| 6 | +# |
| 7 | +# Note "Special" is treated, well, specially, and doesn't |
| 8 | +# really fit into the system--it has to be tested for |
| 9 | +# independently. |
| 10 | +# |
| 11 | +$wgNamespaceNamesEn = array( |
| 12 | + 0 => "", 1 => "Talk", 2 => "User", 3 => "User_talk", |
| 13 | + 4 => "Wikipedia", 5 => "Wikipedia_talk" |
| 14 | +); |
| 15 | + |
| 16 | +class Namespace { |
| 17 | + |
| 18 | + function getName( $index ) |
| 19 | + { |
| 20 | + global $wgNamespaceNamesEn; |
| 21 | + if ( -1 == $index ) { return "Special"; } |
| 22 | + else { return $wgNamespaceNamesEn[$index]; } |
| 23 | + } |
| 24 | + |
| 25 | + function getIndex( $name ) |
| 26 | + { |
| 27 | + global $wgNamespaceNamesEn; |
| 28 | + |
| 29 | + foreach ( $wgNamespaceNamesEn as $i => $n ) { |
| 30 | + if ( 0 == strcmp( $n, $name ) ) { |
| 31 | + return $i; |
| 32 | + } |
| 33 | + } |
| 34 | + return -1; |
| 35 | + } |
| 36 | + |
| 37 | + function isTalk( $index ) |
| 38 | + { |
| 39 | + if ( 1 == $index || 3 == $index || 5 == $index ) { |
| 40 | + return true; |
| 41 | + } |
| 42 | + return false; |
| 43 | + } |
| 44 | + |
| 45 | + # Get the talk namespace corresponding to the given index |
| 46 | + # |
| 47 | + function getTalk( $index ) |
| 48 | + { |
| 49 | + if ( Namespace::isTalk( $index ) ) { |
| 50 | + return $index; |
| 51 | + } else { |
| 52 | + return $index + 1; |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + function getSubject( $index ) |
| 57 | + { |
| 58 | + if ( Namespace::isTalk( $index ) ) { |
| 59 | + return $index - 1; |
| 60 | + } else { |
| 61 | + return $index; |
| 62 | + } |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +?> |
Property changes on: trunk/phpwiki/newcodebase/Namespace.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 67 | + native |
Added: svn:keywords |
2 | 68 | + Author Date Id Revision |
Index: trunk/phpwiki/newcodebase/UpdateClasses.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <? |
3 | 3 | # See deferred.doc |
4 | 4 | |
5 | | -include_once( "./UserUpdate.php" ); |
6 | | -include_once( "./ViewCountUpdate.php" ); |
7 | | -include_once( "./SiteStatsUpdate.php" ); |
| 5 | +include_once( "UserUpdate.php" ); |
| 6 | +include_once( "ViewCountUpdate.php" ); |
| 7 | +include_once( "SiteStatsUpdate.php" ); |
8 | 8 | |
9 | 9 | ?> |
Index: trunk/phpwiki/newcodebase/SpecialRecentchangeslinked.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "recentchangeslinked" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Recent changes linked)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialSpecialpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "specialpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Special pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/docs/language.doc |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +LANGUAGE.DOC |
| 3 | + |
| 4 | +THe Language object handles all readable text produced by the |
| 5 | +software. The most used function is getMessage(), usually |
| 6 | +called with the wrapper function wfMsg() which calls that method |
| 7 | +on the global language object. It just returns a piece of text |
| 8 | +given a text key. It is recommended that you use each key only |
| 9 | +once--bits of text in different contexts that happen to be |
| 10 | +identical in English may not be in other languages, so it's |
| 11 | +better to add new keys than to reuse them a lot. Likewise, |
| 12 | +if there is text that gets combined with things like names and |
| 13 | +titles, it is better to put markers like "$1" inside a piece |
| 14 | +of text and use str_replace() than to compose such messages in |
| 15 | +code. |
| 16 | + |
| 17 | +While the system is running, there will be one global language |
| 18 | +object, which will be a subtype of Language. The methods in |
| 19 | +these objects will return the native text requested if available, |
| 20 | +otherwise they fall back to sending English text (which is why |
| 21 | +the LanguageEn object has no code at all--it just inherits the |
| 22 | +English defaults of the Language base class. |
| 23 | + |
Property changes on: trunk/phpwiki/newcodebase/docs/language.doc |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Added: svn:keywords |
2 | 25 | + Author Date Id Revision |
Index: trunk/phpwiki/newcodebase/SpecialPopularpages.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "popularpages" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Popular pages)" ); |
10 | 9 | } |
11 | 10 | |
Index: trunk/phpwiki/newcodebase/SpecialContributions.php |
— | — | @@ -4,7 +4,6 @@ |
5 | 5 | { |
6 | 6 | global $wgUser, $wgOut; |
7 | 7 | |
8 | | - $wgOut->setPageTitle( wfMsg( "contributions" ) ); |
9 | 8 | $wgOut->addHTML( "<p>(TODO: Contributions)" ); |
10 | 9 | } |
11 | 10 | |