diff --git a/includes/ajaxHandler/admin.class.php b/includes/ajaxHandler/admin.class.php
index 90558dd4..b9edffcb 100644
--- a/includes/ajaxHandler/admin.class.php
+++ b/includes/ajaxHandler/admin.class.php
@@ -466,6 +466,11 @@ class AjaxAdmin extends AjaxHandler
case 'static_host':
$buildList = 'searchplugin,power,searchboxBody,searchboxScript';
break;
+ case 'locales':
+ $buildList = 'locales';
+ $msg .= ' * remember to rebuild all static files for the language you just added.
';
+ $msg .= ' * you can speed this up by supplying the regionCode to the setup:
--locales= -f
';
+ break;
case 'profiler_queue':
$fn = function($x) use (&$msg) {
if (!$x)
diff --git a/includes/utilities.php b/includes/utilities.php
index f2e4096f..a9f333a1 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -18,7 +18,7 @@ class SimpleXML extends SimpleXMLElement
class Util
{
- const FILE_ACCESS = 0755;
+ const FILE_ACCESS = 0777;
public static $localeStrings = array( // zero-indexed
'enus', null, 'frfr', 'dede', null, null, 'eses', null, 'ruru'
diff --git a/setup/tools/clisetup/siteconfig.func.php b/setup/tools/clisetup/siteconfig.func.php
index a439f5f4..a070ddbf 100644
--- a/setup/tools/clisetup/siteconfig.func.php
+++ b/setup/tools/clisetup/siteconfig.func.php
@@ -41,6 +41,11 @@ function siteconfig()
case 'static_host':
array_push($updScripts, 'searchplugin', 'power', 'searchboxBody', 'searchboxScript');
break;
+ case 'locales':
+ array_push($updScripts, 'locales');
+ CLISetup::log(' * remember to rebuild all static files for the language you just added.', CLISetup::LOG_INFO);
+ CLISetup::log(' * you can speed this up by supplying the regionCode to the setup: '.CLISetup::bold('--locales= -f'));
+ break;
case 'profiler_queue':
$fn = function($x) {
if (!$x)
diff --git a/setup/tools/fileGen.class.php b/setup/tools/fileGen.class.php
index ab58f77d..b3e84fa8 100644
--- a/setup/tools/fileGen.class.php
+++ b/setup/tools/fileGen.class.php
@@ -208,48 +208,36 @@ class FileGen
if ($content = file_get_contents(FileGen::$tplPath.$file.'.in'))
{
- if ($dest = @fOpen($destPath.$file, "w"))
+ // replace constants
+ $content = strtr($content, FileGen::$txtConstants);
+
+ // check for required auxiliary DBC files
+ foreach ($reqDBC as $req)
+ if (!CLISetup::loadDBC($req))
+ continue;
+
+ // must generate content
+ // PH format: /*setup:*/
+ $funcOK = true;
+ if (preg_match_all('/\/\*setup:([\w\-_]+)\*\//i', $content, $m))
{
- // replace constants
- $content = strtr($content, FileGen::$txtConstants);
-
- // check for required auxiliary DBC files
- foreach ($reqDBC as $req)
- if (!CLISetup::loadDBC($req))
- continue;
-
- // must generate content
- // PH format: /*setup:*/
- $funcOK = true;
- if (preg_match_all('/\/\*setup:([\w\-_]+)\*\//i', $content, $m))
+ foreach ($m[1] as $func)
{
- foreach ($m[1] as $func)
+ if (function_exists($func))
+ $content = str_replace('/*setup:'.$func.'*/', $func(), $content);
+ else
{
- if (function_exists($func))
- $content = str_replace('/*setup:'.$func.'*/', $func(), $content);
- else
- {
- $funcOK = false;
- CLISetup::log('No function for was registered for placeholder '.$func.'().', CLISetup::LOG_ERROR);
- if (!array_reduce(get_included_files(), function ($inArray, $itr) use ($func) { return $inArray || false !== strpos($itr, $func); }, false))
- CLISetup::log('Also, expected include setup/tools/filegen/'.$name.'.func.php was not found.');
- }
+ $funcOK = false;
+ CLISetup::log('No function for was registered for placeholder '.$func.'().', CLISetup::LOG_ERROR);
+ if (!array_reduce(get_included_files(), function ($inArray, $itr) use ($func) { return $inArray || false !== strpos($itr, $func); }, false))
+ CLISetup::log('Also, expected include setup/tools/filegen/'.$name.'.func.php was not found.');
}
}
-
- if (fWrite($dest, $content))
- {
- CLISetup::log(sprintf(ERR_NONE, CLISetup::bold($destPath.$file)), CLISetup::LOG_OK);
- if ($content && $funcOK)
- $success = true;
- }
- else
- CLISetup::log(sprintf(ERR_WRITE_FILE, CLISetup::bold($destPath.$file)), CLISetup::LOG_ERROR);
-
- fClose($dest);
}
- else
- CLISetup::log(sprintf(ERR_CREATE_FILE, CLISetup::bold($destPath.$file)), CLISetup::LOG_ERROR);
+
+ if ($content && $funcOK)
+ if (CLISetup::writeFile($destPath.$file, $content))
+ $success = true;
}
else
CLISetup::log(sprintf(ERR_READ_FILE, CLISetup::bold(FileGen::$tplPath.$file.'.in')), CLISetup::LOG_ERROR);