X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2Fupdaters.inc;h=78bfbfaf9b4c31568a471dc96473f8df752e7aa5;hb=8f61d0007ecb7c043763224d8259e1579a058e64;hp=8ed663be0c8b666aab161b21d95acf0022c5c640;hpb=e3d0c474a83c3548aa6763561826f71c12a55fe6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 8ed663be0c..78bfbfaf9b 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1,4 +1,55 @@ tableExists( $name ) ) { + echo "...$name table already exists.\n"; + } else { + echo "Creating $name table..."; + dbsource( "maintenance/archives/$patch", $wgDatabase ); + echo "ok\n"; + } +} + +function add_field( $table, $field, $patch ) { + global $wgDatabase; + if ( $wgDatabase->fieldExists( $table, $field ) ) { + echo "...have $field field in $table table.\n"; + } else { + echo "Adding $field field to table $table..."; + dbsource( "maintenance/archives/$patch" , $wgDatabase ); + echo "ok\n"; + } +} function do_revision_updates() { global $wgSoftwareRevision; @@ -33,34 +84,6 @@ function update_passwords() { } } -function do_ipblocks_update() { - global $wgDatabase; - - $do1 = $do2 = false; - - if ( !$wgDatabase->fieldExists( "ipblocks", "ipb_id" ) ) { - $do1 = true; - } - if ( !$wgDatabase->fieldExists( "ipblocks", "ipb_expiry" ) ) { - $do2 = true; - } - - if ( $do1 || $do2 ) { - echo "Updating ipblocks table... "; - if ( $do1 ) { - dbsource( "maintenance/archives/patch-ipblocks.sql", $wgDatabase ); - } - if ( $do2 ) { - dbsource( "maintenance/archives/patch-ipb_expiry.sql", $wgDatabase ); - } - echo "ok\n"; - } else { - echo "...ipblocks is up to date.\n"; - } - -} - - function do_interwiki_update() { # Check that interwiki table exists; if it doesn't source it global $wgDatabase; @@ -90,18 +113,6 @@ function do_index_update() { return false; } -function do_linkscc_update() { - // Create linkscc if necessary - global $wgDatabase; - if( $wgDatabase->tableExists( "linkscc" ) ) { - echo "...have linkscc table.\n"; - } else { - echo "Adding linkscc table... "; - dbsource( "maintenance/archives/patch-linkscc.sql", $wgDatabase ); - echo "ok\n"; - } -} - function do_linkscc_1_3_update() { // Update linkscc table to 1.3 schema if necessary global $wgDatabase, $wgVersion; @@ -115,73 +126,15 @@ function do_linkscc_1_3_update() { } } -function do_hitcounter_update() { - // Create hitcounter if necessary +function do_image_name_unique_update() { global $wgDatabase; - if( $wgDatabase->tableExists( "hitcounter" ) ) { - echo "...have hitcounter table.\n"; + if ( $wgDatabase->indexUnique( 'image', 'img_name' ) ) { + echo "...img_name already unique.\n"; } else { - echo "Adding hitcounter table... "; - dbsource( "maintenance/archives/patch-hitcounter.sql", $wgDatabase ); + echo "Making the img_name index unique... "; + dbsource( "maintenance/archives/patch-image_name_unique.sql", $wgDatabase ); echo "ok\n"; } } -function do_recentchanges_update() { - global $wgDatabase; - if ( !$wgDatabase->fieldExists( "recentchanges", "rc_type" ) ) { - echo "Adding rc_type, rc_moved_to_ns, rc_moved_to_title..."; - dbsource( "maintenance/archives/patch-rc_type.sql" , $wgDatabase ); - echo "ok\n"; - } - if ( !$wgDatabase->fieldExists( "recentchanges", "rc_ip" ) ) { - echo "Adding rc_ip..."; - dbsource( "maintenance/archives/patch-rc_ip.sql", $wgDatabase ); - echo "ok\n"; - } -} - -function do_user_real_name_update() { - global $wgDatabase; - if ( $wgDatabase->fieldExists( "user", "user_real_name" ) ) { - echo "...have user_real_name field in user table.\n"; - } else { - echo "Adding user_real_name field to table user..."; - dbsource( "maintenance/archives/patch-user-realname.sql" , $wgDatabase ); - echo "ok\n"; - } -} - -function do_querycache_update() { - global $wgDatabase; - if( $wgDatabase->tableExists( "querycache" ) ) { - echo "...have special page querycache table.\n"; - } else { - echo "Adding querycache table for slow special pages... "; - dbsource( "maintenance/archives/patch-querycache.sql", $wgDatabase ); - echo "ok\n"; - } -} - -function do_objectcache_update() { - global $wgDatabase; - if( $wgDatabase->tableExists( "objectcache" ) ) { - echo "...have objectcache table.\n"; - } else { - echo "Adding objectcache table for message caching... "; - dbsource( "maintenance/archives/patch-objectcache.sql", $wgDatabase ); - echo "ok\n"; - } -} - -function do_categorylinks_update() { - global $wgDatabase; - if( $wgDatabase->tableExists( "categorylinks" ) ) { - echo "...have categorylinks table.\n"; - } else { - echo "Adding categorylinks table for category management... "; - dbsource( "maintenance/archives/patch-categorylinks.sql", $wgDatabase ); - echo "ok\n"; - } -} ?>