Delete the current revision.

@param bool $clear Should we clear the fields after deleting the revision ?
775421
public function deleteRevision($clear = true)
    {
        $this->getFieldTypes()->each(function ($type) {
            $type::where('revision_id', $this->revision->id)->delete();
        });

        // If this revision is currently
        // published, we need to publish
        // another revision in place.
        if ($this->revision->published && $this->revision->exists) {
            //TODO :: improve this logic
            Revision::where('content_id', $this->content->id)
                ->where('id', '!=', $this->revision->id)
                ->take(1)
                ->update(['published' => true]);
        }

        $this->revision->delete();

        if ($clear) {
            $this->clearFields();
        }
    }
957824
public function revert(&$entity, $revision)
    {
        /** @var ClassMetadataInfo $meta */
        $meta = $this->getClassMetadata(get_class($entity));

        $data = $this->getRevisionData($entity, ['revision_id = :revisionId'], ['revisionId' => $revision], 1);

        /** @var \ReflectionProperty[] $revisedProperties */
        $revisedProperties = $this->annotationReader->getRevisedProperties($entity);

        $exception = null;
        foreach ($revisedProperties as $field => $property) {
            if (! key_exists($field, $revisedProperties)) {
                continue;
            }

            if (isset($meta->fieldMappings[$field])) {
                $columnName = $meta->fieldMappings[$field]['columnName'];
            } elseif (isset($meta->associationMappings[$field])) {
                $columnName = $meta->associationMappings[$field]['joinColumns'][0]['name'];
            } else {
                throw new \Exception('Cannot find column name for' . $field);
            }

            $value = $data[$columnName];

            $property = $meta->getReflectionProperty($field);
            $property->setValue($entity, $value);

            if ($field == 'deletedAt' && $value !== null) {
                $exception = new DeletedException('Entity is deleted in this revision');
            }
        }

        if ($exception) {
            $exception->setEntity($entity);
            throw $exception;
        }

        return $entity;
    }
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);
    }
741351
public function SetFormSaved($Saved = TRUE) {
      if ($Saved === '') // Allow reset
         $this->_FormSaved = '';
      else // Force true/false
         $this->_FormSaved = ($Saved) ? TRUE : FALSE;
   }
1015875
public function clear()
    {
        $this->id = null;
        $this->file = null;
        $this->person_id = null;
        $this->visible = null;
        $this->position = null;
        $this->created_at = null;
        $this->updated_at = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
317507
protected function writeConfig($clear = true)
    {
        $output = $this->dumpConfig();
        if ($output !== null
            && $output !== false
        ) {
            $localPath = $this->getLocalPath();

            if ($this->doNotWriteConfigInTests) {
                // simulate whether it would be successful
                $success = is_writable($localPath);
            } else {
                $success = @file_put_contents($localPath, $output, LOCK_EX);
            }

            if ($success === false) {
                throw $this->getConfigNotWritableException();
            }

            /**
             * Triggered when a INI config file is changed on disk.
             *
             * @param string $localPath Absolute path to the changed file on the server.
             */
            Piwik::postEvent('Core.configFileChanged', [$localPath]);
        }

        if ($clear) {
            $this->reload();
        }
    }
658363
public void clear()
    {
        _version++;
        if (_version>1000)
        {
            _version=0;
            for (int i=_fields.size();i-->0;)
            {
                Field field=(Field)_fields.get(i);
                if (field!=null)
                    field.clear();
            }
        }
    }
533195
public function clear()
    {
        $this->identityMap =
        $this->documentIds =
        $this->documentState =
        $this->documentTranslations =
        $this->documentLocales =
        $this->nonMappedData =
        $this->originalData =
        $this->originalTranslatedData =
        $this->documentChangesets =
        $this->changesetComputed =
        $this->scheduledUpdates =
        $this->scheduledInserts =
        $this->scheduledMoves =
        $this->scheduledReorders =
        $this->scheduledRemovals =
        $this->visitedCollections =
        $this->documentHistory =
        $this->documentVersion = [];

        $this->invokeGlobalEvent(Event::onClear, new OnClearEventArgs($this->dm));

        $this->session->refresh(false);
    }
1207822
public function delete($recursive = true) {
		$this->deleteImages();
		$this->deleteAlbumDir();

		return parent::delete($recursive);
	}
1094135
public function deleteFromRevision( Revision $revision, array $extraParams = [] ) {
		$this->api->postRequest( new SimpleRequest(
			'delete',
			$this->getDeleteParams( $revision->getPageIdentifier(), $extraParams )
		) );
		return true;
	}
1231369
public function clear()
    {
        $this->id = null;
        $this->code = null;
        $this->en = null;
        $this->de = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
46937
public function postSave()
    {
        if (isset($this->historyLimit) && $this->revisionHistory()->count() >= $this->historyLimit) {
            $LimitReached = true;
        } else {
            $LimitReached = false;
        }
        if (isset($this->revisionCleanup)){
            $RevisionCleanup=$this->revisionCleanup;
        }else{
            $RevisionCleanup=false;
        }

        // check if the model already exists
        if (((!isset($this->revisionEnabled) || $this->revisionEnabled) && $this->updating) && (!$LimitReached || $RevisionCleanup)) {
            // if it does, it means we're updating

            $changes_to_record = $this->changedRevisionableFields();

            $revisions = array();

            foreach ($changes_to_record as $key => $change) {
                $revisions[] = array(
                    'revisionable_type' => $this->getMorphClass(),
                    'revisionable_id' => $this->getKey(),
                    'key' => $key,
                    'old_value' => array_get($this->originalData, $key),
                    'new_value' => $this->updatedData[$key],
                    'user_id' => $this->getSystemUserId(),
                    'created_at' => new \DateTime(),
                    'updated_at' => new \DateTime(),
                );
            }

            if (count($revisions) > 0) {
                if($LimitReached && $RevisionCleanup){
                    $toDelete = $this->revisionHistory()->orderBy('id','asc')->limit(count($revisions))->get();
                    foreach($toDelete as $delete){
                        $delete->delete();
                    }
                }
                $revision = Revisionable::newModel();
                \DB::table($revision->getTable())->insert($revisions);
                \Event::dispatch('revisionable.saved', array('model' => $this, 'revisions' => $revisions));
            }
        }
    }
1086190
public function clear()
    {
        $this->id = null;
        $this->name = null;
        $this->role = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
990962
public function clear()
    {
        foreach(FileUtil::enumAll($this->savePath) as $fileName)
        {
            if(is_file($fileName))
            {
                unlink($fileName);
            }
            else if(is_dir($fileName))
            {
                rmdir($fileName);
            }
        }
    }
14359
public function delete()
    {
        $this->getLogger()->info('Deleting resolution ID ' . $this->resolutionId);
        $this->doDelete('/resolution/' . $this->resolutionId);

        return true;
    }
968966
public function clear()
    {
        $this->id = null;
        $this->max_clients = null;
        $this->domain = null;
        $this->valid_until = null;
        $this->serial = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
671214
public function clear(): void
    {
        $this->errors = [];
        if (file_exists($this->cacheFileName())) {
            @unlink($this->cacheFileName());
        }
    }