@@ -4,16 +4,16 @@ |
||
| 4 | 4 | |
| 5 | 5 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
| 6 | 6 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 9 | -} else { |
|
| 10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 7 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
| 8 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
| 9 | +}else { |
|
| 10 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
| 11 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
| 12 | 12 | } |
| 13 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 14 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 15 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 16 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 13 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
| 14 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
| 15 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
| 16 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
| 17 | 17 | |
| 18 | 18 | //Cargamos en memoria la función de desarrollo PRE |
| 19 | 19 | if (!function_exists('pre')) { |
@@ -1,19 +1,39 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (defined('PSFS_BOOTSTRAP_LOADED')) return; |
|
| 2 | +if (defined('PSFS_BOOTSTRAP_LOADED')) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 3 | 5 | use Symfony\Component\Finder\Finder; |
| 4 | 6 | |
| 5 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
| 7 | +if (!defined('SOURCE_DIR')) { |
|
| 8 | + define('SOURCE_DIR', __DIR__); |
|
| 9 | +} |
|
| 6 | 10 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 9 | -} else { |
|
| 10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 12 | -} |
|
| 13 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 14 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 15 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 16 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 11 | + if (!defined('BASE_DIR')) { |
|
| 12 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 13 | + } |
|
| 14 | + if (!defined('CORE_DIR')) { |
|
| 15 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 16 | + } |
|
| 17 | + } else { |
|
| 18 | + if (!defined('BASE_DIR')) { |
|
| 19 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 20 | + } |
|
| 21 | + if (!defined('CORE_DIR')) { |
|
| 22 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | +if (!defined('LOG_DIR')) { |
|
| 26 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 27 | +} |
|
| 28 | +if (!defined('CACHE_DIR')) { |
|
| 29 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 30 | +} |
|
| 31 | +if (!defined('CONFIG_DIR')) { |
|
| 32 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 33 | +} |
|
| 34 | +if (!defined('WEB_DIR')) { |
|
| 35 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 36 | +} |
|
| 17 | 37 | |
| 18 | 38 | //Cargamos en memoria la función de desarrollo PRE |
| 19 | 39 | if (!function_exists('pre')) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | use PSFS\base\Logger; |
| 14 | 14 | use PSFS\base\Singleton; |
| 15 | 15 | |
| 16 | -require_once __DIR__ . DIRECTORY_SEPARATOR . "bootstrap.php"; |
|
| 16 | +require_once __DIR__.DIRECTORY_SEPARATOR."bootstrap.php"; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Class Dispatcher |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | private function setLocale() |
| 75 | 75 | { |
| 76 | 76 | $this->locale = $this->config->get("default_language"); |
| 77 | - Logger::log('Set locale to project [' . $this->locale . ']'); |
|
| 77 | + Logger::log('Set locale to project ['.$this->locale.']'); |
|
| 78 | 78 | // Load translations |
| 79 | - putenv("LC_ALL=" . $this->locale); |
|
| 79 | + putenv("LC_ALL=".$this->locale); |
|
| 80 | 80 | setlocale(LC_ALL, $this->locale); |
| 81 | 81 | // Load the locale path |
| 82 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
| 83 | - Logger::log('Set locale dir ' . $locale_path); |
|
| 82 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
| 83 | + Logger::log('Set locale dir '.$locale_path); |
|
| 84 | 84 | Config::createDir($locale_path); |
| 85 | 85 | bindtextdomain('translations', $locale_path); |
| 86 | 86 | textdomain('translations'); |
@@ -100,16 +100,16 @@ discard block |
||
| 100 | 100 | if (!$this->parser->isFile()) { |
| 101 | 101 | return $this->router->execute($this->actualUri); |
| 102 | 102 | } |
| 103 | - } else { |
|
| 103 | + }else { |
|
| 104 | 104 | return $this->router->getAdmin()->config(); |
| 105 | 105 | } |
| 106 | - } catch (ConfigException $c) { |
|
| 106 | + }catch (ConfigException $c) { |
|
| 107 | 107 | return $this->dumpException($c); |
| 108 | - } catch (SecurityException $s) { |
|
| 108 | + }catch (SecurityException $s) { |
|
| 109 | 109 | return $this->security->notAuthorized($this->actualUri); |
| 110 | - } catch (RouterException $r) { |
|
| 110 | + }catch (RouterException $r) { |
|
| 111 | 111 | return $this->router->httpNotFound($r); |
| 112 | - } catch (\Exception $e) { |
|
| 112 | + }catch (\Exception $e) { |
|
| 113 | 113 | return $this->dumpException($e); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $use /= 1024; |
| 152 | 152 | break; |
| 153 | 153 | case "MBytes": |
| 154 | - $use /= (1024 * 1024); |
|
| 154 | + $use /= (1024*1024); |
|
| 155 | 155 | break; |
| 156 | 156 | case "Bytes": |
| 157 | 157 | default: |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if ($this->config->getDebugMode()) { |
| 178 | 178 | Logger::log('Added handlers for errors'); |
| 179 | 179 | //Warning & Notice handler |
| 180 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
| 180 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
| 181 | 181 | Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]); |
| 182 | 182 | throw new \Exception($errstr, 500); |
| 183 | 183 | }); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | Logger::log('Initialicing stats (mem + ts)'); |
| 193 | 193 | if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { |
| 194 | 194 | $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT']; |
| 195 | - } else { |
|
| 195 | + }else { |
|
| 196 | 196 | $this->ts = $this->parser->getTs(); |
| 197 | 197 | } |
| 198 | 198 | $this->mem = memory_get_usage(); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Método que guarda en fichero los datos pasados |
| 124 | - * @param $path |
|
| 124 | + * @param string $path |
|
| 125 | 125 | * @param $data |
| 126 | 126 | * @param int $transform |
| 127 | 127 | * @param boolean $absolutePath |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * Método estático que revisa si se necesita cachear la respuesta de un servicio o no |
| 159 | - * @return integer|boolean |
|
| 159 | + * @return integer |
|
| 160 | 160 | */ |
| 161 | 161 | public static function needCache() |
| 162 | 162 | { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | private function saveTextToFile($data, $path, $absolute = false) |
| 31 | 31 | { |
| 32 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 32 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 33 | 33 | $filename = basename($absolutePath); |
| 34 | 34 | Config::createDir(str_replace($filename, "", $absolutePath)); |
| 35 | 35 | if (false === file_put_contents($absolutePath, $data)) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false) |
| 49 | 49 | { |
| 50 | 50 | $data = null; |
| 51 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 51 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 52 | 52 | if (file_exists($absolutePath)) { |
| 53 | 53 | $data = file_get_contents($absolutePath); |
| 54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 66 | 66 | { |
| 67 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 67 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 68 | 68 | $lasModificationDate = filemtime($absolutePath); |
| 69 | 69 | return ($lasModificationDate + $expires <= time()); |
| 70 | 70 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | break; |
| 88 | 88 | case Cache::GZIP: |
| 89 | 89 | // TODO implementar |
| 90 | - if(function_exists('gzuncompress')) { |
|
| 90 | + if (function_exists('gzuncompress')) { |
|
| 91 | 91 | $data = gzuncompress($data); |
| 92 | 92 | } |
| 93 | 93 | break; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $data = Cache::transformData($data, Cache::GZIP); |
| 113 | 113 | break; |
| 114 | 114 | case Cache::GZIP: |
| 115 | - if(function_exists('gzcompress')) { |
|
| 115 | + if (function_exists('gzcompress')) { |
|
| 116 | 116 | $data = gzcompress($data); |
| 117 | 117 | } |
| 118 | 118 | break; |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT) |
| 145 | 145 | { |
| 146 | 146 | $data = null; |
| 147 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 147 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 148 | 148 | if (null !== $function && $this->hasExpiredCache($path, $expires)) { |
| 149 | 149 | $data = call_user_func($function); |
| 150 | 150 | $this->storeData($path, $data, $transform); |
| 151 | - } else { |
|
| 151 | + }else { |
|
| 152 | 152 | $data = $this->getDataFromFile($path, $transform); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $hash = ""; |
| 179 | 179 | $action = Security::getInstance()->getSessionKey("__CACHE__"); |
| 180 | 180 | if (null !== $action && $action["cache"] > 0) { |
| 181 | - $hash = $action["http"] . " " . $action["slug"]; |
|
| 181 | + $hash = $action["http"]." ".$action["slug"]; |
|
| 182 | 182 | } |
| 183 | 183 | return sha1($hash); |
| 184 | 184 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | 'robots' => 'robots.txt', |
| 33 | 33 | ]; |
| 34 | 34 | foreach ($files as $templates => $filename) { |
| 35 | - $text = \PSFS\base\Template::getInstance()->dump("generator/html/". $templates . '.html.twig'); |
|
| 36 | - if(false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
| 37 | - $output->writeln('Can\t create the file ' . $filename); |
|
| 38 | - } else { |
|
| 39 | - $output->writeln($filename . ' created successfully'); |
|
| 35 | + $text = \PSFS\base\Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
| 36 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
| 37 | + $output->writeln('Can\t create the file '.$filename); |
|
| 38 | + }else { |
|
| 39 | + $output->writeln($filename.' created successfully'); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | //Export base locale translations |
| 44 | - if(!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
| 44 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
| 45 | 45 | \PSFS\base\config\Config::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
| 46 | - \PSFS\Services\GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 46 | + \PSFS\Services\GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $output->writeln("Document root generado en ".$path); |
@@ -6,7 +6,9 @@ discard block |
||
| 6 | 6 | use Symfony\Component\Console\Input\InputInterface; |
| 7 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
| 8 | 8 | |
| 9 | - if (!isset($console)) $console = new Application(); |
|
| 9 | + if (!isset($console)) { |
|
| 10 | + $console = new Application(); |
|
| 11 | + } |
|
| 10 | 12 | $console |
| 11 | 13 | ->register('psfs:create:root') |
| 12 | 14 | ->setDefinition(array( |
@@ -16,7 +18,9 @@ discard block |
||
| 16 | 18 | ->setCode(function(InputInterface $input, OutputInterface $output) { |
| 17 | 19 | // Creates the html path |
| 18 | 20 | $path = $input->getArgument('path'); |
| 19 | - if (empty($path)) $path = WEB_DIR; |
|
| 21 | + if (empty($path)) { |
|
| 22 | + $path = WEB_DIR; |
|
| 23 | + } |
|
| 20 | 24 | \PSFS\base\config\Config::createDir($path); |
| 21 | 25 | $paths = array("js", "css", "img", "media", "font"); |
| 22 | 26 | foreach ($paths as $htmlPath) { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @GET |
| 29 | 29 | * @route /admin/routes/show |
| 30 | 30 | * @visible false |
| 31 | - * @return mixed |
|
| 31 | + * @return string|null |
|
| 32 | 32 | */ |
| 33 | 33 | public function getRouting() |
| 34 | 34 | { |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $router->simpatize(); |
| 52 | 52 | Security::getInstance()->setFlash("callback_message", _("Rutas generadas correctamente")); |
| 53 | 53 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
| 54 | - } catch(\Exception $e) { |
|
| 54 | + }catch (\Exception $e) { |
|
| 55 | 55 | Logger::log($e->getMessage(), LOG_ERR); |
| 56 | 56 | Security::getInstance()->setFlash("callback_message", _("Algo no ha salido bien, revisa los logs")); |
| 57 | 57 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
@@ -38,8 +38,8 @@ |
||
| 38 | 38 | //Generating the templates translations |
| 39 | 39 | $translations = $this->tpl->regenerateTemplates(); |
| 40 | 40 | |
| 41 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 42 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 41 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 42 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 43 | 43 | |
| 44 | 44 | //xgettext localizations |
| 45 | 45 | $translations = array_merge($translations, GeneratorService::findTranslations(SOURCE_DIR, $locale)); |
@@ -33,7 +33,9 @@ |
||
| 33 | 33 | public function getTranslations($locale) |
| 34 | 34 | { |
| 35 | 35 | //Default locale |
| 36 | - if (null === $locale) $locale = $this->config->get("default_language"); |
|
| 36 | + if (null === $locale) { |
|
| 37 | + $locale = $this->config->get("default_language"); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | //Generating the templates translations |
| 39 | 41 | $translations = $this->tpl->regenerateTemplates(); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | public function getConfigParams() { |
| 26 | 26 | $response = array_merge(Config::$required, Config::$optional); |
| 27 | 27 | $domains = Router::getInstance()->getDomains(); |
| 28 | - foreach($domains as $domain => $routes) { |
|
| 28 | + foreach ($domains as $domain => $routes) { |
|
| 29 | 29 | $pDomain = str_replace('@', '', $domain); |
| 30 | 30 | $pDomain = str_replace('/', '', $pDomain); |
| 31 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
| 31 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
| 32 | 32 | } |
| 33 | 33 | return $this->json($response); |
| 34 | 34 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function config() |
| 44 | 44 | { |
| 45 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
| 45 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
| 46 | 46 | /* @var $form \PSFS\base\config\ConfigForm */ |
| 47 | 47 | $form = new ConfigForm(); |
| 48 | 48 | $form->build(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | Security::getInstance()->setFlash("callback_message", _("Configuración actualizada correctamente")); |
| 81 | 81 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
| 82 | - } else { |
|
| 82 | + }else { |
|
| 83 | 83 | throw new \HttpException(_('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @GET |
| 29 | 29 | * @route /admin/routes/show |
| 30 | 30 | * @visible false |
| 31 | - * @return mixed |
|
| 31 | + * @return string|null |
|
| 32 | 32 | */ |
| 33 | 33 | public function getRouting() |
| 34 | 34 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function generateModule() |
| 32 | 32 | { |
| 33 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
| 33 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
| 34 | 34 | /* @var $form \PSFS\base\config\ConfigForm */ |
| 35 | 35 | $form = new ModuleForm(); |
| 36 | 36 | $form->build(); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $this->gen->createStructureModule($module, $force, $type, (bool)$is_module); |
| 62 | 62 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente"))); |
| 63 | 63 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
| 64 | - } catch (\Exception $e) { |
|
| 64 | + }catch (\Exception $e) { |
|
| 65 | 65 | pre($e->getMessage(), true); |
| 66 | - Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
| 66 | + Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
| 67 | 67 | throw new ConfigException('Error al generar el módulo, prueba a cambiar los permisos', 403); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Método que revisa las traducciones directorio a directorio |
| 29 | - * @param $path |
|
| 29 | + * @param string $path |
|
| 30 | 30 | * @param $locale |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Servicio que genera la estructura base |
| 102 | - * @param $module |
|
| 103 | - * @param $mod_path |
|
| 102 | + * @param string $module |
|
| 103 | + * @param string $mod_path |
|
| 104 | 104 | * @param boolean $isModule |
| 105 | 105 | */ |
| 106 | 106 | private function createModulePathTree($module, $mod_path, $isModule = false) |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * Method that copy resources recursively |
| 454 | 454 | * @param string $dest |
| 455 | 455 | * @param boolean $force |
| 456 | - * @param $filename_path |
|
| 456 | + * @param string $filename_path |
|
| 457 | 457 | * @param boolean $debug |
| 458 | 458 | */ |
| 459 | 459 | public static function copyResources($dest, $force, $filename_path, $debug) |
@@ -32,24 +32,24 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function findTranslations($path, $locale) |
| 34 | 34 | { |
| 35 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 36 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 35 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 36 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 37 | 37 | |
| 38 | 38 | $translations = array(); |
| 39 | 39 | if (file_exists($path)) { |
| 40 | 40 | $d = dir($path); |
| 41 | 41 | while (false !== ($dir = $d->read())) { |
| 42 | 42 | Config::createDir($locale_path); |
| 43 | - if (!file_exists($locale_path . 'translations.po')) { |
|
| 44 | - file_put_contents($locale_path . 'translations.po', ''); |
|
| 43 | + if (!file_exists($locale_path.'translations.po')) { |
|
| 44 | + file_put_contents($locale_path.'translations.po', ''); |
|
| 45 | 45 | } |
| 46 | - $inspect_path = realpath($path . DIRECTORY_SEPARATOR . $dir); |
|
| 47 | - $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext " . |
|
| 48 | - $inspect_path . DIRECTORY_SEPARATOR . |
|
| 46 | + $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir); |
|
| 47 | + $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". |
|
| 48 | + $inspect_path.DIRECTORY_SEPARATOR. |
|
| 49 | 49 | "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
| 50 | - if (is_dir($path . DIRECTORY_SEPARATOR . $dir) && preg_match('/^\./', $dir) == 0) { |
|
| 51 | - $res = _('Revisando directorio: ') . $inspect_path; |
|
| 52 | - $res .= _('Comando ejecutado: ') . $cmd_php; |
|
| 50 | + if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) { |
|
| 51 | + $res = _('Revisando directorio: ').$inspect_path; |
|
| 52 | + $res .= _('Comando ejecutado: ').$cmd_php; |
|
| 53 | 53 | $res .= shell_exec($cmd_php); |
| 54 | 54 | usleep(10); |
| 55 | 55 | $translations[] = $res; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function createStructureModule($module, $force = false, $type = "", $isModule = false) |
| 72 | 72 | { |
| 73 | - $mod_path = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 73 | + $mod_path = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 74 | 74 | $module = ucfirst($module); |
| 75 | 75 | $this->createModulePath($module, $mod_path, $isModule); |
| 76 | 76 | $this->createModulePathTree($module, $mod_path, $isModule); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | Config::createDir($mod_path); |
| 94 | 94 | // Create module path |
| 95 | 95 | if (false === $isModule) { |
| 96 | - Config::createDir($mod_path . $module); |
|
| 96 | + Config::createDir($mod_path.$module); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | $paths = [ |
| 111 | 111 | "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test" |
| 112 | 112 | ]; |
| 113 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 113 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 114 | 114 | foreach ($paths as $path) { |
| 115 | - Config::createDir($module_path . DIRECTORY_SEPARATOR . $path); |
|
| 115 | + Config::createDir($module_path.DIRECTORY_SEPARATOR.$path); |
|
| 116 | 116 | } |
| 117 | 117 | //Creamos las carpetas de los assets |
| 118 | 118 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 119 | 119 | foreach ($htmlPaths as $path) { |
| 120 | - Config::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 120 | + Config::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($isModule) { |
| 124 | 124 | return $this->writeTemplateToFile(json_encode([ |
| 125 | - "module" => "\\" . preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 126 | - ], JSON_PRETTY_PRINT), $mod_path . DIRECTORY_SEPARATOR . "module.json", true); |
|
| 125 | + "module" => "\\".preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 126 | + ], JSON_PRETTY_PRINT), $mod_path.DIRECTORY_SEPARATOR."module.json", true); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '', $isModule = false) |
| 139 | 139 | { |
| 140 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 140 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 141 | 141 | $this->generateControllerTemplate($module, $module_path, $force, $controllerType); |
| 142 | 142 | $this->generateServiceTemplate($module, $module_path, $force); |
| 143 | 143 | $this->genereateAutoloaderTemplate($module, $module_path, $force, $isModule); |
@@ -156,24 +156,24 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | private function createModuleModels($module, $path, $isModule = false) |
| 158 | 158 | { |
| 159 | - $module_path = $isModule ? $path : $path . $module; |
|
| 160 | - $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path); |
|
| 159 | + $module_path = $isModule ? $path : $path.$module; |
|
| 160 | + $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path); |
|
| 161 | 161 | //Generamos las clases de propel y la configuración |
| 162 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . |
|
| 163 | - "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 164 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . |
|
| 165 | - DIRECTORY_SEPARATOR . "Config"; |
|
| 166 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . |
|
| 167 | - "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 168 | - $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt); |
|
| 169 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 162 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR. |
|
| 163 | + "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 164 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path. |
|
| 165 | + DIRECTORY_SEPARATOR."Config"; |
|
| 166 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR. |
|
| 167 | + "Config --output-dir=".CORE_DIR." --verbose"; |
|
| 168 | + $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt); |
|
| 169 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 170 | 170 | |
| 171 | 171 | $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret"); |
| 172 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 173 | - $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 172 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 173 | + $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 174 | 174 | $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret"); |
| 175 | - $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 176 | - $module_path . DIRECTORY_SEPARATOR . "Config"); |
|
| 175 | + $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 176 | + $module_path.DIRECTORY_SEPARATOR."Config"); |
|
| 177 | 177 | $this->log->infoLog("[GENERATOR] Generamos configuración invocando a propel:\n $ret"); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -194,23 +194,23 @@ discard block |
||
| 194 | 194 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 195 | 195 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 196 | 196 | "class" => $class, |
| 197 | - "controllerType" => $class . "Base", |
|
| 197 | + "controllerType" => $class."Base", |
|
| 198 | 198 | "is_base" => false |
| 199 | 199 | )); |
| 200 | - $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 201 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 200 | + $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 201 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 202 | 202 | |
| 203 | 203 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 204 | 204 | "module" => $module, |
| 205 | 205 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 206 | 206 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 207 | - "class" => $class . "Base", |
|
| 207 | + "class" => $class."Base", |
|
| 208 | 208 | "service" => $class, |
| 209 | 209 | "controllerType" => $controllerType, |
| 210 | 210 | "is_base" => true |
| 211 | 211 | )); |
| 212 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 213 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 212 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 213 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 214 | 214 | return ($controller && $controllerBase); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -225,11 +225,9 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | $created = true; |
| 227 | 227 | $modelPath = $isModule ? |
| 228 | - $mod_path . DIRECTORY_SEPARATOR . 'Models' : |
|
| 229 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 228 | + $mod_path.DIRECTORY_SEPARATOR.'Models' : $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 230 | 229 | $api_path = $isModule ? |
| 231 | - $mod_path . DIRECTORY_SEPARATOR . 'Api' : |
|
| 232 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 230 | + $mod_path.DIRECTORY_SEPARATOR.'Api' : $mod_path.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 233 | 231 | if (file_exists($modelPath)) { |
| 234 | 232 | $dir = dir($modelPath); |
| 235 | 233 | while ($file = $dir->read()) { |
@@ -257,7 +255,7 @@ discard block |
||
| 257 | 255 | //Generamos el fichero de configuración |
| 258 | 256 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 259 | 257 | return $this->writeTemplateToFile("<?php\n\t", |
| 260 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 258 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 261 | 259 | $force); |
| 262 | 260 | } |
| 263 | 261 | |
@@ -272,10 +270,10 @@ discard block |
||
| 272 | 270 | //Generamos el fichero de configuración |
| 273 | 271 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 274 | 272 | $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", |
| 275 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", |
|
| 273 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", |
|
| 276 | 274 | $force); |
| 277 | 275 | $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", |
| 278 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", |
|
| 276 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", |
|
| 279 | 277 | $force); |
| 280 | 278 | return ($css && $js); |
| 281 | 279 | } |
@@ -297,7 +295,7 @@ discard block |
||
| 297 | 295 | "class" => $class, |
| 298 | 296 | )); |
| 299 | 297 | return $this->writeTemplateToFile($controller, |
| 300 | - $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php", |
|
| 298 | + $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php", |
|
| 301 | 299 | $force); |
| 302 | 300 | } |
| 303 | 301 | |
@@ -318,7 +316,7 @@ discard block |
||
| 318 | 316 | "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module), |
| 319 | 317 | "is_module" => $isModule, |
| 320 | 318 | )); |
| 321 | - return $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 319 | + return $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 322 | 320 | } |
| 323 | 321 | |
| 324 | 322 | /** |
@@ -338,7 +336,7 @@ discard block |
||
| 338 | 336 | "db" => $this->config->get("db_name"), |
| 339 | 337 | )); |
| 340 | 338 | return $this->writeTemplateToFile($schema, |
| 341 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 339 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 342 | 340 | $force); |
| 343 | 341 | } |
| 344 | 342 | |
@@ -361,7 +359,7 @@ discard block |
||
| 361 | 359 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 362 | 360 | )); |
| 363 | 361 | return $this->writeTemplateToFile($build_properties, |
| 364 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", |
|
| 362 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", |
|
| 365 | 363 | $force); |
| 366 | 364 | } |
| 367 | 365 | |
@@ -379,7 +377,7 @@ discard block |
||
| 379 | 377 | "module" => $module, |
| 380 | 378 | )); |
| 381 | 379 | return $this->writeTemplateToFile($index, |
| 382 | - $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 380 | + $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 383 | 381 | $force); |
| 384 | 382 | } |
| 385 | 383 | |
@@ -397,11 +395,11 @@ discard block |
||
| 397 | 395 | try { |
| 398 | 396 | $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
| 399 | 397 | $created = true; |
| 400 | - } catch (\Exception $e) { |
|
| 398 | + }catch (\Exception $e) { |
|
| 401 | 399 | $this->log->errorLog($e->getMessage()); |
| 402 | 400 | } |
| 403 | - } else { |
|
| 404 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 401 | + }else { |
|
| 402 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 405 | 403 | } |
| 406 | 404 | return $created; |
| 407 | 405 | } |
@@ -426,7 +424,7 @@ discard block |
||
| 426 | 424 | )); |
| 427 | 425 | |
| 428 | 426 | return $this->writeTemplateToFile($controller, |
| 429 | - $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 427 | + $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 430 | 428 | } |
| 431 | 429 | |
| 432 | 430 | /** |
@@ -449,7 +447,7 @@ discard block |
||
| 449 | 447 | "class" => $class, |
| 450 | 448 | )); |
| 451 | 449 | |
| 452 | - return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 450 | + return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 453 | 451 | } |
| 454 | 452 | |
| 455 | 453 | /** |
@@ -463,12 +461,12 @@ discard block |
||
| 463 | 461 | { |
| 464 | 462 | if (file_exists($filename_path)) { |
| 465 | 463 | $destfolder = basename($filename_path); |
| 466 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 464 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 467 | 465 | if (is_dir($filename_path)) { |
| 468 | - self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 469 | - } else { |
|
| 470 | - if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 471 | - throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 466 | + self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 467 | + }else { |
|
| 468 | + if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 469 | + throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 472 | 470 | } |
| 473 | 471 | } |
| 474 | 472 | } |
@@ -487,10 +485,10 @@ discard block |
||
| 487 | 485 | Config::createDir($dst); |
| 488 | 486 | while (false !== ($file = readdir($dir))) { |
| 489 | 487 | if (($file != '.') && ($file != '..')) { |
| 490 | - if (is_dir($src . '/' . $file)) { |
|
| 491 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 492 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 493 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 488 | + if (is_dir($src.'/'.$file)) { |
|
| 489 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 490 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 491 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 494 | 492 | } |
| 495 | 493 | } |
| 496 | 494 | } |