Пример #1
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove comments
     foreach ($this->authors as $author) {
         if (!$author->destroy()) {
             $this->addError($author->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #2
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove comments
     foreach ($this->replies()->rows() as $comment) {
         if (!$comment->destroy()) {
             $this->addError($comment->getError());
             return false;
         }
     }
     // Remove vote logs
     foreach ($this->votes()->rows() as $vote) {
         if (!$vote->destroy()) {
             $this->addError($vote->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #3
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Can't delete what doesn't exist
     if ($this->isNew()) {
         return true;
     }
     // Remove comments
     foreach ($this->replies() as $comment) {
         if (!$comment->destroy()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     foreach ($this->votes() as $vote) {
         if (!$vote->destroy()) {
             $this->setError($vote->getError());
             return false;
         }
     }
     return parent::destroy();
 }
Пример #4
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Can't delete what doesn't exist
     if (!$this->get('id')) {
         return true;
     }
     // Remove comments
     foreach ($this->comments()->rows() as $comment) {
         if (!$comment->destroy()) {
             $this->addError($comment->getError());
             return false;
         }
     }
     // Remove all attachments
     foreach ($this->attachments()->rows() as $attachment) {
         if (!$attachment->destroy()) {
             $this->addError($attachment->getError());
             return false;
         }
     }
     // Remove all links
     foreach ($this->links()->rows() as $link) {
         if (!$link->destroy()) {
             $this->addError($link->getError());
             return false;
         }
     }
     // Remove all aurhors
     foreach ($this->authors()->rows() as $author) {
         if (!$author->destroy()) {
             $this->addError($author->getError());
             return false;
         }
     }
     // Remove all revisions
     foreach ($this->versions()->rows() as $version) {
         if (!$version->destroy()) {
             $this->addError($version->getError());
             return false;
         }
     }
     // Remove all tags
     $this->tag('');
     $this->log('page_deleted');
     // Clear cached data
     \Cache::clean('wiki');
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #5
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove data
     foreach ($this->options() as $item) {
         if (!$item->destroy()) {
             $this->setError($item->getError());
             return false;
         }
     }
     // Remove vote logs
     foreach ($this->dates() as $dt) {
         if (!$dt->destroy()) {
             $this->setError($dt->getError());
             return false;
         }
     }
     // Remove vote logs
     foreach ($this->menus() as $menu) {
         if (!$menu->destroy()) {
             $this->setError($menu->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #6
0
 /**
  * Delete the record and associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     $data = $this->toArray();
     // Trigger the onUserBeforeDelete event
     Event::trigger('user.onUserBeforeDelete', array($data));
     // Remove associated data
     if ($this->reputation->get('id')) {
         if (!$this->reputation->destroy()) {
             $this->addError($this->reputation->getError());
             return false;
         }
     }
     foreach ($this->tokens()->rows() as $token) {
         if (!$token->destroy()) {
             $this->addError($token->getError());
             return false;
         }
     }
     Map::destroyByUser($this->get('id'));
     // Attempt to delete the record
     $result = parent::destroy();
     if ($result) {
         // Trigger the onUserAfterDelete event
         Event::trigger('user.onUserAfterDelete', array($data, true, $this->getError()));
     }
     return $result;
 }
Пример #7
0
 /**
  * Delete record
  *
  * @return  boolean  True if successful, False if not
  */
 public function destroy()
 {
     $path = $this->path();
     if (file_exists($path)) {
         if (!\Filesystem::delete($path)) {
             $this->addError('Unable to delete file.');
             return false;
         }
     }
     return parent::destroy();
 }
Пример #8
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Can't delete what doesn't exist
     if ($this->isNew()) {
         return true;
     }
     // Remove comments
     foreach ($this->options as $option) {
         if (!$option->destroy()) {
             $this->addError($option->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #9
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove files
     $path = $this->filespace() . DS . $this->get('page_id') . DS . $this->get('filename');
     if (file_exists($path)) {
         if (!\Filesystem::delete($path)) {
             $this->addError(Lang::txt('COM_WIKI_ERROR_UNABLE_TO_DELETE_FILE', $this->get('filename')));
             return false;
         }
     }
     if (!$this->get('id')) {
         return true;
     }
     return parent::destroy();
 }
Пример #10
0
 /**
  * Delete record and associated content
  *
  * @return  object
  */
 public function destroy()
 {
     foreach ($this->members()->rows() as $member) {
         if (!$member->destroy()) {
             $this->addError($member->getError());
             return false;
         }
     }
     return parent::destroy();
 }
Пример #11
0
 /**
  * Deletes the existing/current model
  *
  * @return  bool
  */
 public function destroy()
 {
     $path = $this->filespace() . DS . $this->get('id');
     if (is_dir($path)) {
         Filesystem::deleteDirectory($path, true);
     }
     return parent::destroy();
 }
Пример #12
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove applicants
     foreach ($this->applicants()->rows() as $applicant) {
         if (!$applicant->destroy()) {
             $this->addError($applicant->getError());
             return false;
         }
     }
     // Remove invitees
     foreach ($this->invitees()->rows() as $invitee) {
         if (!$invitee->destroy()) {
             $this->addError($invitee->getError());
             return false;
         }
     }
     // Remove members
     foreach ($this->members()->rows() as $member) {
         if (!$member->destroy()) {
             $this->addError($member->getError());
             return false;
         }
     }
     // Remove managers
     foreach ($this->managers()->rows() as $manager) {
         if (!$manager->destroy()) {
             $this->addError($manager->getError());
             return false;
         }
     }
     // Remove pages
     foreach ($this->pages()->rows() as $page) {
         if (!$page->destroy()) {
             $this->addError($page->getError());
             return false;
         }
     }
     // Remove modules
     foreach ($this->modules()->rows() as $module) {
         if (!$module->destroy()) {
             $this->addError($module->getError());
             return false;
         }
     }
     // Remove roles
     foreach ($this->roles()->rows() as $role) {
         if (!$role->destroy()) {
             $this->addError($role->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #13
0
 /**
  * Delete a record and any associated data
  *
  * @return  bool
  */
 public function destroy()
 {
     // Remove children
     foreach ($this->children()->rows() as $child) {
         if ($child->get('standalone')) {
             continue;
         }
         if (!$child->destroy()) {
             $this->setError($child->getError());
             return false;
         }
     }
     // Remove parent associations
     $parents = Association::all()->whereEquals('child_id', $this->get('id'))->rows();
     foreach ($parents as $parent) {
         if (!$parent->destroy()) {
             $this->setError($parent->getError());
             return false;
         }
     }
     return parent::destroy();
 }
Пример #14
0
 /**
  * Override destroy to add logging
  *
  * @return  boolean
  */
 public function destroy()
 {
     foreach ($this->groups()->rows() as $group) {
         if (!$group->destroy()) {
             $this->addError($group->getError());
             return false;
         }
     }
     $result = parent::destroy();
     if ($result) {
         $log = Log::blank();
         $log->set('object_type', 'class');
         $log->set('object_id', $this->get('id'));
         $log->set('name', $this->get('alias'));
         $log->set('action', 'delete');
         $log->set('actor_id', User::get('id'));
         $log->set('soft_blocks', $this->get('soft_blocks'));
         $log->set('hard_blocks', $this->get('hard_blocks'));
         $log->set('soft_files', $this->get('soft_files'));
         $log->set('hard_files', $this->get('hard_files'));
         $log->save();
     }
     return $result;
 }
Пример #15
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove comments
     foreach ($this->comments() as $comment) {
         if (!$comment->destroy()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     // Remove all tags
     $this->tag('');
     // Remove vote logs
     foreach ($this->votes() as $vote) {
         if (!$vote->destroy()) {
             $this->setError($vote->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #16
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove categories
     foreach ($this->categories()->rows() as $category) {
         if (!$category->destroy()) {
             $this->addError($category->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #17
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Can't delete what doesn't exist
     if (!$this->get('id')) {
         return true;
     }
     // Remove children
     foreach ($this->children()->rows() as $category) {
         if (!$category->destroy()) {
             $this->setError($category->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #18
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Can't delete what doesn't exist
     if ($this->isNew()) {
         return true;
     }
     // Remove comments
     foreach ($this->comments() as $comment) {
         if (!$comment->destroy()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     // Remove all tags
     $this->tag('');
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #19
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove data
     foreach ($this->comments()->rows() as $comment) {
         if (!$comment->destroy()) {
             $this->addError($comment->getError());
             return false;
         }
     }
     foreach ($this->attachments()->rows() as $attachment) {
         if (!$attachment->destroy()) {
             $this->addError($attachment->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #20
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     Event::trigger('courses.onCourseDelete', array($this));
     // Remove offerings
     foreach ($this->offerings()->rows() as $offering) {
         if (!$offering->destroy()) {
             $this->addError($offering->getError());
             return false;
         }
     }
     // Remove pages
     foreach ($this->pages()->rows() as $page) {
         if (!$page->destroy()) {
             $this->addError($page->getError());
             return false;
         }
     }
     // Remove all tags
     $this->tag('');
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #21
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove posts
     foreach ($this->posts()->rows() as $post) {
         if (!$post->destroy()) {
             $this->addError($post->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #22
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     foreach ($this->recipients()->rows() as $recipient) {
         if (!$recipient->destroy()) {
             $this->addError($recipient->getError());
             return false;
         }
     }
     foreach ($this->children()->rows() as $child) {
         if (!$child->destroy()) {
             $this->addError($child->getError());
             return false;
         }
     }
     $result = parent::destroy();
     if ($result) {
         Event::trigger('activity.onLogDelete', [$this]);
     }
     return $result;
 }
Пример #23
0
 /**
  * Delete entry and associated data
  *
  * @return  object
  */
 public function destroy()
 {
     $tag_id = $this->get('id');
     $comment = $this->toJson();
     foreach ($this->substitutes()->rows() as $row) {
         $row->destroy();
     }
     foreach ($this->objects()->rows() as $row) {
         $row->destroy();
     }
     $result = parent::destroy();
     if ($result) {
         $log = Log::blank();
         $log->set('tag_id', $tag_id);
         $log->set('action', 'tag_deleted');
         $log->set('comments', $comment);
         $log->save();
     }
     return $result;
 }
Пример #24
0
 /**
  * Delete record and associated data
  * 
  * @return  bool
  */
 public function destroy()
 {
     // check to make sure its not the hub account
     if ($this->get('hub_account') == 1) {
         $this->setError('Unable to delete the hub account.');
         return false;
     }
     if (!$this->revokeAccessTokens()) {
         return false;
     }
     if (!$this->revokeRefreshTokens()) {
         return false;
     }
     if (!$this->revokeAuthorizationCodes()) {
         return false;
     }
     foreach ($this->team()->rows() as $member) {
         if (!$member->destroy()) {
             $this->addError($member->getError());
             return false;
         }
     }
     return parent::destroy();
 }
Пример #25
0
 /**
  * Delete the record and all associated data
  *
  * @return  boolean  False if error, True on success
  */
 public function destroy()
 {
     // Remove ratings
     foreach ($this->ratings as $rating) {
         if (!$rating->destroy()) {
             $this->addError($rating->getError());
             return false;
         }
     }
     // Remove versions
     foreach ($this->versions as $version) {
         if (!$version->destroy()) {
             $this->addError($version->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::destroy();
 }
Пример #26
0
 /**
  * Delete record
  *
  * @return  boolean  True if successful, False if not
  */
 public function destroy()
 {
     if ($this->hasFile()) {
         if (!Filesystem::delete($this->path())) {
             $this->addError('Unable to delete file.');
             return false;
         }
     }
     return parent::destroy();
 }