Removes the storage type if no configurations exist.

@throws \Exception

@return bool
966868
public function delete()
    {
        $list = StorageLocation::getList();
        foreach ($list as $item) {
            if ($item->getTypeObject()->getHandle() == $this->getHandle()) {
                throw new \Exception(t('Please remove all storage locations using this storage type.'));
            }
        }

        $em = \ORM::entityManager();
        $em->remove($this);
        $em->flush();

        return true;
    }
1351697
public function clear()
    {
        $result = parent::clear();

        $this->_data = KObjectConfig::unbox($this->getConfig()->data);

        return $result;
    }
669263
public static function destruct()
    {
        if (is_null(self::$_file) || !is_resource(self::$_file)) {
            return false;
        }

        try {
            fclose(self::$_file);
        } catch (Exception $e) {
            return false;
        }
        return true;
    }
1228231
public function remove()
    {
        $f = json_decode(file_get_contents(FEnv::get("framework.root").
            "elements/config_files/core/apps.json"));
        foreach ($f as $one => $val) {
            if ($val->name == $this->name) {
                unset($f->$one);
                break;
            }
        }

        $f = json_encode($f, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.root")."elements/config_files/core/apps.json", $f);

        Server::delete(FEnv::get("framework.root")."apps/".$this->name, "directory");
        Server::delete(
            FEnv::get("framework.root")."public/components/apps/".strtolower($this->name),
            'directory'
        );
    }
741115
public function delete() {
        if (!$this->is_writable()) {
            return false;
        }

        if ($this->is_directory()) {
            $filepath = $this->lf->get_filepath();
            $fs = get_file_storage();
            $storedfiles = $fs->get_area_files($this->context->id, $this->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid());
            foreach ($storedfiles as $file) {
                if (strpos($file->get_filepath(), $filepath) === 0) {
                    $file->delete();
                }
            }
        }

        return $this->lf->delete();
    }
1122632
public function clear()
    {
        if ($this->storageAdapter->has($this->key)) {
            $this->storageAdapter->remove($this->key);
        }
    }
388687
public function removeIndex()
    {
        try {
            return $this->getElasticClient()->delete($this->basicElasticParams(true));
        }
        catch (Missing404Exception $e) {
            return false;
        }
    }
240840
protected function doUninstall()
    {
        $this->container->getAcumulusEntryManager()->uninstall();

        // Delete all config values.
        $this->registry->load->model('setting/setting');
        $this->registry->model_setting_setting->deleteSetting('acumulus_siel');

        return true;
    }
1150464
public function remove()
    {
        //dallocate shared memory
        if (!shm_remove($this->shm)) {
            return false;
        }
        $this->dettach();
        // shm_remove maybe not working. it likes a php bug.
        unset($this->shm);

        return true;
    }
392826
public function delete()
  {
    $file = $this->file;

    if (file_exists($file)) return Filesystem::delete($file);

    return false;
  }
1017008
protected function forgetFormatted()
    {
        if ($this->files->exists($compiled_path = $this->config['compiled_path'])) {
            return $this->files->delete($compiled_path);
        }

        return false;
    }
737108
public function close()
    {
        if($this->getType() == 'temp')
        {
            if(parent::close() == true)
            {
                //Only unlink temporary files
                if($this->getType() == 'temp') {
                    $this->unlink();
                }

                return true;
            }
        }

        if($this->getType() == 'memory') {
            return $this->flush();
        }

        return false;
    }
992949
public function clear()
    {
        $keys = self::$instance->keys($this->options['prefix'].'*');
        if ($keys) {
            self::$instance->del(...$keys);
        }

        return true;
    }
553190
public function actionCleanup()
    {
        $fileList = StorageImporter::getOrphanedFileList();

        if ($fileList === false) {
            return $this->outputError("Could not find the storage folder to clean up.");
        }
        
        if (count($fileList) > 0) {
            foreach ($fileList as $fileName) {
                $this->output($fileName);
            }
            $this->outputInfo(count($fileList) . " files to remove.");
        }

        if (count($fileList) !== 0) {
            $success = true;
            if ($this->confirm("Do you want to delete " . count($fileList) . " files which are not referenced in the database any more? (can not be undon, maybe create a backup first!)")) {
                foreach ($fileList as $file) {
                    if (is_file($file) && @unlink($file)) {
                        $this->outputSuccess($file . " successful deleted.");
                    } elseif (is_file($file)) {
                        $this->outputError($file . " could not be deleted!");
                        $success = false;
                    } else {
                        $this->outputError($file . " could not be found!");
                        $success = false;
                    }
                }
            }
            if ($success) {
                return $this->outputSuccess(count($fileList) . " files successful deleted.");
            }
            return $this->outputError("Cleanup could not be completed. Please look into error above.");
        }
        
        return $this->outputSuccess("No orphaned files found.");
    }
1038246
public function clear() {
		if ( ! $this->enabled ) {
			return false;
		}

		$finder = $this->get_finder();

		foreach ( $finder as $file ) {
			unlink( $file->getRealPath() );
		}

		return true;
	}
329418
public function clear()
	{
		$filePath = $this->options['file.path'];
		$this->checkFilePath($filePath);

		$iterator = new \RegexIterator(
			new \RecursiveIteratorIterator(
				new \RecursiveDirectoryIterator($filePath)
			),
			'/\.data$/i'
		);

		/* @var  \RecursiveDirectoryIterator  $file */
		foreach ($iterator as $file)
		{
			if ($file->isFile())
			{
				@unlink($file->getRealPath());
			}
		}

		return true;
	}
1305714
public function clear()
    {
        foreach ($this->filesystem()->listContents() as $file) {
            $this->filesystem()->delete($file['path']);
        }

        return true;
    }