public function __construct(array $config) { if (empty($config['bucket'])) { throw new Storage_Service_Exception('No bucket specified'); } $this->_bucket = $config['bucket']; $this->_internalService = new Zend_Service_Amazon_S3($config['accessKey'], $config['secretKey'], $config['region']); if (!empty($config['path'])) { $this->_path = $config['path']; } else { $this->_path = 'public'; } if (!empty($config['baseUrl'])) { $this->_baseUrl = $config['baseUrl']; unset($config['baseUrl']); // Add http:// if no protocol if (false === strpos($this->_baseUrl, '://')) { $this->_baseUrl = 'http://' . $this->_baseUrl; } } // Should we register the stream wrapper? $this->_streamWrapperName = 's3' . (int) @$config['service_id']; $this->_internalService->registerStreamWrapper($this->_streamWrapperName); parent::__construct($config); }
public function __construct(array $config = array()) { // Get baseUrl if (isset($config['baseUrl'])) { $this->_baseUrl = rtrim($config['baseUrl'], '/'); unset($config['baseUrl']); } else { throw new Storage_Service_Exception('No base URL specified'); } // Get VFS object if (empty($config['adapter'])) { throw new Storage_Service_Exception('Unspecified or unsupported VFS type'); } $adapter = $config['adapter']; unset($config['adapter']); if (!empty($config['params'])) { $params = $config['params']; } else { $params = array(); } unset($config['params']); $this->_vfsConfig = array('adapter' => $adapter, 'params' => $params); //$this->_vfs = Engine_Vfs::factory($adapter, $params); parent::__construct($config); }
public function __construct(array $config) { if (!empty($config['path'])) { $this->_path = $config['path']; } else { $this->_path = 'public'; } if (!empty($config['baseUrl'])) { $this->_baseUrl = $config['baseUrl']; } parent::__construct($config); }
public function __construct(array $config) { // Use specified database if (!empty($config['host']) && !empty($config['username']) && !empty($config['password'])) { $defaultAdapter = Engine_Api::_()->getDbtable('chunks', 'storage')->getAdapter(); $adapterName = strtolower(!empty($config['adapter']) ? $config['adapter'] : array_pop(explode('_', get_class($defaultAdapter)))); $adapterNamespace = $adapterName == 'mysql' ? 'Engine_Db_Adapter' : 'Zend_Db_Adapter'; $this->_adapter = Zend_Db::factory($adapterName, array('host' => $config['host'], 'username' => $config['username'], 'password' => $config['password'], 'dbname' => $config['dbname'], 'adapterNamespace' => $adapterNamespace)); $this->_table = new Storage_Model_DbTable_Chunks(array('adapter' => $this->_adapter)); } else { $this->_table = Engine_Api::_()->getDbtable('chunks', 'storage'); $this->_adapter = $this->_table->getAdapter(); } parent::__construct($config); }
public function __construct(array $config = array()) { // Get services if (!empty($config['services'])) { $this->_services = $config['services']; } else { $serviceTable = Engine_Api::_()->getDbtable('services', 'storage'); $this->_services = $serviceTable->select()->from($serviceTable, 'service_id')->where('enabled = ?', true)->query()->fetchAll(Zend_Db::FETCH_COLUMN); } // Do not allow self $this->_services = array_diff($this->_services, (array) $config['service_id']); // Whoops, no services if (empty($this->_services)) { throw new Storage_Service_Exception('No services available.'); } parent::__construct($config); }