Use MWNamespace method instead of binary arithmetic
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 8 Dec 2012 11:09:15 +0000 (12:09 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 8 Dec 2012 11:09:15 +0000 (12:09 +0100)
"& ~1" or "| 1" are not easy to read

Change-Id: I08ff92669d32f3663ea58e98d8c49f0a54dfeca4

includes/Title.php
includes/specials/SpecialEditWatchlist.php

index 6cd8ee5..3b586c5 100644 (file)
@@ -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();
 
index 23cd9aa..eca62f2 100644 (file)
@@ -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__