+
+ $this->output( "{$this->totalPages} pages to fix, " .
+ "{$this->resolvablePages} were resolvable.\n\n" );
+
+ foreach ( $spaces as $name => $ns ) {
+ if ( $ns != 0 ) {
+ /* Fix up link destinations for non-interwiki links only.
+ *
+ * For example if a page has [[Foo:Bar]] and then a Foo namespace
+ * is introduced, pagelinks needs to be updated to have
+ * page_namespace = NS_FOO.
+ *
+ * If instead an interwiki prefix was introduced called "Foo",
+ * the link should instead be moved to the iwlinks table. If a new
+ * language is introduced called "Foo", or if there is a pagelink
+ * [[fr:Bar]] when interlanguage magic links are turned on, the
+ * link would have to be moved to the langlinks table. Let's put
+ * those cases in the too-hard basket for now. The consequences are
+ * not especially severe.
+ * @fixme Handle interwiki links, and pagelinks to Category:, File:
+ * which probably need reparsing.
+ */
+
+ $this->checkLinkTable( 'pagelinks', 'pl', $ns, $name, $options );
+ $this->checkLinkTable( 'templatelinks', 'tl', $ns, $name, $options );
+
+ // The redirect table has interwiki links randomly mixed in, we
+ // need to filter those out. For example [[w:Foo:Bar]] would
+ // have rd_interwiki=w and rd_namespace=0, which would match the
+ // query for a conflicting namespace "Foo" if filtering wasn't done.
+ $this->checkLinkTable( 'redirect', 'rd', $ns, $name, $options,
+ [ 'rd_interwiki' => null ] );
+ $this->checkLinkTable( 'redirect', 'rd', $ns, $name, $options,
+ [ 'rd_interwiki' => '' ] );
+ }
+ }
+
+ $this->output( "{$this->totalLinks} links to fix, " .
+ "{$this->resolvableLinks} were resolvable.\n" );
+