Beispiel #1
0
 public function unfollow($other)
 {
     // obtain the timestamps
     $result = HypertableConnection::query("SELECT CELLS * FROM user WHERE " . "(CELL = '{$id}','following:{$other}' " . "OR CELL = '{$other}','followers:{$id}')");
     $following_timestamp = $result->cells[0]->key->timestamp;
     $followers_timestamp = $result->cells[1]->key->timestamp;
     // DELETE following_history and followers_history
     HypertableConnection::delete('user', $this->_id, 'following_history', $following_timestamp);
     HypertableConnection::delete('user', $other, 'followers_history', $followers_timestamp);
     // DELETE following and followers
     HypertableConnection::delete('user', $this->_id, "following:{$other}");
     HypertableConnection::delete('user', $other, 'followers:' . $this->_id);
     // decrement the counters
     HypertableConnection::insert('user', $this->_id, 'following_count', '-1');
     HypertableConnection::insert('user', $other, 'followers_count', '-1');
 }