Deletes any prior responses that haven't been updated.
@return void
@internal
352040
function deleteRemainingResponses() {
        foreach($this->responses as $id => $msgs) {
            foreach($msgs as $response) {
                if(\is_array($response)) {
                    foreach($response as $resp) {
                        $resp->delete()->done();
                    }
                } else {
                    $response->delete()->done();
                }
            }
            
            $this->responses[$id] = array();
        }
    }
309887
private function purgeOldVersions()
    {
        $keep = isset($this->keepOldVersions) ? $this->keepOldVersions : 0;
        $count = $this->versions()->count();

        if ((int)$keep > 0 && $count > $keep) {
            $oldVersions = $this->versions()
                ->latest()
                ->take($count)
                ->skip($keep)
                ->get()
                ->each(function ($version) {
                $version->delete();
            });
        }
    }
84544
public function clear()
    {
        $this->id = null;
        $this->senderlogin = null;
        $this->receiverlogin = null;
        $this->transactionid = null;
        $this->billid = null;
        $this->amount = null;
        $this->message = null;
        $this->status = null;
        $this->datetime = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
360773
public function clear()
    {
        if (null !== $this->aSkill) {
            $this->aSkill->removeSkillReference($this);
        }
        if (null !== $this->aReference) {
            $this->aReference->removeSkillReference($this);
        }
        $this->skill_id = null;
        $this->reference_id = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
185343
public function clear()
    {
        $this->id = null;
        $this->username = null;
        $this->password = null;
        $this->first_name = null;
        $this->last_name = null;
        $this->create_date = null;
        $this->update_date = null;
        $this->status = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
772478
public function beforeDelete()
    {
        $this->invites()->sync(array());
        $this->deletePages();
        $this->deletePosts();
        $this->deleteEvents();
        $this->deleteComments();
    }
972959
public function cleanup() {
        global $DB;
        $courseid = $this->controller->get_courseid();
        if ($this->is_temporary_course_created($courseid) && $course = $DB->get_record('course', array('id' => $courseid))) {
            $course->deletesource = 'restore';
            delete_course($course, false);
        }
    }
1363251
public function clear()
    {
        $this->id = null;
        $this->locale = null;
        $this->description = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
1105659
public function clear()
    {
        $this->id = null;
        $this->key = null;
        $this->value = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
658255
public function clear()
    {
        if (null !== $this->aPermissionRelatedByParentId) {
            $this->aPermissionRelatedByParentId->removePermissionRelatedById($this);
        }
        $this->id = null;
        $this->name = null;
        $this->create_date = null;
        $this->description = null;
        $this->update_date = null;
        $this->status = null;
        $this->parent_id = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
664048
public function reset()
    {
        $this->headers = [];
        $this->to = [];
        $this->replyto = [];
        $this->cc = [];
        $this->bcc = [];
        $this->from = [];
        $this->data = [];
        $this->subject = '';
        $this->attachments = [];
        $this->template = '';
        $this->body = false;
        $this->bodyHTML = false;
        $this->testing = false;
        $this->throwOnFailure = false;
    }
949018
public function clear()
    {
        $this->id = null;
        $this->mapuid = null;
        $this->name = null;
        $this->filename = null;
        $this->author = null;
        $this->environment = null;
        $this->mood = null;
        $this->bronzetime = null;
        $this->silvertime = null;
        $this->goldtime = null;
        $this->authortime = null;
        $this->copperprice = null;
        $this->laprace = null;
        $this->nblaps = null;
        $this->npcheckpoints = null;
        $this->maptype = null;
        $this->mapstyle = null;
        $this->created_at = null;
        $this->updated_at = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
567823
public function delete() {
		$this->RenderedContent = '';
		if ($this->checkPerm('Delete')) {
			$this->Tags()->removeAll();
			// if we have replies, we can't delete completely!
			if ($this->config()->soft_delete || ($this->Replies()->exists() && $this->Replies()->count() > 0)) {
				$count = $this->Replies()->count();
				$item = $this->Replies()->first();
				$this->Deleted = true;
                $this->OriginalContent = $this->Author . "\n\n" . $this->Content;
				$this->Content = _t('MicroPost.DELETED', '[deleted]');
				$this->Author = $this->Content;
				$this->write();
			} else {
                return parent::delete();
			}
		}
	}
1357339
public function clear()
    {
        $this->id = null;
        $this->dealer_id = null;
        $this->product_id = null;
        $this->created_at = null;
        $this->updated_at = null;
        $this->version = null;
        $this->version_created_at = null;
        $this->version_created_by = null;
        $this->dealer_id_version = null;
        $this->product_id_version = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
826822
public function clear(): void
    {
        // On purpose does not check if enabled, in case of prior phase being enabled we clear cache when someone asks.
        $this->cache = $this->cacheIndex = $this->cacheExpiryTime = $this->cacheAccessCount = [];
    }
796013
private function cleanOldPreviews()
    {
        $oldPreviews = array_filter($this->files->files($this->storage()), function ($file) {
            return (time() - $this->files->lastModified($file)) > (Config::get('mail-debug.lifetime') * 60);
        });

        if ($oldPreviews) {
            $this->files->delete($oldPreviews);
        }
    }
642892
public function deleteExpiredBans(): void
    {
        $bans = Ban::query()
            ->where('expired_at', '<=', Carbon::now()->format('Y-m-d H:i:s'))
            ->get();

        $bans->each(function ($ban) {
            $ban->delete();
        });
    }