コード例 #1
0
 /**
  * Recieves all configuration values and sets up this instance
  *
  * All configuration should be handled here
  *
  * @param array $config
  */
 protected function configure($config)
 {
     // Configurable instance variables (if not set, use the instance default)
     $this->debug = isset($config['enable-debug-mode']) ? $config['enable-debug-mode'] : $this->debug;
     $this->folderIcon = $config['icons']['path'] . $config['icons']['directory'];
     $this->bucket = isset($config['s3-bucket']) ? $config['s3-bucket'] : $this->bucket;
     $this->rootDirectory = isset($config['doc_root']) ? trim($config['doc_root'], '/ ') : $this->rootDirectory;
     $this->createRootDir = isset($config['create-root-dir']) ? $config['create-root-dir'] : $this->createRootDir;
     $this->domain = isset($config['s3-public-domain']) ? $config['s3-public-domain'] : $this->domain;
     $this->cacheScheme = isset($config['aws-cache-scheme']) ? $config['aws-cache-scheme'] : $this->cacheScheme;
     $this->cacheExpire = isset($config['aws-cache-expirein']) ? $config['aws-cache-expirein'] : $this->cacheExpire;
     $this->uploadMaxMb = isset($config['upload']['size']) ? (int) $config['upload']['size'] : $this->uploadMaxMb;
     // if we are in debug mode, auto-expire cache
     $this->cacheExpire = $this->debug ? self::DEFAULT_CACHE_EXPIRE : $this->cacheExpire;
     // set global static credentials
     CFCredentials::set(array('@default' => array('key' => $config['aws-access-key'], 'secret' => $config['aws-secret-key'], 'default_cache_config' => $this->cacheScheme, 'certificate_authority' => false)));
     // Instantiate the AmazonS3 class (we should probably be injecting this)
     $this->s3 = new AmazonS3();
     // if we are in debug mode put the http-client into debug mode
     $this->s3->enable_debug_mode($this->debug);
 }