// 1.24
array( 'addField', 'page_props', 'pp_sortkey', 'patch-pp_sortkey.sql' ),
+ array( 'dropField', 'recentchanges', 'rc_cur_time', 'patch-drop-rc_cur_time.sql' ),
+ array( 'addIndex', 'watchlist', 'wl_user_notificationtimestamp', 'patch-watchlist-user-notificationtimestamp-index.sql' ),
);
}
);
global $wgContLang;
- foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) {
+ foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
if ( $ns == 0 ) {
continue;
}
$this->output( "Cleaning up broken links for namespace $ns... " );
-
- $pagelinks = $this->db->tableName( 'pagelinks' );
- $name = $wgContLang->getNsText( $ns );
- $prefix = $this->db->strencode( $name );
- $likeprefix = str_replace( '_', '\\_', $prefix );
-
- $sql = "UPDATE $pagelinks
- SET pl_namespace=$ns,
- pl_title=TRIM(LEADING '$prefix:' FROM pl_title)
- WHERE pl_namespace=0
- AND pl_title LIKE '$likeprefix:%'";
-
- $this->db->query( $sql, __METHOD__ );
+ $this->db->update( 'pagelinks',
+ array(
+ 'pl_namespace' => $ns,
+ "pl_title = TRIM(LEADING {$this->db->addQuotes( "$name:" )} FROM pl_title)",
+ ),
+ array(
+ 'pl_namespace' => 0,
+ 'pl_title' . $this->db->buildLike( "$name:", $this->db->anyString() ),
+ ),
+ __METHOD__
+ );
$this->output( "done.\n" );
}
}