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();
/** * Points to a valid callback file. Must be expired. */ function testExpiredWithCallback() { file_put_contents("/tmp/deleteme_callback", "EXPIRED"); $asset = $this->createAsset(array('/tmp/deleteme_callback')); $this->assertTrue(binarypool_expiry::isExpired('test', $asset)); }