$dbr = wfGetDB( DB_MASTER );
$res = $dbr->select(
'watchlist',
- '*',
array(
+ 'wl_namespace', 'wl_title'
+ ), array(
'wl_user' => $this->getUser()->getId(),
),
__METHOD__
* Attempts to clean up broken items
*/
private function cleanupWatchlist() {
+ if( !count( $this->badItems ) ) {
+ return; //nothing to do
+ }
$dbw = wfGetDB( DB_MASTER );
+ $user = $this->getUser();
foreach ( $this->badItems as $row ) {
list( $title, $namespace, $dbKey ) = $row;
- wfDebug( "User {$this->getUser()} has broken watchlist item ns($namespace):$dbKey, "
+ wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, "
. ( $title ? 'cleaning up' : 'deleting' ) . ".\n"
);
$dbw->delete( 'watchlist',
array(
- 'wl_user' => $this->getUser()->getId(),
+ 'wl_user' => $user->getId(),
'wl_namespace' => $namespace,
'wl_title' => $dbKey,
),
// Can't just do an UPDATE instead of DELETE/INSERT due to unique index
if ( $title ) {
- $this->getUser()->addWatch( $title );
+ $user->addWatch( $title );
}
}
}