diff options
author | Domas Mituzas <midom@users.mediawiki.org> | 2004-06-11 15:54:29 +0000 |
---|---|---|
committer | Domas Mituzas <midom@users.mediawiki.org> | 2004-06-11 15:54:29 +0000 |
commit | 7b8efba71bb04820d0b09db4d0ee459e192053be (patch) | |
tree | d88bb01a5eaba2d4dadca8f71cfe7f2a2c0d5398 /includes/WatchedItem.php | |
parent | 4655478a5439d5af67e7f30f3897338d7ac1edcf (diff) | |
download | mediawikicore-7b8efba71bb04820d0b09db4d0ee459e192053be.tar.gz mediawikicore-7b8efba71bb04820d0b09db4d0ee459e192053be.zip |
de-mysql: remove REPLACE INTO and DELETE .. LIMIT for nonmysql
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/4006
Diffstat (limited to 'includes/WatchedItem.php')
-rw-r--r-- | includes/WatchedItem.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index 74371be4bf25..23ad2804e1de 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -36,10 +36,22 @@ class WatchedItem { function addWatch() { + global $wgIsMySQL; # REPLACE instead of INSERT because occasionally someone # accidentally reloads a watch-add operation. - $sql = "REPLACE INTO watchlist (wl_user, wl_namespace,wl_title) VALUES ($this->id,$this->ns,'$this->eti')"; - $res = wfQuery( $sql, DB_WRITE ); + if ($wgIsMySQL) { + $sql = "REPLACE INTO watchlist (wl_user, wl_namespace,wl_title) ". + "VALUES ($this->id,$this->ns,'$this->eti')"; + $res = wfQuery( $sql, DB_WRITE ); + } else { + $sql = "DELETE FROM watchlist WHERE wl_user=$this->id AND + wl_namespace=$this->ns AND wl_title='$this->eti'"; + wfQuery( $sql, DB_WRITE); + $sql = "INSERT INTO watchlist (wl_user, wl_namespace,wl_title) ". + "VALUES ($this->id,$this->ns,'$this->eti')"; + $res = wfQuery( $sql, DB_WRITE ); + } + if( $res === false ) return false; global $wgMemc; @@ -49,7 +61,7 @@ class WatchedItem { function removeWatch() { - $sql = "DELETE FROM watchlist WHERE wl_user=$this->id AND wl_namespace=$this->ns AND wl_title='$this->eti' LIMIT 1"; + $sql = "DELETE FROM watchlist WHERE wl_user=$this->id AND wl_namespace=$this->ns AND wl_title='$this->eti'"; $res = wfQuery( $sql, DB_WRITE ); if( $res === false ) return false; |