- * @todo document
- */
- function addWatch() {
- $fname = 'WatchedItem::addWatch';
- wfProfileIn( $fname );
- # REPLACE instead of INSERT because occasionally someone
- # accidentally reloads a watch-add operation.
- $dbw =& wfGetDB( DB_MASTER );
- $dbw->replace( 'watchlist', array(array('wl_user', 'wl_namespace', 'wl_title', 'wl_notificationtimestamp')),
- array(
- 'wl_user' => $this->id,
- 'wl_namespace' => ($this->ns & ~1),
- 'wl_title' => $this->ti,
- 'wl_notificationtimestamp' => '0'
- ), $fname );
-
- # the following code compensates the new behaviour, introduced by the enotif patch,
- # that every single watched page needs now to be listed in watchlist
- # namespace:page and namespace_talk:page need separate entries: create them
- $dbw->replace( 'watchlist', array(array('wl_user', 'wl_namespace', 'wl_title', 'wl_notificationtimestamp')),
- array(
- 'wl_user' => $this->id,
- 'wl_namespace' => ($this->ns | 1 ),
- 'wl_title' => $this->ti,
- 'wl_notificationtimestamp' => '0'
- ), $fname );
-
- global $wgMemc;
- $wgMemc->set( $this->watchkey(), 1 );
- wfProfileOut( $fname );
- return true;