3 function do_revision_updates() {
4 global $wgSoftwareRevision;
5 if ( $wgSoftwareRevision < 1001 ) {
10 function update_passwords() {
12 $fname = "Update script: update_passwords()";
13 print "\nIt appears that you need to update the user passwords in your\n" .
14 "database. If you have already done this (if you've run this update\n" .
15 "script once before, for example), doing so again will make all your\n" .
16 "user accounts inaccessible, so be sure you only do this once.\n" .
17 "Update user passwords? (yes/no)";
19 $resp = readconsole();
20 if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; }
22 $sql = "SELECT user_id,user_password FROM user";
23 $source = $wgDatabase->query( $sql, $fname );
25 while ( $row = $wgDatabase->fetchObject( $source ) ) {
27 $oldpass = $row->user_password;
28 $newpass = md5( "{$id}-{$oldpass}" );
30 $sql = "UPDATE user SET user_password='{$newpass}' " .
31 "WHERE user_id={$id}";
32 $wgDatabase->query( $sql, $fname );
36 function do_ipblocks_update() {
41 if ( !$wgDatabase->fieldExists( "ipblocks", "ipb_id" ) ) {
44 if ( !$wgDatabase->fieldExists( "ipblocks", "ipb_expiry" ) ) {
49 echo "Updating ipblocks table... ";
51 dbsource( "maintenance/archives/patch-ipblocks.sql", $wgDatabase );
54 dbsource( "maintenance/archives/patch-ipb_expiry.sql", $wgDatabase );
58 echo "...ipblocks is up to date.\n";
64 function do_interwiki_update() {
65 # Check that interwiki table exists; if it doesn't source it
67 if( $wgDatabase->tableExists( "interwiki" ) ) {
68 echo "...already have interwiki table\n";
71 echo "Creating interwiki table: ";
72 dbsource( "maintenance/archives/patch-interwiki.sql" );
74 echo "Adding default interwiki definitions: ";
75 dbsource( "maintenance/interwiki.sql" );
79 function do_index_update() {
80 # Check that proper indexes are in place
82 $meta = $wgDatabase->fieldInfo( "recentchanges", "rc_timestamp" );
83 if( $meta->multiple_key == 0 ) {
84 echo "Updating indexes to 20031107: ";
85 dbsource( "maintenance/archives/patch-indexes.sql" );
89 echo "...indexes seem up to 20031107 standards\n";
93 function do_linkscc_update() {
94 // Create linkscc if necessary
96 if( $wgDatabase->tableExists( "linkscc" ) ) {
97 echo "...have linkscc table.\n";
99 echo "Adding linkscc table... ";
100 dbsource( "maintenance/archives/patch-linkscc.sql", $wgDatabase );
105 function do_hitcounter_update() {
106 // Create hitcounter if necessary
108 if( $wgDatabase->tableExists( "hitcounter" ) ) {
109 echo "...have hitcounter table.\n";
111 echo "Adding hitcounter table... ";
112 dbsource( "maintenance/archives/patch-hitcounter.sql", $wgDatabase );
117 function do_recentchanges_update() {
119 if ( !$wgDatabase->fieldExists( "recentchanges", "rc_type" ) ) {
120 echo "Adding rc_type, rc_moved_to_ns, rc_moved_to_title...";
121 dbsource( "maintenance/archives/patch-rc_type.sql" , $wgDatabase );
126 function do_user_real_name_update() {
128 if ( $wgDatabase->fieldExists( "user", "user_real_name" ) ) {
129 echo "...have user_real_name field in user table.\n";
131 echo "Adding user_real_name field to table user...";
132 dbsource( "maintenance/archives/patch-user-realname.sql" , $wgDatabase );
137 function do_querycache_update() {
139 if( $wgDatabase->tableExists( "querycache" ) ) {
140 echo "...have special page querycache table.\n";
142 echo "Adding querycache table for slow special pages... ";
143 dbsource( "maintenance/archives/patch-querycache.sql", $wgDatabase );
148 function do_objectcache_update() {
150 if( $wgDatabase->tableExists( "objectcache" ) ) {
151 echo "...have objectcache table.\n";
153 echo "Adding objectcache table for message caching... ";
154 dbsource( "maintenance/archives/patch-objectcache.sql", $wgDatabase );
159 function do_categorylinks_update() {
161 if( $wgDatabase->tableExists( "categorylinks" ) ) {
162 echo "...have categorylinks table.\n";
164 echo "Adding categorylinks table for category management... ";
165 dbsource( "maintenance/archives/patch-categorylinks.sql", $wgDatabase );