public function listDir($dir) { $dir = rtrim($dir, '/') . '/'; $s3_bucket = $this->cfg['bucket']; $files = $this->client->getBucket($s3_bucket, $dir); $retval = array(); foreach ($files as $file) { $path = $file['name']; if (strrpos($path, '.link') === strlen($path) - 5) { $path = $this->resolveSymlink($path); } if (strpos($path, 'index.xml') !== false) { $asset = new binarypool_asset($this, $path); array_push($retval, $asset->getBasePath() . 'index.xml'); } } return $retval; }
public function listDir($dir) { $files = array(); $absDir = $this->absolutize($dir); if (is_dir($absDir)) { if ($dirhandle = opendir($absDir)) { while (($file = readdir($dirhandle)) !== false) { if ($file != '.' && $file != '..') { $assetFile = $dir . '/' . $file . '/index.xml'; if ($this->isFile($assetFile)) { $asset = new binarypool_asset($this, $assetFile); array_push($files, $asset->getBasePath() . 'index.xml'); } } } closedir($dirhandle); } } return $files; }
/** * Load a created asset file. */ function testLoadAssetFile() { $this->testAssetWithRendition90x90(); $created = time(); $basepath = 'test/somehashhere/'; $basepathAbs = binarypool_config::getRoot() . $basepath; $assetFile = $basepath . 'index.xml'; $asset = new binarypool_asset($this->getDummyStorage(), $assetFile); $this->assertEqual('test/somehashhere/', $asset->getBasePath()); $this->assertEqual($basepathAbs . 'vw_golf.jpg', $asset->getOriginal()); $this->assertEqual($basepathAbs . 'resultlist.jpg', $asset->getRendition('resultlist')); $this->assertEqual(array('resultlist' => $basepathAbs . 'resultlist.jpg'), $asset->getRenditions()); $this->assertEqual('096dfa489bc3f21df56eded2143843f135ae967e', $asset->getHash()); $this->assertWithinMargin($created, $asset->getCreated(), 10); $this->assertEqual('IMAGE', $asset->getType()); }