src/Service/Cdn.php
public function bucketDestroy($bucket)
    {
        $oBucket = $this->getBucket($bucket);

        if (!$oBucket) {
            $this->setError('Not a valid bucket');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Destroy any containing objects
        $errors = 0;
        foreach ($oBucket->objects as $obj) {
            if (!$this->objectDestroy($obj->id)) {
                $this->setError('Unable to delete object "' . $obj->file->name->human . '" (ID:' . $obj->id . ').');
                $errors++;
            }
        }

        if ($errors) {

            $this->setError('Unable to delete bucket, bucket not empty.');
            return false;

        } else {

            if ($this->callDriver('bucketDestroy', [$oBucket->slug])) {

                $oDb = Factory::service('Database');
                $oDb->where('id', $oBucket->id);
                $oDb->delete(NAILS_DB_PREFIX . 'cdn_bucket');
                return true;

            } else {

                $this->setError('Unable to remove empty bucket directory. ' . $this->callDriver('lastError'));
                return false;
            }
        }
    }
public function bucketDestroy($bucket)
    {
        $oBucket = $this->getBucket($bucket);

        if (!$oBucket) {
            $this->setError('Not a valid bucket');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Destroy any containing objects
        $errors = 0;
        foreach ($oBucket->objects as $obj) {
            if (!$this->objectDestroy($obj->id)) {
                $this->setError('Unable to delete object "' . $obj->file->name->human . '" (ID:' . $obj->id . ').');
                $errors++;
            }
        }

        if ($errors) {

            $this->setError('Unable to delete bucket, bucket not empty.');
            return false;

        } else {

            if ($this->callDriver('bucketDestroy', [$oBucket->slug])) {

                $oDb = Factory::service('Database');
                $oDb->where('id', $oBucket->id);
                $oDb->delete(NAILS_DB_PREFIX . 'cdn_bucket');
                return true;

            } else {

                $this->setError('Unable to remove empty bucket directory. ' . $this->callDriver('lastError'));
                return false;
            }
        }
    }
public function bucketDestroy ( $ bucket ) { $ oBucket = $ this -> getBucket ( $ bucket ) ; if ( ! $ oBucket ) { $ this -> setError ( 'Not a valid bucket' ) ; return false ; } // -------------------------------------------------------------------------- //  Destroy any containing objects $ errors = 0 ; foreach ( $ oBucket -> objects as $ obj ) { if ( ! $ this -> objectDestroy ( $ obj -> id ) ) { $ this -> setError ( 'Unable to delete object "' . $ obj -> file -> name -> human . '" (ID:' . $ obj -> id . ').' ) ; $ errors ++ ; } } if ( $ errors ) { $ this -> setError ( 'Unable to delete bucket, bucket not empty.' ) ; return false ; } else { if ( $ this -> callDriver ( 'bucketDestroy' , [ $ oBucket -> slug ] ) ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> where ( 'id' , $ oBucket -> id ) ; $ oDb -> delete ( NAILS_DB_PREFIX . 'cdn_bucket' ) ; return true ; } else { $ this -> setError ( 'Unable to remove empty bucket directory. ' . $ this -> callDriver ( 'lastError' ) ) ; return false ; } } }
Permanently delete a bucket and its contents

@param string

@return  boolean
Permanently delete a bucket and its contents