From e1292a9ee29699c30a736e03b740c115085552b1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 30 May 2005 09:34:01 +0000 Subject: [PATCH] Don't create links & brokenlinks on new installations; skip links table update if pagelinks already exists. --- maintenance/tables.sql | 39 --------------------------------------- maintenance/updaters.inc | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 00416f3741..8b73be61e1 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -329,45 +329,6 @@ CREATE TABLE /*$wgDBprefix*/archive ( ) TYPE=InnoDB; --- --- Track links within the wiki that do exist. --- These rows must be removed when the target page is --- deleted, and replaced with brokenlinks entries. --- They must also be updated if a target page is renamed. --- -CREATE TABLE /*$wgDBprefix*/links ( - -- Key to the page_id of the page containing the link. - l_from int(8) unsigned NOT NULL default '0', - - -- Key to the page_id of the link target. - -- An unfortunate consequence of this is that rename - -- operations require changing the links entries for - -- all links to the moved page. - l_to int(8) unsigned NOT NULL default '0', - - UNIQUE KEY l_from(l_from,l_to), - KEY (l_to) - -) TYPE=InnoDB; - --- --- Track links to pages that don't yet exist. --- These rows must be removed when the target page --- is created, and replaced with links table entries. --- -CREATE TABLE /*$wgDBprefix*/brokenlinks ( - -- Key to the page_id of the page containing the link. - bl_from int(8) unsigned NOT NULL default '0', - - -- Text of the target page title ("namesapce:title"). - -- Unfortunately this doesn't split the namespace index - -- key and therefore can't easily be joined to anything. - bl_to varchar(255) binary NOT NULL default '', - UNIQUE KEY bl_from(bl_from,bl_to), - KEY (bl_to) - -) TYPE=InnoDB; - -- -- Track page-to-page hyperlinks within the wiki. diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index b21de9eb57..c319c9c348 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -550,15 +550,24 @@ function do_pagelinks_namespace( $namespace ) { } function do_drop_img_type() { - global $wgDatabase; - - if ($wgDatabase->fieldExists('image', 'img_type')) { + global $wgDatabase; + + if( $wgDatabase->fieldExists( 'image', 'img_type' ) ) { echo "Dropping unused img_type field in image table... "; dbsource( "maintenance/archives/patch-drop_img_type.sql", $wgDatabase ); echo "ok\n"; } else { echo "No img_type field in image table; Good.\n"; - } + } +} + +function do_old_links_update() { + global $wgDatabase; + if( $wgDatabase->tableExists( 'pagelinks' ) ) { + echo "Already have pagelinks; skipping old links table updates.\n"; + } else { + convertLinks(); flush(); + } } function do_all_updates() { @@ -588,7 +597,7 @@ function do_all_updates() { do_interwiki_update(); flush(); do_index_update(); flush(); do_linkscc_1_3_update(); flush(); - convertLinks(); flush(); + do_old_links_update(); flush(); do_image_name_unique_update(); flush(); do_watchlist_update(); flush(); do_user_update(); flush(); -- 2.20.1