} else {
$retval = $this->checkAll( $fix, $suffix );
}
-
+
if ( $retval ) {
$this->output( "\nLooks good!\n" );
} else {
private function checkAll( $fix, $suffix = '' ) {
global $wgContLang, $wgNamespaceAliases, $wgCanonicalNamespaceNames;
global $wgCapitalLinks;
-
+
$spaces = array();
-
+
// List interwikis first, so they'll be overridden
// by any conflicting local namespaces.
foreach ( $this->getInterwikiList() as $prefix ) {
foreach ( $wgContLang->getNamespaceAliases() as $name => $ns ) {
$spaces[$name] = $ns;
}
-
+
// We'll need to check for lowercase keys as well,
// since we're doing case-sensitive searches in the db.
foreach ( $spaces as $name => $ns ) {
}
}
}
-
+
ksort( $spaces );
asort( $spaces );
-
+
$ok = true;
foreach ( $spaces as $name => $ns ) {
$ok = $this->checkNamespace( $ns, $name, $fix, $suffix ) && $ok;
}
return $ok;
}
-
+
/**
* @todo: do this for reals
*/
// An interwiki; try an alternate encoding with '-' for ':'
$titleSql = $this->db->buildConcat( array( "'$prefix-'", $titleSql ) );
}
-
+
$sql = "SELECT {$page}_id AS id,
- {$page}_title AS oldtitle,
- $encNamespace + {$page}_namespace AS namespace,
- $titleSql AS title,
- {$page}_namespace AS oldnamespace
- FROM {$table}
- WHERE ( {$page}_namespace=0 OR {$page}_namespace=1 )
- AND {$page}_title " . $this->db->buildLike( $name . ':', $this->db->anyString() );
+ {$page}_title AS oldtitle,
+ $encNamespace + {$page}_namespace AS namespace,
+ $titleSql AS title,
+ {$page}_namespace AS oldnamespace
+ FROM {$table}
+ WHERE ( {$page}_namespace=0 OR {$page}_namespace=1 )
+ AND {$page}_title " . $this->db->buildLike( $name . ':', $this->db->anyString() );
$result = $this->db->query( $sql, __METHOD__ );