Esempio n. 1
0
 public function getConfig(StorageEngineType $type, $link)
 {
     if (!isset($this->configs[$type->getId()][$link])) {
         return array();
     }
     return $this->configs[$type->getId()][$link];
 }
Esempio n. 2
0
 public final function __construct($linkId)
 {
     if ($linkId) {
         $this->linkId = $linkId;
     }
     $config = StorageConfig::me()->getConfig(StorageEngineType::getByClass(get_class($this)), $this->linkId);
     $this->parseConfig($config);
     if (isset($config['keepFiles']) && $config['keepFiles']) {
         $this->keepFiles = true;
     }
     if (isset($config['retries']) && $config['retries'] > 1) {
         $this->retries = $config['retries'];
     }
     if (isset($config['timeout'])) {
         $this->timeout = $config['timeout'];
     }
     if (isset($config['httpTimeout'])) {
         $this->httpTimeout = $config['httpTimeout'];
     }
 }
Esempio n. 3
0
 public function __destruct()
 {
     if ($this->isRemoved()) {
         try {
             $engine = $this->engineTypeId;
             $config = $this->engineConfig;
             if ($this->baseStorageEngineId) {
                 // Меняли, но не сохранили
                 $engine = $this->baseStorageEngineId;
                 $config = $this->baseStorageEngineConfig;
             }
             $storage = StorageEngine::create(StorageEngineType::create($engine), $config);
             $storage->remove($this->getFileName());
         } catch (Exception $e) {
         }
     }
 }