Update database import script, JS dom rel function, typos

the JS dom rel function returns the full element.
The database import script has now test and step by step with retry
import functionality

various comment typo fixe
This commit is contained in:
Clemens Schwaighofer
2019-05-31 13:53:02 +09:00
parent 0111762315
commit fe32dd4543
5 changed files with 68 additions and 18 deletions

View File

@@ -5,19 +5,63 @@
#echo "EXIT";
#exit;
# if flagged 'y' then it will ask after each import to continue
development='y';
test='n';
input='';
# database connection info
db='<db name>';
host='<db host>';
user='<db user>';
#schema="publicv";
schema="public";
export PGPASSWORD='';
for file in `cat ORDER`;
do
if [ -f $file ];
then
# for path in $schema;
# do
# echo "WORK ON "$schema"."$file;
psql -U $user -h $host -f $file $db 1>> output 2>> error
# done;
# log files
error_file="log/error";
output_file="log/output";
if [ ! -f ORDER ]; then
echo "Could not find ORDER file";
exit;
fi;
if [ "$test" != "n" ]; then
echo "TESTING MODE, NO DATA WILL BE IMPORTED";
fi;
if [ "$development" = "y" ]; then
echo "STEP BY STEP IMPORT MODE ACTIVATED";
fi;
while read file <&3; do
if [ "$file" = "FINISHED" ]; then
echo "Database data is flagged as FINISHED in ORDER file";
exit;
fi;
done;
if [ -f "$file" ]; then
for path in "$schemas"; do
echo "[+] WORK ON '${file}' @ '${path}'";
if [ "$test" = 'n' ]; then
echo "=== START [$file] ===>" >> ${error_file};
psql -U ${user} -h ${host} -f "${file}" ${db} 1>> ${output_file} 2>> ${error_file}
echo "=== END [$file] ===>" >> ${error_file};
fi;
if [ "$development" = "y" ]; then
echo "Press 'y' to move to next. Press 'r' to reload last file. ^c to abort";
fi;
while [ "$development" = "y" ] && [ "$input" != "y" ]; do
read -ep "Continue (y|r|^c): " input;
if [ "$input" = "r" ]; then
echo "Reload File '${file}' ...";
if [ "$test" = 'n' ]; then
echo "=== START RELOAD [$file] ===>" >> ${error_file};
psql -U ${user} -h ${host} -f "${file}" ${db} 1>> ${output_file} 2>> ${error_file}
echo "=== END RELOAD [$file] ===>" >> ${error_file};
fi;
fi;
done;
input='';
done;
elif [[ ${file::1} != "#" ]]; then
echo "[!] COULD NOT FIND FILE: '${file}'";
fi;
done 3<ORDER;

View File

@@ -79,7 +79,7 @@ if (isset($TEMPLATE_NAME) && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPL
if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) ||
strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG, $lang)
) {
$cms->debug('LANG', 'Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang);
$cms->debug('LANG', 'Orig: '.BASE.INCLUDES.LANG.CONTENT_PATH.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang);
$cms->l->l10nReloadMOfile($lang, $cms->lang_dir);
// if we have login class
if ($login) {
@@ -91,7 +91,7 @@ if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) ||
}
}
// javascrip translate data as template for auto translate
// javascript translate data as template for auto translate
if (!$TEMPLATE_TRANSLATE) {
$TEMPLATE_TRANSLATE = 'jsTranslate_'.$lang.'.tpl';
$cms->debug('LANG', 'Load lang: '.$lang.', for page file '.$TEMPLATE_TRANSLATE);

View File

@@ -14,7 +14,7 @@ if ($cms->HEADER['USE_PROTOTYPE']) {
$cms->HEADER['USE_SCRIPTACULOUS'] = isset($USE_SCRIPTACULOUS) ? $USE_SCRIPTACULOUS : USE_SCRIPTACULOUS;
}
// jquery and prototype should not be used together
$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two toger
$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two together
// set basic template path (tmp)
// paths are set in the 'set_paths.inc' file

View File

@@ -428,9 +428,12 @@ function aelx(base, ...attach)
// METHOD: rel [reset element]
// PARAMS: cel created element
// RETURN: "none", is self change, but returns base.sub
// RETURN: returns sub reset base element
// DESC : resets the sub elements of the base element given
const rel = (base) => base.sub = [];
const rel = (base) => {
base.sub = [];
return base;
};
// METHOD: rcssel [remove a css from the element]
// PARAMS: element, style sheet to remove

View File

@@ -506,9 +506,12 @@ function aelx(base, ...attach)
// METHOD: rel [reset element]
// PARAMS: cel created element
// RETURN: "none", is self change, but returns base.sub
// RETURN: returns sub reset base element
// DESC : resets the sub elements of the base element given
const rel = (base) => base.sub = [];
const rel = (base) => {
base.sub = [];
return base;
};
// METHOD: rcssel [remove a css from the element]
// PARAMS: element, style sheet to remove