@@ -66,14 +66,16 @@ discard block |
||
66 | 66 | $this->backupRootPath = Yii::getAlias($this->backupFolder); |
67 | 67 | |
68 | 68 | try { |
69 | - if (!file_exists($this->backupRootPath)) |
|
70 | - mkdir($this->backupRootPath); |
|
69 | + if (!file_exists($this->backupRootPath)) { |
|
70 | + mkdir($this->backupRootPath); |
|
71 | + } |
|
71 | 72 | } catch (ErrorException $e) { |
72 | 73 | throw new ErrorException("Backup folder not exists. Its impossible to create it because of permission error."); |
73 | 74 | } |
74 | 75 | |
75 | - if (!is_writable($this->backupRootPath)) |
|
76 | - throw new ErrorException("Backup folder is not writable."); |
|
76 | + if (!is_writable($this->backupRootPath)) { |
|
77 | + throw new ErrorException("Backup folder is not writable."); |
|
78 | + } |
|
77 | 79 | |
78 | 80 | $this->checkDb(); |
79 | 81 | $this->registerTranslations(); |
@@ -85,9 +87,10 @@ discard block |
||
85 | 87 | */ |
86 | 88 | public function checkConfig(string $config_id) |
87 | 89 | { |
88 | - foreach (Yii::$app->getModule('backup')->configs as $config) |
|
89 | - if ($config['id'] == $config_id) |
|
90 | + foreach (Yii::$app->getModule('backup')->configs as $config) { |
|
91 | + if ($config['id'] == $config_id) |
|
90 | 92 | return true; |
93 | + } |
|
91 | 94 | return false; |
92 | 95 | } |
93 | 96 |
@@ -44,16 +44,19 @@ |
||
44 | 44 | { |
45 | 45 | $this->_configs = Yii::$app->getModule('backup')->configs; |
46 | 46 | |
47 | - if (!is_array($this->_configs) || !sizeof($this->_configs)) |
|
48 | - throw new InvalidConfigException('Backup module need to be configured with `config array`'); |
|
47 | + if (!is_array($this->_configs) || !sizeof($this->_configs)) { |
|
48 | + throw new InvalidConfigException('Backup module need to be configured with `config array`'); |
|
49 | + } |
|
49 | 50 | |
50 | 51 | foreach ($this->_configs as $config) { |
51 | - if (isset($config['id']) && $config['id'] == $model->config_id) |
|
52 | - $this->_currentConfig = $config; |
|
52 | + if (isset($config['id']) && $config['id'] == $model->config_id) { |
|
53 | + $this->_currentConfig = $config; |
|
54 | + } |
|
53 | 55 | } |
54 | 56 | |
55 | - if (!$this->_currentConfig) |
|
56 | - throw new ErrorException("Config `{$model->config_id}` not found."); |
|
57 | + if (!$this->_currentConfig) { |
|
58 | + throw new ErrorException("Config `{$model->config_id}` not found."); |
|
59 | + } |
|
57 | 60 | |
58 | 61 | $this->_model = $model; |
59 | 62 | $this->backupFilePath = Yii::getAlias(Yii::$app->getModule('backup')->backupFolder . DIRECTORY_SEPARATOR . $this->_model->filename); |