public function getConfigOption(array $path)
 {
     $origPath = $path;
     $conf = $this->overrides;
     while (($part = array_shift($path)) !== null) {
         if (isset($conf->{$part})) {
             $conf = $conf->{$part};
         } else {
             return parent::getConfigOption($origPath);
         }
     }
     if (is_array($conf) || $conf instanceof \stdClass) {
         $conf = array_merge((array) $conf, (array) parent::getConfigOption($origPath));
         if ($conf instanceof \stdClass) {
             $conf = (object) $conf;
         }
     }
     return $conf;
 }
Ejemplo n.º 2
0
 public function write()
 {
     if (file_exists($this->getConfigFile()->getPathname())) {
         $backupDir = $this->getClicDirectory() . '/settings-backup/' . sha1($this->getConfigFile()->getPathname());
         if (!is_dir($backupDir)) {
             FsUtil::mkdir($backupDir, true);
         }
         $backupFile = $backupDir . '/' . time();
         FsUtil::rename($this->getConfigFile()->getPathname(), $backupFile);
         if (file_exists($backupDir . '/prev')) {
             FsUtil::unlink($backupDir . '/prev');
         }
         FsUtil::symlink($backupFile, $backupDir . '/prev');
     }
     parent::write();
 }