@@ -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 | GeneratorHelper::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 | GeneratorHelper::createDir($mod_path); |
| 94 | 94 | // Create module path |
| 95 | 95 | if (false === $isModule) { |
| 96 | - GeneratorHelper::createDir($mod_path . $module); |
|
| 96 | + GeneratorHelper::createDir($mod_path.$module); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -111,20 +111,20 @@ discard block |
||
| 111 | 111 | $paths = [ |
| 112 | 112 | "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test" |
| 113 | 113 | ]; |
| 114 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 114 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 115 | 115 | foreach ($paths as $path) { |
| 116 | - GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . $path); |
|
| 116 | + GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR.$path); |
|
| 117 | 117 | } |
| 118 | 118 | //Creamos las carpetas de los assets |
| 119 | 119 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 120 | 120 | foreach ($htmlPaths as $path) { |
| 121 | - GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 121 | + GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($isModule) { |
| 125 | 125 | return $this->writeTemplateToFile(json_encode([ |
| 126 | - "module" => "\\" . preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 127 | - ], JSON_PRETTY_PRINT), $mod_path . DIRECTORY_SEPARATOR . "module.json", true); |
|
| 126 | + "module" => "\\".preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 127 | + ], JSON_PRETTY_PRINT), $mod_path.DIRECTORY_SEPARATOR."module.json", true); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '', $isModule = false) |
| 140 | 140 | { |
| 141 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 141 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 142 | 142 | $this->generateControllerTemplate($module, $module_path, $force, $controllerType); |
| 143 | 143 | $this->generateServiceTemplate($module, $module_path, $force); |
| 144 | 144 | $this->genereateAutoloaderTemplate($module, $module_path, $force, $isModule); |
@@ -157,28 +157,28 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | private function createModuleModels($module, $path, $isModule = false) |
| 159 | 159 | { |
| 160 | - $module_path = $isModule ? $path : $path . $module; |
|
| 161 | - $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path); |
|
| 160 | + $module_path = $isModule ? $path : $path.$module; |
|
| 161 | + $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path); |
|
| 162 | 162 | //Generamos las clases de propel y la configuración |
| 163 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . |
|
| 164 | - "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 165 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . |
|
| 166 | - DIRECTORY_SEPARATOR . "Config"; |
|
| 167 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . |
|
| 168 | - "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 169 | - $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt); |
|
| 170 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 163 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR. |
|
| 164 | + "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 165 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path. |
|
| 166 | + DIRECTORY_SEPARATOR."Config"; |
|
| 167 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR. |
|
| 168 | + "Config --output-dir=".CORE_DIR." --verbose"; |
|
| 169 | + $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt); |
|
| 170 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 171 | 171 | |
| 172 | 172 | $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret"); |
| 173 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 174 | - $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 173 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 174 | + $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 175 | 175 | $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret"); |
| 176 | 176 | |
| 177 | 177 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
| 178 | 178 | "module" => $module, |
| 179 | 179 | )); |
| 180 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . "Config" . |
|
| 181 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
| 180 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR."Config". |
|
| 181 | + DIRECTORY_SEPARATOR."config.php", true); |
|
| 182 | 182 | $this->log->infoLog("Generado config genérico para propel:\n $ret"); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -199,32 +199,32 @@ discard block |
||
| 199 | 199 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 200 | 200 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 201 | 201 | "class" => $class, |
| 202 | - "controllerType" => $class . "Base", |
|
| 202 | + "controllerType" => $class."Base", |
|
| 203 | 203 | "is_base" => false |
| 204 | 204 | )); |
| 205 | - $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 206 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 205 | + $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 206 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 207 | 207 | |
| 208 | 208 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 209 | 209 | "module" => $module, |
| 210 | 210 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 211 | 211 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 212 | - "class" => $class . "Base", |
|
| 212 | + "class" => $class."Base", |
|
| 213 | 213 | "service" => $class, |
| 214 | 214 | "controllerType" => $controllerType, |
| 215 | 215 | "is_base" => true, |
| 216 | 216 | "domain" => $class, |
| 217 | 217 | )); |
| 218 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 219 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 218 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 219 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 220 | 220 | |
| 221 | 221 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
| 222 | 222 | "module" => $module, |
| 223 | 223 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 224 | 224 | "class" => $class, |
| 225 | 225 | )); |
| 226 | - $test = $this->writeTemplateToFile($testTemplate, $mod_path . DIRECTORY_SEPARATOR . "Test" . |
|
| 227 | - DIRECTORY_SEPARATOR . "{$class}Test.php", true); |
|
| 226 | + $test = $this->writeTemplateToFile($testTemplate, $mod_path.DIRECTORY_SEPARATOR."Test". |
|
| 227 | + DIRECTORY_SEPARATOR."{$class}Test.php", true); |
|
| 228 | 228 | return ($controller && $controllerBase && $test); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -239,11 +239,9 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | $created = true; |
| 241 | 241 | $modelPath = $isModule ? |
| 242 | - $mod_path . DIRECTORY_SEPARATOR . 'Models' : |
|
| 243 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 242 | + $mod_path.DIRECTORY_SEPARATOR.'Models' : $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 244 | 243 | $api_path = $isModule ? |
| 245 | - $mod_path . DIRECTORY_SEPARATOR . 'Api' : |
|
| 246 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 244 | + $mod_path.DIRECTORY_SEPARATOR.'Api' : $mod_path.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 247 | 245 | if (file_exists($modelPath)) { |
| 248 | 246 | $dir = dir($modelPath); |
| 249 | 247 | while ($file = $dir->read()) { |
@@ -271,7 +269,7 @@ discard block |
||
| 271 | 269 | //Generamos el fichero de configuración |
| 272 | 270 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 273 | 271 | return $this->writeTemplateToFile("<?php\n\t", |
| 274 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 272 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 275 | 273 | $force); |
| 276 | 274 | } |
| 277 | 275 | |
@@ -286,10 +284,10 @@ discard block |
||
| 286 | 284 | //Generamos el fichero de configuración |
| 287 | 285 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 288 | 286 | $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", |
| 289 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", |
|
| 287 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", |
|
| 290 | 288 | $force); |
| 291 | 289 | $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", |
| 292 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", |
|
| 290 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", |
|
| 293 | 291 | $force); |
| 294 | 292 | return ($css && $js); |
| 295 | 293 | } |
@@ -311,7 +309,7 @@ discard block |
||
| 311 | 309 | "class" => $class, |
| 312 | 310 | )); |
| 313 | 311 | return $this->writeTemplateToFile($controller, |
| 314 | - $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php", |
|
| 312 | + $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php", |
|
| 315 | 313 | $force); |
| 316 | 314 | } |
| 317 | 315 | |
@@ -332,14 +330,14 @@ discard block |
||
| 332 | 330 | "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module), |
| 333 | 331 | "is_module" => $isModule, |
| 334 | 332 | )); |
| 335 | - $autoload = $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 333 | + $autoload = $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 336 | 334 | |
| 337 | 335 | $this->log->infoLog("Generamos el phpunit"); |
| 338 | 336 | $phpUnitTemplate = $this->tpl->dump("generator/phpunit.template.twig", array( |
| 339 | 337 | "module" => $module, |
| 340 | 338 | "is_module" => $isModule, |
| 341 | 339 | )); |
| 342 | - $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path . DIRECTORY_SEPARATOR . "phpunit.xml.dist", $force); |
|
| 340 | + $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path.DIRECTORY_SEPARATOR."phpunit.xml.dist", $force); |
|
| 343 | 341 | return $autoload && $phpunit; |
| 344 | 342 | } |
| 345 | 343 | |
@@ -360,7 +358,7 @@ discard block |
||
| 360 | 358 | "db" => $this->config->get("db_name"), |
| 361 | 359 | )); |
| 362 | 360 | return $this->writeTemplateToFile($schema, |
| 363 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 361 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 364 | 362 | $force); |
| 365 | 363 | } |
| 366 | 364 | |
@@ -383,7 +381,7 @@ discard block |
||
| 383 | 381 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 384 | 382 | )); |
| 385 | 383 | return $this->writeTemplateToFile($build_properties, |
| 386 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", |
|
| 384 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", |
|
| 387 | 385 | $force); |
| 388 | 386 | } |
| 389 | 387 | |
@@ -401,7 +399,7 @@ discard block |
||
| 401 | 399 | "module" => $module, |
| 402 | 400 | )); |
| 403 | 401 | return $this->writeTemplateToFile($index, |
| 404 | - $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 402 | + $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 405 | 403 | $force); |
| 406 | 404 | } |
| 407 | 405 | |
@@ -419,11 +417,11 @@ discard block |
||
| 419 | 417 | try { |
| 420 | 418 | $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
| 421 | 419 | $created = true; |
| 422 | - } catch (\Exception $e) { |
|
| 420 | + }catch (\Exception $e) { |
|
| 423 | 421 | $this->log->errorLog($e->getMessage()); |
| 424 | 422 | } |
| 425 | - } else { |
|
| 426 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 423 | + }else { |
|
| 424 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 427 | 425 | } |
| 428 | 426 | return $created; |
| 429 | 427 | } |
@@ -448,7 +446,7 @@ discard block |
||
| 448 | 446 | )); |
| 449 | 447 | |
| 450 | 448 | return $this->writeTemplateToFile($controller, |
| 451 | - $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 449 | + $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 452 | 450 | } |
| 453 | 451 | |
| 454 | 452 | /** |
@@ -471,7 +469,7 @@ discard block |
||
| 471 | 469 | "class" => $class, |
| 472 | 470 | )); |
| 473 | 471 | |
| 474 | - return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 472 | + return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 475 | 473 | } |
| 476 | 474 | |
| 477 | 475 | /** |
@@ -485,12 +483,12 @@ discard block |
||
| 485 | 483 | { |
| 486 | 484 | if (file_exists($filename_path)) { |
| 487 | 485 | $destfolder = basename($filename_path); |
| 488 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 486 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 489 | 487 | if (is_dir($filename_path)) { |
| 490 | - self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 491 | - } else { |
|
| 492 | - if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 493 | - throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 488 | + self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 489 | + }else { |
|
| 490 | + if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 491 | + throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 494 | 492 | } |
| 495 | 493 | } |
| 496 | 494 | } |
@@ -509,10 +507,10 @@ discard block |
||
| 509 | 507 | GeneratorHelper::createDir($dst); |
| 510 | 508 | while (false !== ($file = readdir($dir))) { |
| 511 | 509 | if (($file != '.') && ($file != '..')) { |
| 512 | - if (is_dir($src . '/' . $file)) { |
|
| 513 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 514 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 515 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 510 | + if (is_dir($src.'/'.$file)) { |
|
| 511 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 512 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 513 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 516 | 514 | } |
| 517 | 515 | } |
| 518 | 516 | } |
@@ -5,17 +5,17 @@ |
||
| 5 | 5 | |
| 6 | 6 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
| 7 | 7 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 8 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 9 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 10 | -} else { |
|
| 11 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 12 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 8 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
| 9 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
| 10 | +}else { |
|
| 11 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
| 12 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
| 13 | 13 | } |
| 14 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 15 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 16 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 17 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 18 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 14 | +if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
| 15 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
| 16 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
| 17 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
| 18 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
| 19 | 19 | |
| 20 | 20 | defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true); |
| 21 | 21 | |
@@ -1,21 +1,43 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace PSFS; |
| 3 | 3 | |
| 4 | -if (defined('PSFS_BOOTSTRAP_LOADED')) return; |
|
| 4 | +if (defined('PSFS_BOOTSTRAP_LOADED')) { |
|
| 5 | + return; |
|
| 6 | +} |
|
| 5 | 7 | |
| 6 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
| 8 | +if (!defined('SOURCE_DIR')) { |
|
| 9 | + define('SOURCE_DIR', __DIR__); |
|
| 10 | +} |
|
| 7 | 11 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 8 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 9 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 10 | -} else { |
|
| 11 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 12 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 13 | -} |
|
| 14 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 15 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 16 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 17 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 18 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 12 | + if (!defined('BASE_DIR')) { |
|
| 13 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 14 | + } |
|
| 15 | + if (!defined('CORE_DIR')) { |
|
| 16 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 17 | + } |
|
| 18 | + } else { |
|
| 19 | + if (!defined('BASE_DIR')) { |
|
| 20 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 21 | + } |
|
| 22 | + if (!defined('CORE_DIR')) { |
|
| 23 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | +if (!defined('VENDOR_DIR')) { |
|
| 27 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 28 | +} |
|
| 29 | +if (!defined('LOG_DIR')) { |
|
| 30 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 31 | +} |
|
| 32 | +if (!defined('CACHE_DIR')) { |
|
| 33 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 34 | +} |
|
| 35 | +if (!defined('CONFIG_DIR')) { |
|
| 36 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 37 | +} |
|
| 38 | +if (!defined('WEB_DIR')) { |
|
| 39 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 40 | +} |
|
| 19 | 41 | |
| 20 | 42 | defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true); |
| 21 | 43 | |