/** * Returns data array of stream variables * * @return array */ public function stream_stat() { if (!$this->_objectName) { return false; } $stat = array(); $stat['dev'] = 0; $stat['ino'] = 0; $stat['mode'] = 0777; $stat['nlink'] = 0; $stat['uid'] = 0; $stat['gid'] = 0; $stat['rdev'] = 0; $stat['size'] = 0; $stat['atime'] = 0; $stat['mtime'] = 0; $stat['ctime'] = 0; $stat['blksize'] = 0; $stat['blocks'] = 0; if (($slash = strchr($this->_objectName, '/')) === false || $slash == strlen($this->_objectName) - 1) { /* bucket */ $stat['mode'] |= 040000; } else { $stat['mode'] |= 0100000; } $info = $this->_s3->getInfo($this->_objectName); if (!empty($info)) { $stat['size'] = $info['size']; $stat['atime'] = time(); $stat['mtime'] = $info['mtime']; } return $stat; }
/** * Get a key/value array of metadata for the given path. * * @param string $path * @param array $options * @return array */ public function fetchMetadata($path, $options = array()) { try { return $this->_s3->getInfo($this->_getFullPath($path, $options)); } catch (\ZendService\Amazon\S3\Exception $e) { throw new Exception\RuntimeException('Error on fetch: ' . $e->getMessage(), $e->getCode(), $e); } }