delete: Delete a bucket.
@link https://docs.qingcloud.com/qingstor/api/bucket/delete.html Documentation URL
@return Unpacker
@throws \Exception
436055
public function delete()
    {
        $req = $this->deleteRequest();
        $retries = $this->config->connection_retries;
        $response = null;
        while (1) {
            try {
                $GLOBALS['logger']->info('Sending QingStor request: delete');
                $response = new Unpacker($this->config->client->send(
                    $req->sign()
                ));
                break;
            } catch (\Exception $e) {
                $GLOBALS['logger']->error($e->getMessage());
                if ($retries > 0) {
                    $retries -= 1;
                } else {
                    throw new \Exception('Network Error');
                }
            }
        }
        return $response;
    }
535608
protected function handleDELETE()
    {
        $force = $this->request->getParameterAsBool('force', false);
        $noCheck = $this->request->getParameterAsBool('no_check', false);
        $contentOnly = $this->request->getParameterAsBool('content_only', false);

        if (empty($this->folderPath)) {
            // delete just folders and files from the container
            if (!empty($content = ResourcesWrapper::unwrapResources($this->request->getPayloadData()))) {
                $result = $this->deleteFolderContent($content, '', $force);
            } else {
                throw new BadRequestException('No resources given for delete.');
            }
        } else {
            if (empty($this->filePath)) {
                // delete directory of files and the directory itself
                // multi-file or folder delete via post data
                if (!empty($content = ResourcesWrapper::unwrapResources($this->request->getPayloadData()))) {
                    $result = $this->deleteFolderContent($content, $this->folderPath, $force);
                } else {
                    $this->driver->deleteFolder($this->container, $this->folderPath, $force, $contentOnly);
                    $result = ['name' => basename($this->folderPath), 'path' => $this->folderPath];
                }
            } else {
                // delete file from permanent storage
                $this->driver->deleteFile($this->container, $this->filePath, $noCheck);
                $result = ['name' => basename($this->filePath), 'path' => $this->filePath];
            }
        }

        return ResponseFactory::create(ResourcesWrapper::cleanResources($result));
    }
436379
public function delete()
    {
        $em = $this->getManager()->getEntityManager();
        $lftField = $this->getLeftFieldName();
        $rgtField = $this->getRightFieldName();

        $oldLft = $this->getLeftValue();
        $oldRgt = $this->getRightValue();
        $oldRoot = $this->hasManyRoots() ? $this->getRootValue() : null;

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            $qb = $em->createQueryBuilder()
                ->delete(get_class($this->getNode()), 'n')
                ->where("n.$lftField >= ?1")
                ->setParameter(1, $oldLft)
                ->andWhere("n.$rgtField <= ?2")
                ->setParameter(2, $oldRgt);
            if($this->hasManyRoots())
            {
                $qb->andWhere("n.".$this->getRootFieldName()." = ?3")
                    ->setParameter(3, $oldRoot);
            }
            $qb->getQuery()->execute();
            $this->getManager()->removeNodes($oldLft, $oldRgt, $oldRoot);

            // Close gap in tree
            $first = $oldRgt + 1;
            $delta = $oldLft - $oldRgt - 1;
            $this->shiftRLRange($first, 0, $delta, $oldRoot);

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }
439648
public function delete()
    {
        // delete the file (and previous versions of files)
        $filesToDelete = array();
        $storageFolder = $this->getStorageFolder();

        if (file_exists($storageFolder)) {
            if ($handle = opendir($storageFolder)) {
                while (false !== ($entry = readdir($handle))) {
                    // only delete if filename starts the the relevant ID
                    if (strpos($entry, $this->ID.'~') === 0) {
                        $filesToDelete[] = $entry;
                    }
                }

                closedir($handle);

                //delete all this files that have the id of this document
                foreach ($filesToDelete as $file) {
                    $filePath = $storageFolder .DIRECTORY_SEPARATOR . $file;

                    if (is_file($filePath)) {
                        unlink($filePath);
                    }
                }
            }
        }

        // get rid of any versions have saved for this DMSDocument, too
        if (DMSDocument_versions::$enable_versions) {
            $versions = $this->getVersions();

            if ($versions->Count() > 0) {
                foreach ($versions as $v) {
                    $v->delete();
                }
            }
        }

        return parent::delete();
    }
1177325
public function deleteAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Team::getModuleCode(),
                AccessManager::DELETE)
        ) {
            return $response;
        }

        $con = Propel::getConnection();
        $con->beginTransaction();
        try {
            // Check token
            $this->getTokenProvider()->checkToken(
                $this->getRequest()->query->get("_token")
            );

            $this->getService()->deleteFromId($this->getRequest()->request->get(static::CONTROLLER_ENTITY_NAME . "_id"));
            $con->commit();
            if ($response == null) {
                return $this->redirectToListTemplate();
            } else {
                return $response;
            }
        } catch (\Exception $e) {
            $con->rollBack();

            return $this->renderAfterDeleteError($e);
        }
    }
1057392
public function delete() {
        $url = "entities";

        if ($this->_id) {
            $url .= "/{$this->_id}";
        }

        if ($this->_type) {
            $url .= "?type={$this->_type}";
        }

        return $this->_orion->delete($url);
    }
870336
public function postDelete()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:object:delete')) {
            throw new ApiException(
                'You do not have permission to access this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput    = Factory::service('Input');
        $oCdn      = Factory::service('Cdn', 'nails/module-cdn');
        $iObjectId = $oInput->post('object_id');

        if (empty($iObjectId)) {
            throw new ApiException(
                '`object_id` is a required field',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oObject  = $oCdn->getObject($iObjectId);
        $bIsTrash = false;
        if (empty($oObject)) {
            $oObject  = $oCdn->getObjectFromTrash($iObjectId);
            $bIsTrash = true;
        }

        if (empty($oObject)) {
            throw new ApiException(
                'Invalid object ID',
                $oHttpCodes::STATUS_NOT_FOUND
            );
        }

        if ($bIsTrash) {
            $bDelete = $oCdn->purgeTrash([$iObjectId]);
        } else {
            $bDelete = $oCdn->objectDelete($iObjectId);
        }

        if (!$bDelete) {
            throw new ApiException(
                $oCdn->lastError(),
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api');
    }
85533
public function deleteRequest()
    {
        $operation = array(
            'API' => 'DeleteBucket',
            'Method' => 'DELETE',
            'Uri' => '/<bucket-name>',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->deleteValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
516068
public function delete(){
        return X::app()->db->table(self::tableName())->delete([self::$pk=>$this->{self::$pk}]);
    }
954363
public function delete()
    {
        $table = $this->table;
        $pk = $this->_data[$table->getPrimaryKey()];

        $query = "DELETE FROM {$table->getTableName()} WHERE ";
        $query .= "{$table->getPrimaryKey()} = $pk";

        return $this->_delete($query);
    }
754319
public function delete()
    {
        if (isset($this->onDelete)) {
            return call_user_func($this->onDelete, $this);
        }

        return $this->query->delete();
    }
1005581
public function delete()
    {
        $mapper = Pheasant::instance()->mapperFor($this);

        $this->events()->wrap(array('Delete'), $this, function($obj) use ($mapper) {
            $mapper->delete($obj);

            // ensure we clear the changes before after events fire
            $obj->markSaved(false)->clearChanges();
        });

        return $this;
    }
522882
protected function handleDELETE()
    {
        /** @var BaseSystemModel $modelClass */
        $modelClass = static::$model;
        $options = $this->request->getParameters();

        if (!empty($this->resource)) {
            return $modelClass::deleteById($this->resource, $options);
        }

        if (!empty($ids = array_get($options, ApiOptions::IDS))) {
            $result = $modelClass::deleteByIds($ids, $options);
        } else {
            $records = ResourcesWrapper::unwrapResources($this->getPayloadData());
            if (!empty($records)) {
                $result = $modelClass::bulkDelete($records, $options);
            } else {
                $filter = array_get($options, ApiOptions::FILTER);
                if (!empty($filter)) {
                    $params = array_get($options, ApiOptions::PARAMS, []);
                    $result = $modelClass::deleteByFilter($filter, $params, $options);
                } else {
                    if (!array_get_bool($options, ApiOptions::FORCE)) {
                        throw new BadRequestException('No filter or records given for delete request.');
                    }

                    return $modelClass::truncate($options);
                }
            }
        }

        $asList = $this->request->getParameterAsBool(ApiOptions::AS_LIST);
        $idField = $this->request->getParameter(ApiOptions::ID_FIELD, static::getResourceIdentifier());
        $result = ResourcesWrapper::cleanResources($result, $asList, $idField, ApiOptions::FIELDS_ALL);

        return $result;
    }
655156
public function deleteLifecycleRequest()
    {
        $operation = array(
            'API' => 'DeleteBucketLifecycle',
            'Method' => 'DELETE',
            'Uri' => '/<bucket-name>?lifecycle',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->deleteLifecycleValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
263079
public function delete()
    {
        $this->triggerEvent('onBeforeDelete');

        $this->getFlexDirectory()->getStorage()->deleteRows([$this->getStorageKey() => $this->prepareStorage()]);

        try {
            $this->getFlexDirectory()->clearCache();
            if (method_exists($this, 'clearMediaCache')) {
                $this->clearMediaCache();
            }
        } catch (InvalidArgumentException $e) {
            /** @var Debugger $debugger */
            $debugger = Grav::instance()['debugger'];
            $debugger->addException($e);

            // Caching failed, but we can ignore that for now.
        }

        $this->triggerEvent('onAfterDelete');

        return $this;
    }
1221264
public function delete()
    {
        if (!$this->hasRequestParameter('uri') || !$this->hasRequestParameter('path') || !$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter();
        }

        $item = $this->getResource($this->getRequestParameter('uri'));
        $itemLang = $this->getRequestParameter('lang');

        $resolver = new ItemMediaResolver($item, $itemLang);
        $asset = $resolver->resolve($this->getRequestParameter('path'));
        $deleted = $asset->getMediaSource()->delete($asset->getMediaIdentifier());

        return $this->returnJson(array('deleted' => $deleted));
    }
661034
public function delete(){

        foreach($this->_items as $key => $item){
            if($item->exists()){
                $deleted = $item->delete();
                if($deleted){
                   unset($this->_items[$key]);
                }
            }
        }

        return $this;

    }