@@ -242,8 +242,7 @@ discard block |
||
| 242 | 242 | //if the application is running in CLI mode use the first argument |
| 243 | 243 | else if(IS_CLI && isset($_SERVER['argv'][1])){ |
| 244 | 244 | $routeUri = $_SERVER['argv'][1]; |
| 245 | - } |
|
| 246 | - else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 245 | + } else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 247 | 246 | $routeUri = $_SERVER['REQUEST_URI']; |
| 248 | 247 | } |
| 249 | 248 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
@@ -339,15 +338,13 @@ discard block |
||
| 339 | 338 | if(! class_exists($controller, false)){ |
| 340 | 339 | $e404 = true; |
| 341 | 340 | $this->logger->warning('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']'); |
| 342 | - } |
|
| 343 | - else{ |
|
| 341 | + } else{ |
|
| 344 | 342 | $controllerInstance = new $controller(); |
| 345 | 343 | $controllerMethod = $this->getMethod(); |
| 346 | 344 | if(! method_exists($controllerInstance, $controllerMethod)){ |
| 347 | 345 | $e404 = true; |
| 348 | 346 | $this->logger->warning('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']'); |
| 349 | - } |
|
| 350 | - else{ |
|
| 347 | + } else{ |
|
| 351 | 348 | $this->logger->info('Routing data is set correctly now GO!'); |
| 352 | 349 | call_user_func_array(array($controllerInstance, $controllerMethod), $this->args); |
| 353 | 350 | //render the final page to user |
@@ -355,8 +352,7 @@ discard block |
||
| 355 | 352 | get_instance()->response->renderFinalPage(); |
| 356 | 353 | } |
| 357 | 354 | } |
| 358 | - } |
|
| 359 | - else{ |
|
| 355 | + } else{ |
|
| 360 | 356 | $this->logger->info('The controller file path [' . $classFilePath . '] does not exist'); |
| 361 | 357 | $e404 = true; |
| 362 | 358 | } |
@@ -462,8 +458,7 @@ discard block |
||
| 462 | 458 | $this->logger->info('The current request use the module [' . $moduleControllerMethod[0] . ']'); |
| 463 | 459 | $this->module = $moduleControllerMethod[0]; |
| 464 | 460 | $moduleControllerMethod = explode('@', $moduleControllerMethod[1]); |
| 465 | - } |
|
| 466 | - else{ |
|
| 461 | + } else{ |
|
| 467 | 462 | $this->logger->info('The current request does not use the module'); |
| 468 | 463 | $moduleControllerMethod = explode('@', $this->callback[$index]); |
| 469 | 464 | } |
@@ -519,8 +514,7 @@ discard block |
||
| 519 | 514 | } |
| 520 | 515 | //args |
| 521 | 516 | $this->args = $segment; |
| 522 | - } |
|
| 523 | - else{ |
|
| 517 | + } else{ |
|
| 524 | 518 | $this->logger->info('The application contains a loaded module will check if the current request is found in the module list'); |
| 525 | 519 | if(in_array($segment[0], $modules)){ |
| 526 | 520 | $this->logger->info('Found, the current request use the module [' . $segment[0] . ']'); |
@@ -534,8 +528,7 @@ discard block |
||
| 534 | 528 | if(! $path){ |
| 535 | 529 | $this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller'); |
| 536 | 530 | $this->controller = $this->module; |
| 537 | - } |
|
| 538 | - else{ |
|
| 531 | + } else{ |
|
| 539 | 532 | $this->controllerPath = $path; |
| 540 | 533 | array_shift($segment); |
| 541 | 534 | } |
@@ -547,8 +540,7 @@ discard block |
||
| 547 | 540 | } |
| 548 | 541 | //the remaining is for args |
| 549 | 542 | $this->args = $segment; |
| 550 | - } |
|
| 551 | - else{ |
|
| 543 | + } else{ |
|
| 552 | 544 | $this->logger->info('The current request information is not found in the module list'); |
| 553 | 545 | //controller |
| 554 | 546 | if(isset($segment[0])){ |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | if($success === false){ |
| 48 | 48 | $this->logger->info('No cache found for the key ['. $key .'], return false'); |
| 49 | 49 | return false; |
| 50 | - } |
|
| 51 | - else{ |
|
| 50 | + } else{ |
|
| 52 | 51 | $cacheInfo = $this->_getCacheInfo($key); |
| 53 | 52 | $expire = time(); |
| 54 | 53 | if($cacheInfo){ |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | if($result === false){ |
| 75 | 74 | $this->logger->error('Can not write cache data for the key ['. $key .'], return false'); |
| 76 | 75 | return false; |
| 77 | - } |
|
| 78 | - else{ |
|
| 76 | + } else{ |
|
| 79 | 77 | $this->logger->info('Cache data saved for the key ['. $key .']'); |
| 80 | 78 | return true; |
| 81 | 79 | } |
@@ -94,8 +92,7 @@ discard block |
||
| 94 | 92 | if($cacheInfo === false){ |
| 95 | 93 | $this->logger->info('This cache data does not exists skipping'); |
| 96 | 94 | return false; |
| 97 | - } |
|
| 98 | - else{ |
|
| 95 | + } else{ |
|
| 99 | 96 | $this->logger->info('Found cache data for the key [' .$key. '] remove it'); |
| 100 | 97 | return apc_delete($key) === true; |
| 101 | 98 | } |
@@ -119,8 +116,7 @@ discard block |
||
| 119 | 116 | 'ttl' => $cacheInfos['ttl'] |
| 120 | 117 | ); |
| 121 | 118 | return $data; |
| 122 | - } |
|
| 123 | - else{ |
|
| 119 | + } else{ |
|
| 124 | 120 | $this->logger->info('This cache does not exists skipping'); |
| 125 | 121 | return false; |
| 126 | 122 | } |
@@ -144,8 +140,7 @@ discard block |
||
| 144 | 140 | if(empty($cacheInfos['cache_list'])){ |
| 145 | 141 | $this->logger->info('No cache data were found skipping'); |
| 146 | 142 | return false; |
| 147 | - } |
|
| 148 | - else{ |
|
| 143 | + } else{ |
|
| 149 | 144 | $this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove'); |
| 150 | 145 | return apc_clear_cache('user'); |
| 151 | 146 | } |
@@ -82,8 +82,7 @@ discard block |
||
| 82 | 82 | // Unlinking when the file was expired |
| 83 | 83 | unlink($filePath); |
| 84 | 84 | return false; |
| 85 | - } |
|
| 86 | - else{ |
|
| 85 | + } else{ |
|
| 87 | 86 | $this->logger->info('The cache not yet expire, now return the cache data for key ['. $key .'], the cache will expire at [' . date('Y-m-d H:i:s', $data['expire']) . ']'); |
| 88 | 87 | return $data['data']; |
| 89 | 88 | } |
@@ -120,8 +119,7 @@ discard block |
||
| 120 | 119 | $this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false'); |
| 121 | 120 | fclose($handle); |
| 122 | 121 | return false; |
| 123 | - } |
|
| 124 | - else{ |
|
| 122 | + } else{ |
|
| 125 | 123 | $this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']'); |
| 126 | 124 | fclose($handle); |
| 127 | 125 | chmod($filePath, 0640); |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | if(! file_exists($filePath)){ |
| 144 | 142 | $this->logger->info('This cache file does not exists skipping'); |
| 145 | 143 | return false; |
| 146 | - } |
|
| 147 | - else{ |
|
| 144 | + } else{ |
|
| 148 | 145 | $this->logger->info('Found cache file [' .$filePath. '] remove it'); |
| 149 | 146 | unlink($filePath); |
| 150 | 147 | return true; |
@@ -197,8 +194,7 @@ discard block |
||
| 197 | 194 | $list = glob(CACHE_PATH . '*.cache'); |
| 198 | 195 | if(! $list){ |
| 199 | 196 | $this->logger->info('No cache files were found skipping'); |
| 200 | - } |
|
| 201 | - else{ |
|
| 197 | + } else{ |
|
| 202 | 198 | $this->logger->info('Found [' . count($list) . '] cache files to remove if expired'); |
| 203 | 199 | foreach ($list as $file) { |
| 204 | 200 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -206,12 +202,10 @@ discard block |
||
| 206 | 202 | $data = @unserialize($this->compressCacheData ? gzinflate($data) : $data); |
| 207 | 203 | if(! $data){ |
| 208 | 204 | $this->logger->warning('Can not unserialize the cache data for file [' . $file . ']'); |
| 209 | - } |
|
| 210 | - else if(time() > $data['expire']){ |
|
| 205 | + } else if(time() > $data['expire']){ |
|
| 211 | 206 | $this->logger->info('The cache data for file [' . $file . '] already expired remove it'); |
| 212 | 207 | unlink($file); |
| 213 | - } |
|
| 214 | - else{ |
|
| 208 | + } else{ |
|
| 215 | 209 | $this->logger->info('The cache data for file [' . $file . '] not yet expired skip it'); |
| 216 | 210 | } |
| 217 | 211 | } |
@@ -226,8 +220,7 @@ discard block |
||
| 226 | 220 | $list = glob(CACHE_PATH . '*.cache'); |
| 227 | 221 | if(! $list){ |
| 228 | 222 | $this->logger->info('No cache files were found skipping'); |
| 229 | - } |
|
| 230 | - else{ |
|
| 223 | + } else{ |
|
| 231 | 224 | $this->logger->info('Found [' . count($list) . '] cache files to remove'); |
| 232 | 225 | foreach ($list as $file) { |
| 233 | 226 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -254,8 +247,7 @@ discard block |
||
| 254 | 247 | |
| 255 | 248 | $this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE'); |
| 256 | 249 | $this->compressCacheData = false; |
| 257 | - } |
|
| 258 | - else{ |
|
| 250 | + } else{ |
|
| 259 | 251 | $this->compressCacheData = $status; |
| 260 | 252 | } |
| 261 | 253 | return $this; |