Admin/siteconfig

* also rebuild js-locales when updating available locales
 * somewhat unhappy with the access to generated files. need to find a better solution.
This commit is contained in:
Sarjuuk
2017-05-09 19:02:08 +02:00
parent 1bb7fdf89a
commit 7b7ec2d0aa
4 changed files with 35 additions and 37 deletions

View File

@@ -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.<br />';
$msg .= ' * you can speed this up by supplying the regionCode to the setup: <pre class="q1">--locales=<regionCodes,> -f</pre>';
break;
case 'profiler_queue':
$fn = function($x) use (&$msg) {
if (!$x)

View File

@@ -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'

View File

@@ -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=<regionCodes,> -f'));
break;
case 'profiler_queue':
$fn = function($x) {
if (!$x)

View File

@@ -207,8 +207,6 @@ class FileGen
list($file, $destPath, $deps) = self::$tplFiles[$key];
if ($content = file_get_contents(FileGen::$tplPath.$file.'.in'))
{
if ($dest = @fOpen($destPath.$file, "w"))
{
// replace constants
$content = strtr($content, FileGen::$txtConstants);
@@ -237,20 +235,10 @@ class FileGen
}
}
if (fWrite($dest, $content))
{
CLISetup::log(sprintf(ERR_NONE, CLISetup::bold($destPath.$file)), CLISetup::LOG_OK);
if ($content && $funcOK)
if (CLISetup::writeFile($destPath.$file, $content))
$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);
}
else
CLISetup::log(sprintf(ERR_READ_FILE, CLISetup::bold(FileGen::$tplPath.$file.'.in')), CLISetup::LOG_ERROR);
}