Esempio n. 1
0
 /**
  * Check if configuration file is writable
  *
  * @return bool
  */
 public function checkIfWritable()
 {
     $configDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG);
     foreach ($this->reader->getFiles() as $file) {
         if (!$configDirectory->isWritable($file)) {
             return false;
         }
     }
     return true;
 }
Esempio n. 2
0
 public function testGetFile()
 {
     $object = new Reader($this->dirList, $this->driverPool, $this->configFilePool);
     $files = $object->getFiles();
     $this->assertArrayHasKey('configKeyOne', $files);
     $this->assertArrayHasKey('configKeyTwo', $files);
     $object = new Reader($this->dirList, $this->driverPool, $this->configFilePool, 'customOne.php');
     $this->assertEquals(['customOne.php'], $object->getFiles());
 }
 /**
  * Removes deployment configuration
  *
  * @return void
  */
 private function deleteDeploymentConfig()
 {
     $configDir = $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG);
     $configFiles = $this->deploymentConfigReader->getFiles();
     foreach ($configFiles as $configFile) {
         $absolutePath = $configDir->getAbsolutePath($configFile);
         if (!$configDir->isFile($configFile)) {
             $this->log->log("The file '{$absolutePath}' doesn't exist - skipping cleanup");
             continue;
         }
         try {
             $this->log->log($absolutePath);
             $configDir->delete($configFile);
         } catch (FileSystemException $e) {
             $this->log->log($e->getMessage());
         }
     }
 }