return $result;
}
- function update($orig=null)
+ function update($dataObject=false)
{
- $result = parent::update($orig);
- if ($result) {
+ $result = parent::update($dataObject);
+ if ($result !== false) {
Config::_blowSettingsCache();
}
return $result;
return $result;
}
- function update($orig=null)
+ function update($dataObject=false)
{
- if (is_object($orig) && $orig instanceof Memcached_DataObject) {
- $orig->decache(); # might be different keys
+ if (is_object($dataObject) && $dataObject instanceof Memcached_DataObject) {
+ $dataObject->decache(); # might be different keys
}
- $result = parent::update($orig);
- if ($result) {
+ $result = parent::update($dataObject);
+ if ($result !== false) {
$this->fixupTimestamps();
$this->encache();
}
return ($biolimit > 0 && !empty($bio) && (mb_strlen($bio) > $biolimit));
}
- public function update($orig)
+ function update($dataObject=false)
{
- if ($this->nickname != $orig->nickname) {
- $local = User::getKV('id', $this->id);
- if ($local instanceof User) {
- common_debug("Updating User ({$this->id}) nickname from {$orig->nickname} to {$this->nickname}");
+ if (is_object($dataObject) && $this->nickname != $dataObject->nickname) {
+ try {
+ $local = $this->getUser();
+ common_debug("Updating User ({$this->id}) nickname from {$dataObject->nickname} to {$this->nickname}");
$origuser = clone($local);
$local->nickname = $this->nickname;
$result = $local->updateKeys($origuser);
if ($local->hasRole(Profile_role::OWNER)) {
User::blow('user:site_owner');
}
+ } catch (NoSuchUserException $e) {
+ // Nevermind...
}
}
- return parent::update($orig);
+ return parent::update($dataObject);
}
function delete()
* Update a people tag gracefully
* also change "tag" fields in profile_tag table
*
- * @param Profile_list $orig Object's original form
+ * @param Profile_list $dataObject Object's original form
*
* @return boolean success
*/
- function update($orig=null)
+ function update($dataObject=false)
{
- $result = true;
-
- if (!is_object($orig) && !$orig instanceof Profile_list) {
- parent::update($orig);
+ if (!is_object($dataObject) && !$dataObject instanceof Profile_list) {
+ return parent::update($dataObject);
}
+ $result = true;
+
// if original tag was different
// check to see if the new tag already exists
// if not, rename the tag correctly
- if($orig->tag != $this->tag || $orig->tagger != $this->tagger) {
+ if($dataObject->tag != $this->tag || $dataObject->tagger != $this->tagger) {
$existing = Profile_list::getByTaggerAndTag($this->tagger, $this->tag);
if(!empty($existing)) {
// TRANS: Server exception.
}
// move the tag
// XXX: allow OStatus plugin to send out profile tag
- $result = Profile_tag::moveTag($orig, $this);
+ $result = Profile_tag::moveTag($dataObject, $this);
}
- parent::update($orig);
- return $result;
+ return parent::update($dataObject);
}
/**
$tags->escape($orig->tag),
$tags->escape($orig->tagger)));
- if (!$result) {
+ if ($result === false) {
common_log_db_error($tags, 'UPDATE', __FILE__);
- return false;
+ throw new Exception('Could not move Profile_tag, see db log for details.');
}
- return true;
+ return $result;
}
static function blowCaches($tagger, $tagged) {
}
}
- function update($orig=null)
+ function update($dataObject=false)
{
- if (is_object($orig)) {
- $orig->decache(); # might be different keys
+ if (is_object($dataObject)) {
+ $dataObject->decache(); # might be different keys
}
- return parent::update($orig);
+ return parent::update($dataObject);
}
/**
* Because we cache subscriptions, it's useful to flush them
* here.
*
- * @param mixed $orig Original version of object
+ * @param mixed $dataObject Original version of object
*
* @return boolean success flag.
*/
- function update($orig=null)
+ function update($dataObject=false)
{
- $result = parent::update($orig);
-
self::blow('subscription:by-subscriber:'.$this->subscriber);
self::blow('subscription:by-subscribed:'.$this->subscribed);
- return $result;
+ return parent::update($dataObject);
}
function getURI()
return parent::delete();
}
- public function update($orig)
+ public function update($dataObject=false)
{
// Whenever the User_group is updated, find the Local_group
- // and updates it nickname too.
- if ($this->nickname != $orig->nickname) {
+ // and update its nickname too.
+ if ($this->nickname != $dataObject->nickname) {
$local = Local_group::getKV('group_id', $this->id);
if ($local instanceof Local_group) {
- common_debug("Updating Local_group ({$this->id}) nickname from {$orig->nickname} to {$this->nickname}");
+ common_debug("Updating Local_group ({$this->id}) nickname from {$dataObject->nickname} to {$this->nickname}");
$local->setNickname($this->nickname);
}
}
throw new ServerException(_('Unable to update profile'));
}
- return parent::update($orig);
+ return parent::update($dataObject);
}
function isPrivate()
return parent::insert();
}
- /**
- * Update wrapper; transparently update modified column.
- * @return boolean success
- */
- function update($old=null)
- {
- $this->modified = common_sql_now();
- return parent::update($old);
- }
-
/**
* Schedule delivery of a 'fat ping' to the subscriber's callback
* endpoint. If queues are disabled, this will run immediately.