Test Setup Failed
Branch master (d800c5)
by Nikolay
24:15
created
www/back-end/library/vendor/clue/stream-filter/src/CallbackFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             } catch (Exception $e) {
78 78
                 // exception should mark filter as closed
79 79
                 $this->onClose();
80
-                trigger_error('Error invoking filter: ' . $e->getMessage(), E_USER_WARNING);
80
+                trigger_error('Error invoking filter: '.$e->getMessage(), E_USER_WARNING);
81 81
 
82 82
                 return PSFS_ERR_FATAL;
83 83
             }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 try {
96 96
                     $data .= call_user_func($this->callback);
97 97
                 } catch (Exception $e) {
98
-                    trigger_error('Error ending filter: ' . $e->getMessage(), E_USER_WARNING);
98
+                    trigger_error('Error ending filter: '.$e->getMessage(), E_USER_WARNING);
99 99
 
100 100
                     return PSFS_ERR_FATAL;
101 101
                 }
Please login to merge, or discard this patch.
www/back-end/library/vendor/clue/stream-filter/examples/base64_decode.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@  discard block
 block discarded – undo
2 2
 
3 3
 // $ echo test | php examples/base64_encode.php | php examples/base64_decode.php
4 4
 
5
-require __DIR__ . '/../vendor/autoload.php';
5
+require __DIR__.'/../vendor/autoload.php';
6 6
 
7 7
 // decoding requires buffering in chunks of 4 bytes each
8 8
 $buffer = '';
9
-Clue\StreamFilter\append(STDIN, function ($chunk = null) use (&$buffer) {
9
+Clue\StreamFilter\append(STDIN, function($chunk = null) use (&$buffer) {
10 10
     if ($chunk === null) {
11 11
         if (strlen($buffer) % 4 !== 0) {
12 12
             throw new UnexpectedValueException('Invalid length');
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
     } else {
16 16
         $buffer .= $chunk;
17 17
         $len = strlen($buffer) - (strlen($buffer) % 4);
18
-        $chunk = (string)substr($buffer, 0, $len);
19
-        $buffer = (string)substr($buffer, $len);
18
+        $chunk = (string) substr($buffer, 0, $len);
19
+        $buffer = (string) substr($buffer, $len);
20 20
     }
21 21
 
22 22
     $ret = base64_decode($chunk, true);
Please login to merge, or discard this patch.
www/back-end/library/vendor/clue/stream-filter/examples/uppercase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 // $ echo test | php examples/uppercase.php
4 4
 
5
-require __DIR__ . '/../vendor/autoload.php';
5
+require __DIR__.'/../vendor/autoload.php';
6 6
 
7 7
 Clue\StreamFilter\append(STDIN, 'strtoupper');
8 8
 
Please login to merge, or discard this patch.
www/back-end/library/vendor/clue/stream-filter/examples/base64_encode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 // $ echo test | php examples/base64_encode.php | base64 --decode
4 4
 
5
-require __DIR__ . '/../vendor/autoload.php';
5
+require __DIR__.'/../vendor/autoload.php';
6 6
 
7 7
 // encoding requires buffering in chunks of 3 bytes each
8 8
 $buffer = '';
9
-Clue\StreamFilter\append(STDIN, function ($chunk = null) use (&$buffer) {
9
+Clue\StreamFilter\append(STDIN, function($chunk = null) use (&$buffer) {
10 10
     if ($chunk === null) {
11 11
         return base64_encode($buffer);
12 12
     }
Please login to merge, or discard this patch.
www/back-end/modules/DiServicesInstall.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function Register($di): void
31 31
     {
32
-        $registeredDBServices=[];
32
+        $registeredDBServices = [];
33 33
         $config = $di->getConfig();
34 34
         // Зарегистрируем сервисы базы данных для модулей расширений
35
-        $results = glob( $config->application->modulesDir . '*/db/*.db', GLOB_NOSORT );
36
-        foreach ( $results as $file ) {
35
+        $results = glob($config->application->modulesDir.'*/db/*.db', GLOB_NOSORT);
36
+        foreach ($results as $file) {
37 37
             $service_name = self::makeServiceName($file, $config->application->modulesDir);
38
-            $registeredDBServices[]=$service_name;
38
+            $registeredDBServices[] = $service_name;
39 39
             $di->set($service_name, function() use ($file) {
40 40
                 return new Sqlite(['dbname' => $file]);
41 41
             });
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
         $mainConnection = $di->get('db');
46 46
 
47 47
         $eventsManager = $mainConnection->getEventsManager();
48
-        if ($eventsManager === null){
48
+        if ($eventsManager === null) {
49 49
             $eventsManager = new Manager();
50 50
         }
51 51
         // Слушаем все события базы данных
52
-        $eventsManager->attach('db', function ($event) use ($registeredDBServices, $di){
53
-            switch ($event->getType()){
52
+        $eventsManager->attach('db', function($event) use ($registeredDBServices, $di){
53
+            switch ($event->getType()) {
54 54
                 case 'beginTransaction':{
55
-                    foreach ($registeredDBServices as $service){
55
+                    foreach ($registeredDBServices as $service) {
56 56
                         $di->get($service)->begin();
57 57
                     }
58 58
                     break;
59 59
                 }
60 60
                 case 'commitTransaction':{
61
-                    foreach ($registeredDBServices as $service){
61
+                    foreach ($registeredDBServices as $service) {
62 62
                         $di->get($service)->commit();
63 63
                     }
64 64
                     break;
65 65
                 }
66 66
                 case 'rollbackTransaction':{
67
-                    foreach ($registeredDBServices as $service){
67
+                    foreach ($registeredDBServices as $service) {
68 68
                         $di->get($service)->rollback();
69 69
                     }
70 70
                     break;
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private static function makeServiceName($filePath, $modulesRoot):string
88 88
     {
89
-        $moduleName=self::findModuleIdByDbPath($filePath, $modulesRoot);
89
+        $moduleName = self::findModuleIdByDbPath($filePath, $modulesRoot);
90 90
         $dbName = pathinfo($filePath)['filename'];
91
-        return  $moduleName.'_'.Text::uncamelize($dbName,'_').'_db';
91
+        return  $moduleName.'_'.Text::uncamelize($dbName, '_').'_db';
92 92
     }
93 93
 
94 94
     /**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      */
100 100
     private static function findModuleIdByDbPath($filePath, $modulesRoot) :string
101 101
     {
102
-        $filePath = str_replace($modulesRoot,'',$filePath);
103
-        return implode('/', array_slice(explode('/', $filePath), 0,1));
102
+        $filePath = str_replace($modulesRoot, '', $filePath);
103
+        return implode('/', array_slice(explode('/', $filePath), 0, 1));
104 104
     }
105 105
 }
106 106
 
Please login to merge, or discard this patch.
www/back-end/modules/Logger.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
         public function __construct($class, $moduleId)
28 28
         {
29 29
             $logPath = System::get_log_dir().'/'.$moduleId.'/';
30
-            $this->logFile    = $logPath.$class.'log';
30
+            $this->logFile = $logPath.$class.'log';
31 31
             $logfilestokeep = 30;
32 32
 
33 33
             if (file_exists($this->logFile)) {
34 34
                 if (date('Y-m-d', filemtime($this->logFile)) !== date('Y-m-d')) {
35
-                    if (file_exists($this->logFile . '.' . $logfilestokeep)) {
36
-                        unlink($this->logFile . '.' . $logfilestokeep);
35
+                    if (file_exists($this->logFile.'.'.$logfilestokeep)) {
36
+                        unlink($this->logFile.'.'.$logfilestokeep);
37 37
                     }
38 38
                     for ($i = $logfilestokeep; $i > 0; $i--) {
39
-                        if (file_exists($this->logFile . '.' . $i)) {
39
+                        if (file_exists($this->logFile.'.'.$i)) {
40 40
                             $next = $i + 1;
41
-                            rename($this->logFile . '.' . $i, $this->logFile . '.' . $next);
41
+                            rename($this->logFile.'.'.$i, $this->logFile.'.'.$next);
42 42
                         }
43 43
                     }
44
-                    rename($this->logFile, $this->logFile . '.1');
44
+                    rename($this->logFile, $this->logFile.'.1');
45 45
                 }
46
-            } elseif (!file_exists($logPath) && !mkdir($logPath, 0777, true) && !is_dir($logPath)){
46
+            } elseif (!file_exists($logPath) && !mkdir($logPath, 0777, true) && !is_dir($logPath)) {
47 47
                     $this->logFile = "/var/log/$moduleId.log";
48 48
             }
49 49
             $this->logger = new FileAdapter($this->logFile);
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 
52 52
         public function write($data, $level = \Phalcon\Logger::ERROR):void
53 53
         {
54
-            $this->logger->log(print_r($data,true));
54
+            $this->logger->log(print_r($data, true));
55 55
         }
56 56
 
57 57
         public function writeError($data, $level = \Phalcon\Logger::ERROR):void
58 58
         {
59
-            $this->logger->log(print_r($data,true));
59
+            $this->logger->log(print_r($data, true));
60 60
         }
61 61
 
62 62
         public function writeInfo($data, $level = \Phalcon\Logger::INFO):void
63 63
         {
64
-            $this->logger->log(print_r($data,true));
64
+            $this->logger->log(print_r($data, true));
65 65
         }
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
www/back-end/modules/LicenseWorker.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     private function curlPostRequest($metod, $data = null)
37 37
     {
38
-        $url = $this->serverUrl . "/license.api/$metod";
38
+        $url = $this->serverUrl."/license.api/$metod";
39 39
         $ch  = curl_init();
40 40
         curl_setopt($ch, CURLOPT_URL, $url);
41 41
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $version = str_replace(PHP_EOL, '', file_get_contents('/etc/version'));
93 93
 
94
-        $data     = [
94
+        $data = [
95 95
             'companyname' => $params['companyname'],
96 96
             'email'       => $params['email'],
97 97
             'contact'     => $params['contact'],
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         $params = "feature={$featureId}";
186 186
         $response = $this->curlPostRequest('capturefeature?'.$params);
187 187
         $data = json_decode($response['result'], true);
188
-        if ($response['code']===200){
188
+        if ($response['code'] === 200) {
189 189
             $this->sessionId = $data['session'];
190 190
             return ['success'=>true];
191 191
         } else {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     {
205 205
         $params = "feature={$featureId}";
206 206
         $response = $this->curlPostRequest('featureavailable?'.$params);
207
-        if ($response['code'] === 200){
207
+        if ($response['code'] === 200) {
208 208
             return ['success'=>true];
209 209
         } else {
210 210
             $data = json_decode($response['result'], true);
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function releaseFeature($featureId) :array
224 224
     {
225
-        if ($this->sessionId){
225
+        if ($this->sessionId) {
226 226
             $params = "session={$this->sessionId}&feature={$featureId}";
227 227
             $response = $this->curlPostRequest('releasefeature?'.$params);
228
-            if ($response['code'] === 200){
228
+            if ($response['code'] === 200) {
229 229
                 return ['success'=>true];
230 230
             } else {
231 231
                 $data = json_decode($response['result'], true);
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 
249 249
         $json_data = json_decode($text, true);
250 250
         if (is_null($json_data)) {
251
-            $text = str_replace(['\n','\"'], "\n", $text);
251
+            $text = str_replace(['\n', '\"'], "\n", $text);
252 252
             $json_data = json_decode($text, true);
253 253
         }
254
-        if ( ! isset($json_data['error'])) {
254
+        if (!isset($json_data['error'])) {
255 255
             $text_xml = urldecode($json_data['result']);
256 256
             libxml_use_internal_errors(true);
257 257
             $doc = simplexml_load_string($text_xml);
258
-            if ( ! $doc) {
258
+            if (!$doc) {
259 259
                 libxml_clear_errors();
260 260
                 $doc = $text_xml;
261 261
             }
Please login to merge, or discard this patch.
www/back-end/modules/ClassLoader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@
 block discarded – undo
27 27
             ],
28 28
         ];
29 29
 
30
-        $results = glob( $config->application->modulesDir . '*/*/{controllers,forms}', GLOB_BRACE );
31
-        foreach ( $results as $path ) {
30
+        $results = glob($config->application->modulesDir.'*/*/{controllers,forms}', GLOB_BRACE);
31
+        foreach ($results as $path) {
32 32
             $arDirs[] = $path;
33 33
         }
34 34
 
35
-        $results = glob( $config->application->modulesDir . '*/{setup}', GLOB_BRACE );
36
-        foreach ( $results as $path ) {
35
+        $results = glob($config->application->modulesDir.'*/{setup}', GLOB_BRACE);
36
+        foreach ($results as $path) {
37 37
             $arDirs[] = $path;
38 38
         }
39 39
         $arrFiles[] = $config->application->backendDir.'modules/DiServicesInstall.php';
40 40
         $loader->registerFiles($arrFiles, true);
41
-        $loader->registerNamespaces($arNameSpaces,true);
42
-        $loader->registerDirs( $arDirs,true );
41
+        $loader->registerNamespaces($arNameSpaces, true);
42
+        $loader->registerDirs($arDirs, true);
43 43
         $loader->register();
44 44
     }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
www/back-end/modules/PbxExtensionBase.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -122,42 +122,42 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function __construct($module_uniqid = null)
124 124
     {
125
-        if($module_uniqid!==null){
126
-            $this->module_uniqid   = $module_uniqid;
125
+        if ($module_uniqid !== null) {
126
+            $this->module_uniqid = $module_uniqid;
127 127
         }
128 128
         $this->di              = DI::getDefault();
129 129
         $this->db              = $this->di->get('db');
130 130
         $this->config          = $this->di->get('config');
131
-        $settings_file          = "{$this->config->application->modulesDir}{$this->module_uniqid}/module.json";
132
-        if (file_exists($settings_file)){
133
-            $module_settings = json_decode(file_get_contents($settings_file),true);
134
-            if ($module_settings){
131
+        $settings_file = "{$this->config->application->modulesDir}{$this->module_uniqid}/module.json";
132
+        if (file_exists($settings_file)) {
133
+            $module_settings = json_decode(file_get_contents($settings_file), true);
134
+            if ($module_settings) {
135 135
                 $this->version         = $module_settings['version'];
136 136
                 $this->min_pbx_version = $module_settings['min_pbx_version'];
137 137
                 $this->developer       = $module_settings['developer'];
138 138
                 $this->support_email   = $module_settings['support_email'];
139
-                if (array_key_exists('lic_product_id', $module_settings)){
139
+                if (array_key_exists('lic_product_id', $module_settings)) {
140 140
                     $this->lic_product_id  = $module_settings['lic_product_id'];
141 141
                 } else {
142
-                    $this->lic_product_id  = 0 ;
142
+                    $this->lic_product_id  = 0;
143 143
                 }
144
-                if (array_key_exists('lic_feature_id', $module_settings)){
144
+                if (array_key_exists('lic_feature_id', $module_settings)) {
145 145
                     $this->lic_feature_id  = $module_settings['lic_feature_id'];
146 146
                 } else {
147
-                    $this->lic_feature_id  = 0 ;
147
+                    $this->lic_feature_id  = 0;
148 148
                 }
149 149
             } else {
150
-                $this->messages[]= 'Error on decode module.json';
150
+                $this->messages[] = 'Error on decode module.json';
151 151
             }
152 152
         }
153
-        $this->moduleDir       = $this->config->application->modulesDir . $this->module_uniqid;
153
+        $this->moduleDir       = $this->config->application->modulesDir.$this->module_uniqid;
154 154
         $this->messages        = [];
155 155
 
156 156
         // Create and connect database
157 157
         $dbPath = "{$this->moduleDir}/db";
158 158
 
159
-        if(!file_exists($dbPath) && !mkdir($dbPath, 0777, true) && !is_dir($dbPath)){
160
-            $this->messages[]=sprintf('Directory "%s" was not created', $dbPath);
159
+        if (!file_exists($dbPath) && !mkdir($dbPath, 0777, true) && !is_dir($dbPath)) {
160
+            $this->messages[] = sprintf('Directory "%s" was not created', $dbPath);
161 161
             throw new RuntimeException(sprintf('Directory "%s" was not created', $dbPath));
162 162
         }
163 163
         $this->moduleDB = new Sqlite(['dbname' => "$dbPath/module.db"]);
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $result = true;
175 175
         try {
176
-            if ( ! $this->activateLicense()) {
177
-                $this->messages[]  = 'License activate error';
176
+            if (!$this->activateLicense()) {
177
+                $this->messages[] = 'License activate error';
178 178
                 $result = false;
179 179
             }
180
-            if ( ! $this->installFiles()) {
181
-                $this->messages[]   = ' installFiles error';
180
+            if (!$this->installFiles()) {
181
+                $this->messages[] = ' installFiles error';
182 182
                 $result = false;
183 183
             }
184
-            if ( ! $this->installDB()) {
185
-                $this->messages[]   = ' installDB error';
184
+            if (!$this->installDB()) {
185
+                $this->messages[] = ' installDB error';
186 186
                 $result = false;
187 187
             }
188 188
         } catch (Throwable $exception) {
189 189
             $result = false;
190
-            $this->messages=$exception->getMessage();
190
+            $this->messages = $exception->getMessage();
191 191
         }
192 192
 
193 193
         return $result;
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
     {
245 245
         $result = true;
246 246
         try {
247
-            if ( ! $this->unInstallDB($keepSettings)) {
248
-                $this->messages[]= ' unInstallDB error';
247
+            if (!$this->unInstallDB($keepSettings)) {
248
+                $this->messages[] = ' unInstallDB error';
249 249
                 $result = false;
250 250
             }
251
-            if ($result && ! $this->unInstallFiles($keepSettings)) {
252
-                $this->messages[]= ' unInstallFiles error';
251
+            if ($result && !$this->unInstallFiles($keepSettings)) {
252
+                $this->messages[] = ' unInstallFiles error';
253 253
                 $result = false;
254 254
             }
255 255
         } catch (Throwable $exception) {
256 256
             $result = false;
257
-            $this->messages=$exception->getMessage();
257
+            $this->messages = $exception->getMessage();
258 258
         }
259 259
 
260 260
         return $result;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $backupPath = "{$this->config->application->modulesDir}Backup/{$this->module_uniqid}";
287 287
         Util::mwexec("rm -rf {$backupPath}");
288 288
         if ($keepSettings) {
289
-            if ( ! is_dir($backupPath) && ! mkdir($backupPath, 0777, true) && ! is_dir($backupPath)) {
289
+            if (!is_dir($backupPath) && !mkdir($backupPath, 0777, true) && !is_dir($backupPath)) {
290 290
                 $this->messages[] = sprintf('Directory "%s" was not created', $backupPath);
291 291
 
292 292
                 return false;
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
     {
308 308
         // Проверим версию АТС и Модуля на совместимость
309 309
         $currentVersionPBX = PbxSettings::getValueByKey('PBXVersion');
310
-        $currentVersionPBX = str_replace('-dev','', $currentVersionPBX);
310
+        $currentVersionPBX = str_replace('-dev', '', $currentVersionPBX);
311 311
         if (version_compare($currentVersionPBX, $this->min_pbx_version) < 0) {
312 312
             $this->messages[] = "Error: module depends minimum PBX ver $this->min_pbx_version";
313 313
             return false;
314 314
         }
315 315
 
316 316
         $module = PbxExtensionModules::findFirst("uniqid='{$this->module_uniqid}'");
317
-        if ( ! $module) {
317
+        if (!$module) {
318 318
             $module           = new PbxExtensionModules();
319 319
             $module->name     = $this->locString("SubHeader{$this->module_uniqid}");
320 320
             $module->disabled = '1';
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         $language             = substr(PbxSettings::getValueByKey('PBXLanguage'), 0, 2);
341 341
         $translates           = [];
342 342
         $extensionsTranslates = [[]];
343
-        $results              = glob($this->moduleDir . '/{messages}/en.php', GLOB_BRACE);
343
+        $results              = glob($this->moduleDir.'/{messages}/en.php', GLOB_BRACE);
344 344
         foreach ($results as $path) {
345 345
             $langArr = require $path;
346 346
             if (is_array($langArr)) {
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         }
353 353
         if ($language !== 'en') {
354 354
             $additionalTranslates = [[]];
355
-            $results              = glob($this->moduleDir . "/{messages}/{$language}.php", GLOB_BRACE);
355
+            $results              = glob($this->moduleDir."/{messages}/{$language}.php", GLOB_BRACE);
356 356
             foreach ($results as $path) {
357 357
                 $langArr = require $path;
358 358
                 if (is_array($langArr)) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     protected function createSettingsTableByModelsAnnotations(): bool
381 381
     {
382 382
         $result   = true;
383
-        $results  = glob($this->moduleDir . '/Models/*.php', GLOB_NOSORT);
383
+        $results  = glob($this->moduleDir.'/Models/*.php', GLOB_NOSORT);
384 384
         foreach ($results as $file) {
385 385
             $className        = pathinfo($file)['filename'];
386 386
             $moduleModelClass = "\\Modules\\{$this->module_uniqid}\\Models\\{$className}";
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $tableName  = $model->getSource();
463 463
         $this->moduleDB->begin();
464 464
 
465
-        if ( ! $this->moduleDB->tableExists($tableName)) {
465
+        if (!$this->moduleDB->tableExists($tableName)) {
466 466
             $result = $this->moduleDB->createTable($tableName, null, $columnsNew);
467 467
         } else { // Таблица существует, создадим новую и скопируем данные, чтобы не думать про новые, старые колонки
468 468
 
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
             }
478 478
 
479 479
             $aquery = '
480
-            CREATE TEMPORARY TABLE ' . $tableName . '_backup(' . implode(',', $currentStateColumnList) . ');
481
-            INSERT INTO ' . $tableName . '_backup SELECT ' . implode(',',
482
-                    $currentStateColumnList) . ' FROM ' . $tableName . ';
483
-            DROP TABLE ' . $tableName . ';';
480
+            CREATE TEMPORARY TABLE ' . $tableName.'_backup('.implode(',', $currentStateColumnList).');
481
+            INSERT INTO ' . $tableName.'_backup SELECT '.implode(',',
482
+                    $currentStateColumnList).' FROM '.$tableName.';
483
+            DROP TABLE ' . $tableName.';';
484 484
             $result = $result && $this->moduleDB->execute($aquery);
485 485
 
486 486
             $result = $result && $this->moduleDB->createTable($tableName, null, $columnsNew);
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
             $newColumnNames = array_intersect($newColNames, $oldColNames);
489 489
 
490 490
             $result = $result && $this->moduleDB->execute('
491
-            INSERT INTO ' . $tableName . '(' . implode(',', $newColumnNames) . ')
492
-            SELECT ' . implode(',', $newColumnNames) . ' FROM ' . $tableName . '_backup;
491
+            INSERT INTO ' . $tableName.'('.implode(',', $newColumnNames).')
492
+            SELECT ' . implode(',', $newColumnNames).' FROM '.$tableName.'_backup;
493 493
         ');
494 494
             $result = $result && $this->moduleDB->execute('
495
-            DROP TABLE ' . $tableName . '_backup;            
495
+            DROP TABLE ' . $tableName.'_backup;            
496 496
         ');
497 497
         }
498 498
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
         $columnsNew = ['columns' => $columns];
554 554
         $this->moduleDB->begin();
555 555
 
556
-        if ( ! $this->moduleDB->tableExists($tableName)) {
556
+        if (!$this->moduleDB->tableExists($tableName)) {
557 557
             $result = $this->moduleDB->createTable($tableName, null, $columnsNew);
558 558
 
559 559
         } else { // Таблица существует, создадим новую и скопируем данные, чтобы не думать про новые, старые колонки
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
             }
570 570
 
571 571
             $aquery = '
572
-            CREATE TEMPORARY TABLE ' . $tableName . '_backup(' . implode(',', $currentStateColumnList) . ');
573
-            INSERT INTO ' . $tableName . '_backup SELECT ' . implode(',',
574
-                    $currentStateColumnList) . ' FROM ' . $tableName . ';
575
-            DROP TABLE ' . $tableName . ';';
572
+            CREATE TEMPORARY TABLE ' . $tableName.'_backup('.implode(',', $currentStateColumnList).');
573
+            INSERT INTO ' . $tableName.'_backup SELECT '.implode(',',
574
+                    $currentStateColumnList).' FROM '.$tableName.';
575
+            DROP TABLE ' . $tableName.';';
576 576
             $result = $result && $this->moduleDB->execute($aquery);
577 577
 
578 578
             $result = $result && $this->moduleDB->createTable($tableName, null, $columnsNew);
@@ -580,11 +580,11 @@  discard block
 block discarded – undo
580 580
             $newColumnNames = array_intersect($newColNames, $oldColNames);
581 581
 
582 582
             $result = $result && $this->moduleDB->execute('
583
-            INSERT INTO ' . $tableName . '(' . implode(',', $newColumnNames) . ')
584
-            SELECT ' . implode(',', $newColumnNames) . ' FROM ' . $tableName . '_backup;
583
+            INSERT INTO ' . $tableName.'('.implode(',', $newColumnNames).')
584
+            SELECT ' . implode(',', $newColumnNames).' FROM '.$tableName.'_backup;
585 585
         ');
586 586
             $result = $result && $this->moduleDB->execute('
587
-            DROP TABLE ' . $tableName . '_backup;            
587
+            DROP TABLE ' . $tableName.'_backup;            
588 588
         ');
589 589
 
590 590
         }
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $menuSettingsKey = "AdditionalMenuItem{$this->module_uniqid}";
661 661
         $unCamelizedControllerName = Text::uncamelize($this->module_uniqid, '-');
662 662
         $menuSettings = PbxSettings::findFirstByKey($menuSettingsKey);
663
-        if (!$menuSettings){
663
+        if (!$menuSettings) {
664 664
             $menuSettings = new PbxSettings();
665 665
             $menuSettings->key = $menuSettingsKey;
666 666
         }
Please login to merge, or discard this patch.