Exemplo n.º 1
0
 /**
  * @param Core_Engine  $engine
  * @param Output_Stack $output
  * @param array        $options
  *
  * @return \Storage_Filesystem
  */
 public function __construct($identity, $engine, $output, $options)
 {
     // filesystem options
     parent::__construct($identity, $engine, $output, $options);
     // test options
     if (!array_key_exists('storage', $this->_options)) {
         $this->_out->stop("parameter 'storage' is required by driver '{$this->_identity}'");
     }
     if (!in_array($this->_options['ifexists'], array('exit', 'use'))) {
         // TODO recreate - drop and create, keep - use and don't drop in the end
         $this->_out->stop("invalid value of parameter 'ifexists' detected by driver '{$this->_identity}'");
     }
     if (!isset($this->_options['key'], $this->_options['key']['access'])) {
         throw new Core_StopException("You have to define Amazon RDS option key.access.", "MysqlAmazonRdsInit");
     }
     if (!isset($this->_options['key']['secret'])) {
         throw new Core_StopException("You have to define Amazon RDS option key.secret.", "MysqlAmazonRdsInit");
     }
     // check if we know the mysql storage
     $this->_mysql = $this->_engine->getStorage($this->_options['storage']);
     $this->setBaseDir($this->_mysql->getBaseDir());
 }