From 07b4831ca3add94d5919f555238c0eeceeab63d8 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 8 Dec 2012 12:09:15 +0100 Subject: [PATCH] Use MWNamespace method instead of binary arithmetic "& ~1" or "| 1" are not easy to read Change-Id: I08ff92669d32f3663ea58e98d8c49f0a54dfeca4 --- includes/Title.php | 4 ++-- includes/specials/SpecialEditWatchlist.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 6cd8ee583d..3b586c5edb 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3695,8 +3695,8 @@ class Title { } # Update watchlists - $oldnamespace = $this->getNamespace() & ~1; - $newnamespace = $nt->getNamespace() & ~1; + $oldnamespace = MWNamespace::getSubject( $this->getNamespace() ); + $newnamespace = MWNamespace::getSubject( $nt->getNamespace() ); $oldtitle = $this->getDBkey(); $newtitle = $nt->getDBkey(); diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 23cd9aa679..eca62f2e87 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -393,13 +393,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { if( $title instanceof Title ) { $rows[] = array( 'wl_user' => $this->getUser()->getId(), - 'wl_namespace' => ( $title->getNamespace() & ~1 ), + 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ), 'wl_title' => $title->getDBkey(), 'wl_notificationtimestamp' => null, ); $rows[] = array( 'wl_user' => $this->getUser()->getId(), - 'wl_namespace' => ( $title->getNamespace() | 1 ), + 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ), 'wl_title' => $title->getDBkey(), 'wl_notificationtimestamp' => null, ); @@ -427,7 +427,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlist', array( 'wl_user' => $this->getUser()->getId(), - 'wl_namespace' => ( $title->getNamespace() & ~1 ), + 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ), 'wl_title' => $title->getDBkey(), ), __METHOD__ @@ -436,7 +436,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlist', array( 'wl_user' => $this->getUser()->getId(), - 'wl_namespace' => ( $title->getNamespace() | 1 ), + 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ), 'wl_title' => $title->getDBkey(), ), __METHOD__ -- 2.20.1