Noticed while looking at $wgShowUpdatedMarker related database queries, queries not...
authorReedy <reedy@wikimedia.org>
Fri, 27 Apr 2012 23:59:59 +0000 (00:59 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 27 Apr 2012 23:59:59 +0000 (00:59 +0100)
Title.php at line 4313:
array( 'wl_namespace' => $this->getNamespace(),
'wl_title' => $this->getDBkey(),
'wl_user' => $user->getId()
),

In UserMailer.php at line 438:

array(
'wl_title' => $title->getDBkey(),
'wl_namespace' => $title->getNamespace(),
'wl_user != ' . intval( $editor->getID() ),
'wl_notificationtimestamp IS NULL',
)

And line 455:

array( /* WHERE */
'wl_title' => $title->getDBkey(),
'wl_namespace' => $title->getNamespace(),
'wl_user' => $watchers
)

CREATE TABLE /*_*/watchlist (
  -- Key to user.user_id
  wl_user int unsigned NOT NULL,

  -- Key to page_namespace/page_title
  -- Note that users may watch pages which do not exist yet,
  -- or existed in the past but have been deleted.
  wl_namespace int NOT NULL default 0,
  wl_title varchar(255) binary NOT NULL default '',

  -- Timestamp when user was last sent a notification e-mail;
  -- cleared when the user visits the page.
  wl_notificationtimestamp varbinary(14)

) /*$wgDBTableOptions*/;

CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);

Change-Id: I633c009b4a1c614b966c69f042f94c2056e03784

includes/Title.php
includes/UserMailer.php

index 6764f8f..1c5c832 100644 (file)
@@ -4310,9 +4310,10 @@ class Title {
                $dbr = wfGetDB( DB_SLAVE );
                $this->mNotificationTimestamp[$uid] = $dbr->selectField( 'watchlist',
                        'wl_notificationtimestamp',
-                       array( 'wl_namespace' => $this->getNamespace(),
+                       array(
+                               'wl_user' => $user->getId(),
+                               'wl_namespace' => $this->getNamespace(),
                                'wl_title' => $this->getDBkey(),
-                               'wl_user' => $user->getId()
                        ),
                        __METHOD__
                );
index e0b8d01..36da6fb 100644 (file)
@@ -436,9 +436,9 @@ class EmailNotification {
                        $res = $dbw->select( array( 'watchlist' ),
                                array( 'wl_user' ),
                                array(
-                                       'wl_title' => $title->getDBkey(),
-                                       'wl_namespace' => $title->getNamespace(),
                                        'wl_user != ' . intval( $editor->getID() ),
+                                       'wl_namespace' => $title->getNamespace(),
+                                       'wl_title' => $title->getDBkey(),
                                        'wl_notificationtimestamp IS NULL',
                                ), __METHOD__
                        );
@@ -453,9 +453,9 @@ class EmailNotification {
                                        array( /* SET */
                                                'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
                                        ), array( /* WHERE */
-                                               'wl_title' => $title->getDBkey(),
+                                               'wl_user' => $watchers,
                                                'wl_namespace' => $title->getNamespace(),
-                                               'wl_user' => $watchers
+                                               'wl_title' => $title->getDBkey(),
                                        ), __METHOD__
                                );
                                $dbw->commit( __METHOD__ );