Exemple #1
0
 protected function execute()
 {
     $uri = $this->request->getPath();
     // Deletions allowed on bucket?
     $buckets = binarypool_config::getBuckets();
     if (!isset($buckets[$this->bucket]['allowDeletions']) || $buckets[$this->bucket]['allowDeletions'] == false) {
         throw new binarypool_exception(108, 403, "Deletions not allowed on this bucket.");
     }
     $storage = new binarypool_storage($this->bucket);
     $storage->delete($uri);
     $this->setResponseCode(204);
     $this->response->send();
     $this->ignoreView = true;
 }
Exemple #2
0
    printf("[%10s] Cleaning up symlinks.\n", 'FINAL');
    $cmd = binarypool_config::getUtilityPath('symlinks');
    system("{$cmd} -cdrs " . binarypool_config::getRoot() . "*/created");
    system("{$cmd} -cdrs " . binarypool_config::getRoot() . "*/expiry");
    system("{$cmd} -cdrsv " . binarypool_config::getRoot() . "*/downloaded |grep '/dev/null' |xargs -0 rm");
}
cleanSymlinks();
// Walk through each bucket
$buckets = binarypool_config::getBuckets();
foreach (array_keys($buckets) as $bucket) {
    $storage = new binarypool_storage($bucket);
    printf("[%10s] Fetching list of expired binaries.\n", $bucket);
    $expired = binarypool_browser::getExpired($bucket);
    printf("[%10s] %d expired.\n", $bucket, $expired);
    foreach ($expired as $asset) {
        try {
            if (binarypool_expiry::isExpired($bucket, $asset)) {
                printf("[%10s] Deleting %s\n", $bucket, $asset);
                $storage->delete($asset);
            }
        } catch (binarypool_exception $e) {
            if ($e->getCode() == 112) {
                printf("[%10s] Asset does not exist %s\n", $bucket, $asset);
            } else {
                throw $e;
            }
        }
    }
    printf("[%10s] Done.\n", $bucket, $expired);
}
cleanSymlinks();