/** * Constructor * * @param array $config */ public function __construct($config) { parent::__construct($config); $options =& $this->_config['driver_options']; if (!array_key_exists('type', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'type' for the database type to use"); } if (!array_key_exists('host', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'host' for the host to use"); } if (!array_key_exists('username', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'username' for the username to use"); } if (!array_key_exists('password', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'password' for the password to use"); } if (!array_key_exists('dbname', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'dbname' for the database to use"); } /** * @see Zend_Db */ require_once 'Zend/Db.php'; $db = Zend_Db::factory($options['type'], $options); /** * @see Zend_Db_Table_Abstract */ require_once 'Zend/Db/Table/Abstract.php'; Zend_Db_Table_Abstract::setDefaultAdapter($db); /** * @see Zend_Queue_Adapter_Db_Queue */ require_once 'Zend/Queue/Adapter/Db/Queue.php'; $this->_queue = new Zend_Queue_Adapter_Db_Queue(); /** * @see Zend_Queue_Adapter_Db_Message */ require_once 'Zend/Queue/Adapter/Db/Message.php'; $this->_message = new Zend_Queue_Adapter_Db_Message(); }
/** * Constructor * * @param array $config */ public function __construct($config) { parent::__construct($config); $data =& $this->_config['driver_options']['data']; if (isset($data) && is_array($data)) { $this->_data = $data; } }
/** * Constructor * * @param array $config */ public function __construct($config) { parent::__construct($config); $options =& $this->_config['driver_options']; if (!array_key_exists('scheme', $options)) { $options['scheme'] = self::DEFAULT_SCHEME; } if (!array_key_exists('host', $options)) { $options['host'] = self::DEFAULT_HOST; } if (!array_key_exists('port', $options)) { $options['port'] = self::DEFAULT_PORT; } if (!array_key_exists('username', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'username' for the username to use"); } if (!array_key_exists('password', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'password' for the password to use"); } $this->_socket = fsockopen($options['scheme'] . '://' . $options['host'], $options['port'], $errno, $errstr); if (!$this->_socket) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Unable to connect to '" . $options['scheme'] . '://' . $options['host'] . ':' . $options['port'] . "'"); } $headers = array('login' => $options['username'], 'passcode' => $options['password']); $response = $this->_makeRequest('CONNECT', $headers); if ($response['command'] != 'CONNECTED') { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Unable to authenticate to '" . $options['scheme'] . '://' . $options['host'] . ':' . $options['port'] . "'"); } }
/** * Constructor * * @param array $config */ public function __construct($config) { parent::__construct($config); $options =& $this->_config['driver_options']; if (!array_key_exists('access_key', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'access_key' for the Amazon AWS Access Key to use"); } if (!array_key_exists('secret_key', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'secret_key' for the Amazon AWS Secret Key to use"); } }
/** * Constructor * * @param array $config */ public function __construct($config) { parent::__construct($config); $options =& $this->_config['driver_options']; if (!array_key_exists('type', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'type' for the cache type to use"); } switch ($options['type']) { case 'Memcached': if (!array_key_exists('servers', $options)) { /** * @see Zend_Queue_Adapter_Exception */ require_once 'Zend/Queue/Adapter/Exception.php'; throw new Zend_Queue_Adapter_Exception("Configuration array must have a key for 'servers' for the servers to use"); } break; case 'File': if (!array_key_exists('cache_dir', $options)) { $options['cache_dir'] = self::DEFAULT_CACHE_DIR; } break; case 'Zend_Platform': break; } $frontendOptions = array('lifetime' => 7200, 'automatic_serialization' => true, 'logging' => false, 'write_control' => true); /** * @see Zend_Cache */ require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', $options['type'], $frontendOptions, $options); }