| Conditions | 4 |
| Paths | 15 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function process() |
||
| 38 | { |
||
| 39 | call_user_func_array($this->builder->getMessageCb(), ['CONFIG', 'Importing config']); |
||
| 40 | |||
| 41 | try { |
||
| 42 | $themes = array_reverse($this->config->getTheme()); |
||
| 43 | $count = 0; |
||
| 44 | $max = count($themes); |
||
| 45 | foreach ($themes as $theme) { |
||
| 46 | $count++; |
||
| 47 | $themeConfigFile = $this->config->getThemesPath().'/'.$theme.'/'.self::THEME_CONFIG_FILE; |
||
| 48 | if (Util::getFS()->exists($themeConfigFile)) { |
||
| 49 | $themeConfig = Yaml::parse( |
||
| 50 | file_get_contents($themeConfigFile) |
||
| 51 | ); |
||
| 52 | $this->config->import($themeConfig); |
||
| 53 | $message = sprintf('%s: config imported', $theme); |
||
| 54 | } else { |
||
| 55 | $message = sprintf('%s: no config file', $theme); |
||
| 56 | } |
||
| 57 | call_user_func_array($this->builder->getMessageCb(), ['CONFIG_PROGRESS', $message, $count, $max]); |
||
| 58 | } |
||
| 59 | } catch (Exception $e) { |
||
| 60 | echo $e->getMessage()."\n"; |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 |