1 CREATE TABLE /*_*/imagelinks_tmp (
2 -- Key to page_id of the page containing the image / media link.
3 il_from
int unsigned
NOT NULL default 0,
4 -- Namespace for this page
5 il_from_namespace
int NOT NULL default 0,
7 -- Filename of target image.
8 -- This is also the page_title of the file's description page;
9 -- all such pages are in namespace 6 (NS_FILE).
10 il_to
varchar(255) binary NOT NULL default '',
11 PRIMARY KEY (il_from
,il_to
)
12 ) /*$wgDBTableOptions*/;
14 INSERT INTO /*_*/imagelinks_tmp
15 SELECT * FROM /*_*/imagelinks
;
17 DROP TABLE /*_*/imagelinks
;
19 ALTER TABLE /*_*/imagelinks_tmp
RENAME TO /*_*/imagelinks
;
21 -- Reverse index, for Special:Whatlinkshere and file description page local usage
22 CREATE INDEX /*i*/il_to
ON /*_*/imagelinks (il_to
,il_from
);
24 -- Index for Special:Whatlinkshere with namespace filter
25 CREATE INDEX /*i*/il_backlinks_namespace
ON /*_*/imagelinks (il_from_namespace
,il_to
,il_from
);