Ejemplo n.º 1
0
 /**
  * Delete a Consumer and related tokens and nonces
  *
  * XXX: Should this happen in an OAuthDataStore instead?
  *
  */
 function delete($useWhere = false)
 {
     // XXX: Is there any reason NOT to do this kind of cleanup?
     $this->_deleteTokens();
     $this->_deleteNonces();
     return parent::delete($useWhere);
 }
Ejemplo n.º 2
0
 function delete()
 {
     $filename = $this->filename;
     if (parent::delete()) {
         @unlink(Avatar::path($filename));
     }
 }
Ejemplo n.º 3
0
 /**
  * Delete a Consumer and related tokens and nonces
  *
  * XXX: Should this happen in an OAuthDataStore instead?
  *
  */
 function delete()
 {
     // XXX: Is there any reason NOT to do this kind of cleanup?
     $this->_deleteTokens();
     $this->_deleteNonces();
     parent::delete();
 }
Ejemplo n.º 4
0
 function delete()
 {
     $f = File::staticGet('id', $this->file_id);
     if (!empty($f)) {
         $f->blowCache();
     }
     return parent::delete();
 }
Ejemplo n.º 5
0
 function delete($useWhere = false)
 {
     $filename = $this->filename;
     if (file_exists(Avatar::path($filename))) {
         @unlink(Avatar::path($filename));
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 6
0
 function delete($useWhere = false)
 {
     try {
         $f = File::getByID($this->file_id);
         $f->blowCache();
     } catch (NoResultException $e) {
         // ...alright, that's weird, but no File to delete anyway.
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 7
0
 function delete()
 {
     $profile = Profile::staticGet('id', $this->user_id);
     $notice = Notice::staticGet('id', $this->notice_id);
     $result = null;
     if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) {
         $result = parent::delete();
         self::blow('fave:list-ids:notice_id:%d', $this->notice_id);
         self::blow('popular');
         if ($result) {
             Event::handle('EndDisfavorNotice', array($profile, $notice));
         }
     }
     return $result;
 }
Ejemplo n.º 8
0
 function delete($useWhere = false)
 {
     $result = parent::delete($useWhere);
     if ($result !== false) {
         Config::_blowSettingsCache();
     }
     return $result;
 }
Ejemplo n.º 9
0
 function delete()
 {
     $result = parent::delete();
     if ($result) {
         Config::_blowSettingsCache();
     }
     return $result;
 }
Ejemplo n.º 10
0
 public function delete($useWhere = false)
 {
     if (!empty($this->filename) && file_exists(File_thumbnail::path($this->filename))) {
         $deleted = @unlink(self::path($this->filename));
         if (!$deleted) {
             common_log(LOG_ERR, sprintf('Could not unlink existing file: "%s"', self::path($this->filename)));
         }
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 11
0
 function delete()
 {
     try {
         $profile = $this->getProfile();
         $profile->delete();
     } catch (UserNoProfileException $unp) {
         common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion.");
     }
     $related = array('Fave', 'Confirm_address', 'Remember_me', 'Foreign_link', 'Invitation');
     Event::handle('UserDeleteRelated', array($this, &$related));
     foreach ($related as $cls) {
         $inst = new $cls();
         $inst->user_id = $this->id;
         $inst->delete();
     }
     $this->_deleteTags();
     $this->_deleteBlocks();
     parent::delete();
 }
Ejemplo n.º 12
0
 function delete()
 {
     $result = parent::delete();
     if ($result) {
         self::blow('profile_list:subscriber_count:%d', $this->profile_tag_id);
     }
     return $result;
 }
Ejemplo n.º 13
0
 function delete($useWhere = false)
 {
     $this->_deleteAppUsers();
     $consumer = $this->getConsumer();
     $consumer->delete();
     return parent::delete($useWhere);
 }
Ejemplo n.º 14
0
 function delete($useWhere = false)
 {
     // just in case it hadn't been done before... (usually set before adding deluser to queue handling!)
     if (!$this->hasRole(Profile_role::DELETED)) {
         $this->grantRole(Profile_role::DELETED);
     }
     $this->_deleteNotices();
     $this->_deleteSubscriptions();
     $this->_deleteTags();
     $this->_deleteBlocks();
     $this->_deleteAttentions();
     Avatar::deleteFromProfile($this, true);
     // Warning: delete() will run on the batch objects,
     // not on individual objects.
     $related = array('Reply', 'Group_member');
     Event::handle('ProfileDeleteRelated', array($this, &$related));
     foreach ($related as $cls) {
         $inst = new $cls();
         $inst->profile_id = $this->id;
         $inst->delete();
     }
     $localuser = User::getKV('id', $this->id);
     if ($localuser instanceof User) {
         $localuser->delete();
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 15
0
 function delete()
 {
     $this->_deleteNotices();
     $this->_deleteSubscriptions();
     $this->_deleteMessages();
     $this->_deleteTags();
     $this->_deleteBlocks();
     $this->delete_avatars();
     // Warning: delete() will run on the batch objects,
     // not on individual objects.
     $related = array('Reply', 'Group_member');
     Event::handle('ProfileDeleteRelated', array($this, &$related));
     foreach ($related as $cls) {
         $inst = new $cls();
         $inst->profile_id = $this->id;
         $inst->delete();
     }
     parent::delete();
 }
Ejemplo n.º 16
0
 public function delete($useWhere = false)
 {
     $result = parent::delete($useWhere);
     $this->blowOnDelete();
     return $result;
 }
Ejemplo n.º 17
0
 public function delete($useWhere = false)
 {
     // Delete the file, if it exists locally
     if (!empty($this->filename) && file_exists(self::path($this->filename))) {
         $deleted = @unlink(self::path($this->filename));
         if (!$deleted) {
             common_log(LOG_ERR, sprintf('Could not unlink existing file: "%s"', self::path($this->filename)));
         }
     }
     // Clear out related things in the database and filesystem, such as thumbnails
     if (Event::handle('FileDeleteRelated', array($this))) {
         $thumbs = new File_thumbnail();
         $thumbs->file_id = $this->id;
         if ($thumbs->find()) {
             while ($thumbs->fetch()) {
                 $thumbs->delete();
             }
         }
         $f2p = new File_to_post();
         $f2p->file_id = $this->id;
         if ($f2p->find()) {
             while ($f2p->fetch()) {
                 $f2p->delete();
             }
         }
     }
     // And finally remove the entry from the database
     return parent::delete($useWhere);
 }
Ejemplo n.º 18
0
 function delete()
 {
     // For auditing purposes, save a record that the notice
     // was deleted.
     // @fixme we have some cases where things get re-run and so the
     // insert fails.
     $deleted = Deleted_notice::staticGet('id', $this->id);
     if (!$deleted) {
         $deleted = Deleted_notice::staticGet('uri', $this->uri);
     }
     if (!$deleted) {
         $deleted = new Deleted_notice();
         $deleted->id = $this->id;
         $deleted->profile_id = $this->profile_id;
         $deleted->uri = $this->uri;
         $deleted->created = $this->created;
         $deleted->deleted = common_sql_now();
         $deleted->insert();
     }
     if (Event::handle('NoticeDeleteRelated', array($this))) {
         // Clear related records
         $this->clearReplies();
         $this->clearRepeats();
         $this->clearFaves();
         $this->clearTags();
         $this->clearGroupInboxes();
         $this->clearFiles();
         // NOTE: we don't clear inboxes
         // NOTE: we don't clear queue items
     }
     $result = parent::delete();
     $this->blowOnDelete();
     return $result;
 }
Ejemplo n.º 19
0
 function delete()
 {
     $result = parent::delete();
     if ($result) {
         self::blow('profile_list:tagged_count:%d:%s', $this->tagger, $this->tag);
     }
     return $result;
 }
Ejemplo n.º 20
0
 function delete()
 {
     self::blow('rsvp:for-event:%s', $event->id);
     parent::delete();
 }
Ejemplo n.º 21
0
 /**
  * Gracefully delete one or many people tags
  * along with their members and subscriptions data
  *
  * @return boolean success
  */
 function delete($useWhere = false)
 {
     // force delete one item at a time.
     if (empty($this->id)) {
         $this->find();
         while ($this->fetch()) {
             $this->delete();
         }
     }
     Profile_tag::cleanup($this);
     Profile_tag_subscription::cleanup($this);
     self::blow('profile:lists:%d', $this->tagger);
     return parent::delete($useWhere);
 }
Ejemplo n.º 22
0
 function delete($useWhere = false)
 {
     self::blow('spam_score:notice_ids');
     self::blow('spam_score:notice_ids;last');
     return parent::delete($useWhere);
 }
 function delete($useWhere = false)
 {
     $result = parent::delete($useWhere);
     if ($result !== false) {
         self::blow('profile_list:subscriber_count:%d', $this->profile_tag_id);
     }
     return $result;
 }
Ejemplo n.º 24
0
 function delete($useWhere = false)
 {
     if (empty($this->id)) {
         common_log(LOG_WARNING, "Ambiguous User->delete(); skipping related tables.");
         return parent::delete($useWhere);
     }
     try {
         $profile = $this->getProfile();
         $profile->delete();
     } catch (UserNoProfileException $unp) {
         common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion.");
     }
     $related = array('Confirm_address', 'Remember_me', 'Foreign_link', 'Invitation');
     Event::handle('UserDeleteRelated', array($this, &$related));
     foreach ($related as $cls) {
         $inst = new $cls();
         $inst->user_id = $this->id;
         $inst->delete();
     }
     $this->_deleteTags();
     $this->_deleteBlocks();
     return parent::delete($useWhere);
 }
Ejemplo n.º 25
0
 function delete($useWhere = false)
 {
     self::blow('rsvp:for-event:%s', $this->id);
     return parent::delete($useWhere);
 }
Ejemplo n.º 26
0
 function delete($useWhere = false)
 {
     $this->_deleteNotices();
     $this->_deleteSubscriptions();
     $this->_deleteTags();
     $this->_deleteBlocks();
     $this->_deleteAttentions();
     Avatar::deleteFromProfile($this, true);
     // Warning: delete() will run on the batch objects,
     // not on individual objects.
     $related = array('Reply', 'Group_member');
     Event::handle('ProfileDeleteRelated', array($this, &$related));
     foreach ($related as $cls) {
         $inst = new $cls();
         $inst->profile_id = $this->id;
         $inst->delete();
     }
     $localuser = User::getKV('id', $this->id);
     if ($localuser instanceof User) {
         $localuser->delete();
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 27
0
 function delete()
 {
     self::blow('spam_score:notice_ids');
     self::blow('spam_score:notice_ids;last');
     parent::delete();
 }
Ejemplo n.º 28
0
 public function delete($useWhere = false)
 {
     try {
         $oprofile = Ostatus_profile::getKV('feeduri', $this->getUri());
         if ($oprofile instanceof Ostatus_profile) {
             // Check if there's a profile. If not, handle the NoProfileException below
             $profile = $oprofile->localProfile();
         }
     } catch (NoProfileException $e) {
         // If the Ostatus_profile has no local Profile bound to it, let's clean it out at the same time
         $oprofile->delete();
     } catch (NoUriException $e) {
         // FeedSub->getUri() can throw a NoUriException, let's just go ahead and delete it
     }
     return parent::delete($useWhere);
 }
Ejemplo n.º 29
0
 /**
  * Handle cascading deletion, on the model of notice and profile.
  *
  * This should handle freeing up cached entries for the group's
  * id, nickname, URI, and aliases. There may be other areas that
  * are not de-cached in the UI, including the sidebar lists on
  * GroupsAction
  */
 function delete()
 {
     if ($this->id) {
         // Safe to delete in bulk for now
         $related = array('Group_inbox', 'Group_block', 'Group_member', 'Related_group');
         Event::handle('UserGroupDeleteRelated', array($this, &$related));
         foreach ($related as $cls) {
             $inst = new $cls();
             $inst->group_id = $this->id;
             if ($inst->find()) {
                 while ($inst->fetch()) {
                     $dup = clone $inst;
                     $dup->delete();
                 }
             }
         }
         // And related groups in the other direction...
         $inst = new Related_group();
         $inst->related_group_id = $this->id;
         $inst->delete();
         // Aliases and the local_group entry need to be cleared explicitly
         // or we'll miss clearing some cache keys; that can make it hard
         // to create a new group with one of those names or aliases.
         $this->setAliases(array());
         $local = Local_group::staticGet('group_id', $this->id);
         if ($local) {
             $local->delete();
         }
         // blow the cached ids
         self::blow('user_group:notice_ids:%d', $this->id);
     } else {
         common_log(LOG_WARN, "Ambiguous user_group->delete(); skipping related tables.");
     }
     parent::delete();
 }
Ejemplo n.º 30
0
 function delete()
 {
     $this->_deleteAppUsers();
     $consumer = $this->getConsumer();
     $consumer->delete();
     parent::delete();
 }