diff options
author | Brion Vibber <brion@pobox.com> | 2010-06-26 10:18:03 -0400 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-06-26 10:18:03 -0400 |
commit | 00e129b01343e37dbd662b95f423e731b0867023 (patch) | |
tree | ba7e1bb3706adb6081bb61fd9499bef38213be8e /classes/Status_network.php | |
parent | dad0b06a386092b159118780a6a6801f3cf674de (diff) | |
parent | 696e4ba393c658d5b2e1fe46e1389bd7b2cfdb34 (diff) |
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Diffstat (limited to 'classes/Status_network.php')
-rw-r--r-- | classes/Status_network.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php index 4a1f2c374..64016dd79 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -144,6 +144,35 @@ class Status_network extends Safe_DataObject return parent::update($orig); } + /** + * DB_DataObject doesn't allow updating keys (even non-primary) + */ + function updateKeys(&$orig) + { + $this->_connect(); + foreach (array('hostname', 'pathname') 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 = common_database_tablename($this->tableName()); + $qry = 'UPDATE ' . $table . ' SET ' . $toupdate . + ' WHERE nickname = ' . $this->_quote($this->nickname); + $orig->decache(); + $result = $this->query($qry); + if ($result) { + $this->encache(); + } + return $result; + } + function delete() { $this->decache(); # while we still have the values! |