) 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.
}
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() {
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();