Merge "Fix typo in Release note"
[lhc/web/wiklou.git] / includes / WatchedItem.php
index d9a1e80..4d22692 100644 (file)
@@ -274,8 +274,7 @@ class WatchedItem {
         * @param WatchedItem[] $items
         * @return bool
         */
-       static public function batchAddWatch( array $items ) {
-               $section = new ProfileSection( __METHOD__ );
+       public static function batchAddWatch( array $items ) {
 
                if ( wfReadOnly() ) {
                        return false;
@@ -309,7 +308,7 @@ class WatchedItem {
                }
 
                $dbw = wfGetDB( DB_MASTER );
-               foreach( array_chunk( $rows, 100 ) as $toInsert ) {
+               foreach ( array_chunk( $rows, 100 ) as $toInsert ) {
                        // Use INSERT IGNORE to avoid overwriting the notification timestamp
                        // if there's already an entry for this page
                        $dbw->insert( 'watchlist', $toInsert, __METHOD__, 'IGNORE' );
@@ -331,11 +330,9 @@ class WatchedItem {
         * @return bool
         */
        public function removeWatch() {
-               wfProfileIn( __METHOD__ );
 
                // Only loggedin user can have a watchlist
                if ( wfReadOnly() || $this->mUser->isAnon() || !$this->isAllowed( 'editmywatchlist' ) ) {
-                       wfProfileOut( __METHOD__ );
                        return false;
                }
 
@@ -370,7 +367,6 @@ class WatchedItem {
 
                $this->watched = false;
 
-               wfProfileOut( __METHOD__ );
                return $success;
        }
 
@@ -401,7 +397,8 @@ class WatchedItem {
                $newtitle = $nt->getDBkey();
 
                $dbw = wfGetDB( DB_MASTER );
-               $res = $dbw->select( 'watchlist', 'wl_user',
+               $res = $dbw->select( 'watchlist',
+                       array( 'wl_user', 'wl_notificationtimestamp' ),
                        array( 'wl_namespace' => $oldnamespace, 'wl_title' => $oldtitle ),
                        __METHOD__, 'FOR UPDATE'
                );
@@ -411,7 +408,8 @@ class WatchedItem {
                        $values[] = array(
                                'wl_user' => $s->wl_user,
                                'wl_namespace' => $newnamespace,
-                               'wl_title' => $newtitle
+                               'wl_title' => $newtitle,
+                               'wl_notificationtimestamp' => $s->wl_notificationtimestamp,
                        );
                }