Do not load special pages in WatchedItem::load
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 27 Dec 2013 13:49:56 +0000 (14:49 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 12 Jan 2014 16:33:56 +0000 (16:33 +0000)
WatchedItem::load was looking for a special page in the database:
SELECT  wl_notificationtimestamp
  FROM `watchlist`
 WHERE wl_user = '1'
   AND wl_namespace = '-1'
   AND wl_title = 'Log'
 LIMIT 1
But it is known that such a page never will stay in the database,
so added a check to avoid the select.

Change-Id: I8c65328a32aa93c351ac476ce79d12d2835128f6

includes/WatchedItem.php

index d2fb468..fe97843 100644 (file)
@@ -113,6 +113,12 @@ class WatchedItem {
                        return;
                }
 
+               // some pages cannot be watched
+               if ( !$this->getTitle()->isWatchable() ) {
+                       $this->watched = false;
+                       return;
+               }
+
                # Pages and their talk pages are considered equivalent for watching;
                # remember that talk namespaces are numbered as page namespace+1.