@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | if (!defined('LOG_DIR')) { |
19 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
20 | - define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
19 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
20 | + define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $config = Config::getInstance(); |
56 | 56 | $args = func_get_args(); |
57 | 57 | list($logger, $debug, $path) = $this->setup($config, $args); |
58 | - $this->stream = fopen($path . DIRECTORY_SEPARATOR . date('Ymd') . '.log', 'a+'); |
|
58 | + $this->stream = fopen($path.DIRECTORY_SEPARATOR.date('Ymd').'.log', 'a+'); |
|
59 | 59 | $this->addPushLogger($logger, $debug, $config); |
60 | 60 | $this->log_level = Config::getParam('log.level', 'info'); |
61 | 61 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | private function createLoggerPath(Config $config) |
143 | 143 | { |
144 | 144 | $logger = $this->setLoggerName($config); |
145 | - $path = LOG_DIR . DIRECTORY_SEPARATOR . $logger . DIRECTORY_SEPARATOR . date('Y') . DIRECTORY_SEPARATOR . date('m'); |
|
145 | + $path = LOG_DIR.DIRECTORY_SEPARATOR.$logger.DIRECTORY_SEPARATOR.date('Y').DIRECTORY_SEPARATOR.date('m'); |
|
146 | 146 | GeneratorHelper::createDir($path); |
147 | 147 | |
148 | 148 | return $path; |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public static function log($msg, $type = LOG_DEBUG, array $context = null) |
167 | 167 | { |
168 | - if(null === $context) { |
|
168 | + if (null === $context) { |
|
169 | 169 | $context = []; |
170 | 170 | } |
171 | - if(Config::getParam('profiling.enable')) { |
|
171 | + if (Config::getParam('profiling.enable')) { |
|
172 | 172 | Inspector::stats($msg); |
173 | 173 | } |
174 | 174 | switch ($type) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | self::getInstance()->addLog($msg, \Monolog\Logger::WARNING, $context); |
180 | 180 | break; |
181 | 181 | case LOG_CRIT: |
182 | - if(Config::getParam('log.slack.hook')) { |
|
182 | + if (Config::getParam('log.slack.hook')) { |
|
183 | 183 | SlackHelper::getInstance()->trace($msg, '', '', $context); |
184 | 184 | } |
185 | 185 | self::getInstance()->addLog($msg, \Monolog\Logger::CRITICAL, $context); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | { |
223 | 223 | $context['uri'] = null !== $_SERVER && array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : 'Unknow'; |
224 | 224 | $context['method'] = null !== $_SERVER && array_key_exists('REQUEST_METHOD', $_SERVER) ? $_SERVER['REQUEST_METHOD'] : 'Unknow'; |
225 | - if(null !== $_SERVER && array_key_exists('HTTP_X_PSFS_UID', $_SERVER)) { |
|
225 | + if (null !== $_SERVER && array_key_exists('HTTP_X_PSFS_UID', $_SERVER)) { |
|
226 | 226 | $context['uid'] = $_SERVER['HTTP_X_PSFS_UID']; |
227 | 227 | } |
228 | 228 | return $context; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | GeneratorHelper::checkCustomNamespaceApi($apiClass); |
65 | 65 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
66 | 66 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente"))); |
67 | - // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
|
67 | + // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
|
68 | 68 | } catch (\Exception $e) { |
69 | 69 | Logger::l($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
70 | 70 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function generateModule() |
36 | 36 | { |
37 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
37 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
38 | 38 | /* @var $form \PSFS\base\config\ConfigForm */ |
39 | 39 | $form = new ModuleForm(); |
40 | 40 | $form->build(); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
66 | 66 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente"))); |
67 | 67 | // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
68 | - } catch (\Exception $e) { |
|
69 | - Logger::l($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
68 | + }catch (\Exception $e) { |
|
69 | + Logger::l($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
70 | 70 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
71 | 71 | } |
72 | 72 | } |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | |
78 | 78 | public static function createRoot($path = WEB_DIR, OutputInterface $output = null) { |
79 | 79 | |
80 | - if(null === $output) { |
|
80 | + if (null === $output) { |
|
81 | 81 | $output = new ConsoleOutput(); |
82 | 82 | } |
83 | 83 | |
84 | 84 | GeneratorHelper::createDir($path); |
85 | 85 | $paths = array("js", "css", "img", "media", "font"); |
86 | 86 | foreach ($paths as $htmlPath) { |
87 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
87 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // Generates the root needed files |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | 'robots' => 'robots.txt', |
97 | 97 | ]; |
98 | 98 | foreach ($files as $templates => $filename) { |
99 | - $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig'); |
|
100 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
101 | - $output->writeln('Can\t create the file ' . $filename); |
|
102 | - } else { |
|
103 | - $output->writeln($filename . ' created successfully'); |
|
99 | + $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
100 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
101 | + $output->writeln('Can\t create the file '.$filename); |
|
102 | + }else { |
|
103 | + $output->writeln($filename.' created successfully'); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | //Export base locale translations |
108 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
109 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
110 | - GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
108 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
109 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
110 | + GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function init() |
14 | 14 | { |
15 | - if(!Security::getInstance()->isLogged()) { |
|
15 | + if (!Security::getInstance()->isLogged()) { |
|
16 | 16 | throw new ApiException(t('Resource not authorized'), 401); |
17 | 17 | } |
18 | 18 | parent::init(); |