/** * Clean var/generation, var/di and var/cache * * @return void */ public function cleanGeneratedFiles() { if ($this->write->isExist(self::REGENERATE_FLAG)) { $enabledCacheTypes = []; //TODO: to be removed in scope of MAGETWO-53476 $deploymentConfig = $this->directoryList->getPath(DirectoryList::CONFIG); $configPool = new ConfigFilePool(); $envPath = $deploymentConfig . '/' . $configPool->getPath(ConfigFilePool::APP_ENV); if ($this->write->isExist($this->write->getRelativePath($envPath))) { $enabledCacheTypes = $this->getEnabledCacheTypes(); $this->disableAllCacheTypes(); } //TODO: Till here $cachePath = $this->write->getRelativePath($this->directoryList->getPath(DirectoryList::CACHE)); $generationPath = $this->write->getRelativePath($this->directoryList->getPath(DirectoryList::GENERATION)); $diPath = $this->write->getRelativePath($this->directoryList->getPath(DirectoryList::DI)); // Clean var/generation dir if ($this->write->isDirectory($generationPath)) { $this->write->delete($generationPath); } // Clean var/di if ($this->write->isDirectory($diPath)) { $this->write->delete($diPath); } // Clean var/cache if ($this->write->isDirectory($cachePath)) { $this->write->delete($cachePath); } $this->write->delete(self::REGENERATE_FLAG); $this->enableCacheTypes($enabledCacheTypes); } }
/** * Create physical certificate file based on DB data * * @param string $file * @return void */ protected function _createCertFile($file) { if ($this->varDirectory->isDirectory(self::BASEPATH_PAYPAL_CERT)) { $this->_removeOutdatedCertFile(); } $this->varDirectory->writeFile($file, $this->encryptor->decrypt($this->getContent())); }
/** * Checks if directory exists and is readable * * @param \Magento\Framework\Filesystem\Directory\WriteInterface $directory * @return bool */ protected function isReadableDirectory($directory) { if (!$directory->isExist() || !$directory->isDirectory() || !$directory->isReadable()) { return false; } return true; }