summaryrefslogtreecommitdiff
path: root/classes/Foreign_user.php
diff options
context:
space:
mode:
authorzach <zach@controlyourself.ca>2008-11-14 00:30:44 -0500
committerzach <zach@controlyourself.ca>2008-11-14 00:30:44 -0500
commitfed15bd6b7bcbca6d4707dc4ccedd8784fcadfb2 (patch)
tree48a6030a320a74476a17622f0a79ff78134cecd9 /classes/Foreign_user.php
parent65b22d2fdfdabc5c4916b0d96cde6f8869053994 (diff)
Twitter bridge - don't delete Twitter users. Update them instead.
darcs-hash:20081114053044-462f3-30e2d27261bca1977b89dee409383e178f446149.gz
Diffstat (limited to 'classes/Foreign_user.php')
-rw-r--r--classes/Foreign_user.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php
index d70923caa..027fae69d 100644
--- a/classes/Foreign_user.php
+++ b/classes/Foreign_user.php
@@ -39,4 +39,32 @@ class Foreign_user extends Memcached_DataObject
return NULL;
}
+ function updateKeys(&$orig) {
+ $parts = array();
+ foreach (array('id', 'service', 'uri', 'nickname') as $k) {
+ if (strcmp($this->$k, $orig->$k) != 0) {
+ $parts[] = $k . ' = ' . $this->_quote($this->$k);
+ }
+ }
+ if (count($parts) == 0) {
+ # No changes
+ return true;
+ }
+ $toupdate = implode(', ', $parts);
+
+ $table = $this->tableName();
+ if(common_config('db','quote_identifiers')) {
+ $table = '"' . $table . '"';
+ }
+ $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
+ ' WHERE id = ' . $this->id;
+ $orig->decache();
+ $result = $this->query($qry);
+ if ($result) {
+ $this->encache();
+ }
+ return $result;
+ }
+
+
}