Ejemplo n.º 1
0
 function update($orig = null)
 {
     $result = parent::update($orig);
     if ($result) {
         Config::_blowSettingsCache();
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Update a people tag gracefully
  * also change "tag" fields in profile_tag table
  *
  * @param Profile_list $dataObject    Object's original form
  *
  * @return boolean success
  */
 function update($dataObject = false)
 {
     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 ($dataObject->tag != $this->tag || $dataObject->tagger != $this->tagger) {
         $existing = Profile_list::getByTaggerAndTag($this->tagger, $this->tag);
         if (!empty($existing)) {
             // TRANS: Server exception.
             throw new ServerException(_('The tag you are trying to rename ' . 'to already exists.'));
         }
         // move the tag
         // XXX: allow OStatus plugin to send out profile tag
         $result = Profile_tag::moveTag($dataObject, $this);
     }
     return parent::update($dataObject);
 }
Ejemplo n.º 3
0
 function update($dataObject = false)
 {
     $result = parent::update($dataObject);
     if ($result !== false) {
         Config::_blowSettingsCache();
     }
     return $result;
 }
Ejemplo n.º 4
0
 function update($dataObject = false)
 {
     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;
             // updateWithKeys throws exception on failure.
             $local->updateWithKeys($origuser);
             // Clear the site owner, in case nickname changed
             if ($local->hasRole(Profile_role::OWNER)) {
                 User::blow('user:site_owner');
             }
         } catch (NoSuchUserException $e) {
             // Nevermind...
         }
     }
     return parent::update($dataObject);
 }
Ejemplo n.º 5
0
 /**
  * Flush cached subscriptions when subscription is updated
  *
  * Because we cache subscriptions, it's useful to flush them
  * here.
  *
  * @param mixed $dataObject Original version of object
  *
  * @return boolean success flag.
  */
 function update($dataObject = false)
 {
     self::blow('subscription:by-subscriber:' . $this->subscriber);
     self::blow('subscription:by-subscribed:' . $this->subscribed);
     return parent::update($dataObject);
 }
Ejemplo n.º 6
0
 /**
  * Flush cached subscriptions when subscription is updated
  *
  * Because we cache subscriptions, it's useful to flush them
  * here.
  *
  * @param mixed $orig Original version of object
  *
  * @return boolean success flag.
  */
 function update($orig = null)
 {
     $result = parent::update($orig);
     self::blow('subscription:by-subscriber:' . $this->subscriber);
     self::blow('subscription:by-subscribed:' . $this->subscribed);
     return $result;
 }
Ejemplo n.º 7
0
 public function update($dataObject = false)
 {
     // Whenever the User_group is updated, find the Local_group
     // 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 {$dataObject->nickname} to {$this->nickname}");
             $local->setNickname($this->nickname);
         }
     }
     // Also make sure the Profile table is up to date!
     $fields = array('nickname' => 'nickname', 'fullname' => 'fullname', 'mainpage' => 'profileurl', 'homepage' => 'homepage', 'description' => 'bio', 'location' => 'location', 'created' => 'created', 'modified' => 'modified');
     $profile = $this->getProfile();
     $origpro = clone $profile;
     foreach ($fields as $gf => $pf) {
         $profile->{$pf} = $this->{$gf};
     }
     if ($profile->update($origpro) === false) {
         throw new ServerException(_('Unable to update profile'));
     }
     return parent::update($dataObject);
 }