Deletes the file associated with the owner.
@throws CException if the file cannot be deleted or if the file id cannot be removed from the owner model.
2041
public function deleteFile()
    {
        if (!$this->getManager()->deleteModel($this->owner->{$this->idAttribute})) {
            throw new CException('Failed to delete file.');
        }
        $this->owner->{$this->idAttribute} = null;
        if (!$this->owner->save(false)) {
            throw new CException('Failed to remove file id from owner.');
        }
    }
938265
def api_delete(service, file_id, owner_token):
    """"""
    service += 'api/delete/%s' % file_id
    r = requests.post(service, json={'owner_token': owner_token, 'delete_token': owner_token})
    r.raise_for_status()

    if r.text == 'OK':
        return True
    return False
675089
public static void delete(final @NonNull File file) throws IOException
	{
		if (file.isDirectory())
		{
			DeleteFileExtensions.deleteAllFiles(file);
		}
		else
		{
			String error = null;
			// If the file is not deleted
			if (!file.delete())
			{
				error = "Cannot delete the File " + file.getAbsolutePath() + ".";

				throw new IOException(error);

			}
		}
	}
256218
public function delete(string $id)
    {
        $this->setFile($id);
        if (file_exists($this->file)) {
            if ($this->versionamento) {
                $dadosAtuais = $this->get($id);
                $dadosAtuais['userlogin-action'] = "delete";
                unset($dadosAtuais['id']);
                parent::createVerion($this->file, $dadosAtuais);
            }
            unlink($this->file);
        }
    }
1118702
public function deleteLocalIfExistsOnContentService() {
		/** @var \File $file */
		$file = $this->owner;
		$writer = $this->writer();
		if (!$writer) {
			return;
		}
		// confirm the remote upload is there, and delete the local file
        // Oct 2016 - UNLESS the versioned files extension is on, we have to treat it slightly different
        $reader = $writer->getReader();
        if (!$reader || !$reader->exists()) {
        	return;
        }
        $path = $file->getFullPath();
		if (strlen($path) && is_file($path) && file_exists($path)) {
	        // check if we're a file with versioned on, we need to check the presence of the VersionNumber
	        // before deleting
	        if ($this->owner instanceof FileVersion) {
	            singleton('ContentDeliveryService')->removeLocalFile($path);

	            // and the _parent_ file?
	            $parentFile = $this->owner->File();
				if ($parentFile
					&& $parentFile->ID
					&& $parentFile->CDNFile
					&& file_exists($parentFile->getFullPath())
				) {
	                singleton('ContentDeliveryService')->removeLocalFile($parentFile->getFullPath());
	            }
	        } else {
	            singleton('ContentDeliveryService')->removeLocalFile($path);
	        }
	    }
	}
1268371
public function deleteDocumentFile()
    {
        if ($this->hasCategory('document')) {
            // Get file path
            $path = __DIR__."/../../../web".$this->getDocument();
            // Delete file if exists
            if (is_file($path)) {
                unlink($path);
            }
        }
    }
775894
def delete(self, using=None):
        
        from organizations.exceptions import OwnershipRequired

        try:
            if self.organization.owner.organization_user.pk == self.pk:
                raise OwnershipRequired(
                    _(
                        "Cannot delete organization owner "
                        "before organization or transferring ownership."
                    )
                )
        # TODO This line presumes that OrgOwner model can't be modified
        except self._org_owner_model.DoesNotExist:
            pass
        super(AbstractBaseOrganizationUser, self).delete(using=using)
917262
public void delete() throws IOException {

        try {
            load(false);
            ensureLock();
            m_cms.deleteResource(m_cms.getSitePath(m_resource), CmsResource.DELETE_PRESERVE_SIBLINGS);
            if (!m_resource.getState().isNew()) {
                try {
                    m_cms.unlockResource(m_cms.getSitePath(m_resource));
                } catch (CmsException e) {
                    LOG.warn(e.getLocalizedMessage(), e);
                }
            }
        } catch (CmsException e) {
            throw CmsJlanDiskInterface.convertCmsException(e);
        }
    }
801705
public function delete()
    {
        if (self::$generic_file->canRemoveFiles()) {
            $file_usage_count = 0;

            if (method_exists($this, 'getFileUsageCount')) {
                $file_usage_count = $this->getFileUsageCount($this);
            }

            if ($file_usage_count <= 1) {
                self::$generic_file->delete($this);
            }
        }

        return parent::delete();
    }
1372986
public synchronized void delete() {
		try {
			clear();
		} catch (Exception ign) {
		}
		try {
			close();
		} catch (Exception ign) {
		}
		try {
			fileRedo.delete();
		} catch (Exception ign) {
		}
		try {
			fileStorage.delete();
		} catch (Exception ign) {
		}
		try {
			fileFreeBlocks.delete();
		} catch (Exception ign) {
		}
	}
859848
public function delete()
    {
        if (null !== $this->repository) {
            $this->repository->close();
        }

        $this->file->delete($this->filePath);
        $this->filePath = '';
    }
1011757
public function delete()
    {
        if (!$this->isLoaded()) {
            //Nothing to do, do we need an exception here?
            return;
        }

        $this->dispatch('delete', new DocumentEvent($this));

        //Performing deletion
        $this->odm->collection(static::class)->deleteOne(['_id' => $this->primaryKey()]);
        $this->setField('_id', null, false);
        //Done with deletion

        $this->dispatch('deleted', new DocumentEvent($this));
    }
936818
public function onBeforeDelete()
    {
        $currentVersion = $this->owner->CurrentVersion();

        // make sure there actually is a current version, otherwise we're going
        // to end up deleting a bunch of incorrect stuff!
        if ($currentVersion && $currentVersion->ID > 0) {
            $folder = dirname($this->owner->CurrentVersion()->getFullPath());

            if ($versions = $this->owner->Versions()) {
                foreach ($versions as $version) {
                    $version->delete();
                }
            }

            if (is_dir($folder)) {
                Filesystem::removeFolder($folder);
            }

            // If the _versions folder is now empty - because there are no other versions of any assets - then we can
            // delete the _versions folder
            $folder = dirname($folder); // We want the parent of $folder, as we just deleted $folder
            if (is_dir($folder)) {
                $dir = opendir($folder);
                $foundOtherFile = false;

                while ($file = readdir($dir)) {
                    if (($file == '.' || $file == '..')) {
                        continue;
                    }
                    $foundOtherFile = true;
                }

                if (!$foundOtherFile) {
                    // No other files found, so we can delete the _versions folder
                    rmdir($folder);
                }
            }
        }
    }
268683
public void delete() {
        if (!file.delete()) {
            Storage.LOG.WARN("Failed to delete data file for object %s (%s).", getName(), file.getAbsolutePath());
        }
        if (!getPropertiesFile().delete()) {
            Storage.LOG.WARN("Failed to delete properties file for object %s (%s).",
                    getName(),
                    getPropertiesFile().getAbsolutePath());
        }
    }
500543
public function delete() {

		$this->purge();

		if(!@rmdir($this->path)) {
			throw new FilesystemFolderException(sprintf('Filesystem folder %s could not be deleted!', $this->path));
		}

		self::unsetInstance($this->path);

	}
367810
public function destroy() {
        if (file_exists($this->_fileName)) {
            if (unlink($this->_fileName)) {
                return true;
            }
            else {
                return false;
            }
        }
        else {
            return true;
        }
    }
982531
public void deleteFile(String fileId) throws IOException {
    Preconditions.checkNotNull(fileId, "fileId is required");
    Path p = new Path(fileId);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Deleting path: " + p + " , fileId: " + fileId);
    }
    fileSystem.delete(p, true);
  }