From cd7cc6cea5fdd5fe87aed1b85f373f7747d188c3 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 01:33:22 +0000 Subject: [PATCH 01/26] update inspection behaviour --- Config/phpmetrics.json | 9 +++ Helper/Scripts/cloneall.sh | 11 +++ Helper/Scripts/serverInstall.sh | 20 +++++- Inspection/Html/static_text.sh | 4 +- Inspection/Html/syntax.sh | 29 +++----- Inspection/Html/tags.sh | 3 +- Inspection/Js/security.sh | 9 +-- Inspection/Js/style.sh | 3 +- Inspection/Php/linting.sh | 15 +--- Inspection/Php/security.sh | 15 +--- Inspection/Php/stats.sh | 10 +-- Inspection/Php/style.sh | 10 +-- Inspection/Php/tests.sh | 7 +- Inspection/Sql/performance.sh | 6 +- Inspection/inspect.sh | 122 +++----------------------------- config.sh | 1 - php.sh | 15 ++++ 17 files changed, 92 insertions(+), 197 deletions(-) create mode 100644 Config/phpmetrics.json create mode 100644 Helper/Scripts/cloneall.sh create mode 100644 php.sh diff --git a/Config/phpmetrics.json b/Config/phpmetrics.json new file mode 100644 index 0000000..4ccd726 --- /dev/null +++ b/Config/phpmetrics.json @@ -0,0 +1,9 @@ +{ + "composer": false, + "excludes": [ + ".git", + "tests", + "vendor", + "Resources" + ] +} \ No newline at end of file diff --git a/Helper/Scripts/cloneall.sh b/Helper/Scripts/cloneall.sh new file mode 100644 index 0000000..c2a3cb7 --- /dev/null +++ b/Helper/Scripts/cloneall.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +CNTX="users"; NAME="Karaka-Management"; PAGE=1 +curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | + grep -e 'clone_url*' | + cut -d \" -f 4 | + xargs -L1 git clone + +find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git checkout develop" \; +find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git submodule foreach 'git checkout develop || true'" \; +find ./src -maxdepth 1 -type d \( ! -name . \) -exec bash -c "Build/php.sh '{}' '{}/build'" \; \ No newline at end of file diff --git a/Helper/Scripts/serverInstall.sh b/Helper/Scripts/serverInstall.sh index 2d3a771..4385afd 100644 --- a/Helper/Scripts/serverInstall.sh +++ b/Helper/Scripts/serverInstall.sh @@ -10,7 +10,7 @@ export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" > apt-get update apt-get upgrade -apt-get install git git-lfs snapd ufw software-properties-common +apt-get install git git-lfs snapd ufw software-properties-common composer # Security @@ -150,6 +150,23 @@ cat << EOF > /etc/apache2/sites-available/000-demo.conf EOF +cat << EOF > /etc/apache2/sites-available/000-dev.conf + + ServerAdmin info@jingga.app + DocumentRoot /var/www/html/dev + ServerName dev.jingga.app + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + +EOF + cat << EOF > /etc/apache2/sites-available/000-services.conf ServerAdmin info@jingga.app @@ -535,6 +552,7 @@ mkdir -p /var/www/html/backup/bash chmod -R 766 /var/www/html/backup a2ensite 000-demo.conf +a2ensite 000-dev.conf a2ensite 000-shop.conf a2ensite 000-services.conf a2ensite 000-software.conf diff --git a/Inspection/Html/static_text.sh b/Inspection/Html/static_text.sh index 8b003b8..1bf9c78 100644 --- a/Inspection/Html/static_text.sh +++ b/Inspection/Html/static_text.sh @@ -6,5 +6,5 @@ echo "#################################################" echo "Start static text inspection" echo "#################################################" -grep -rlnP '(title|alt|aria\-label)(=\")((?!\<\?).)*(>)' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/static_text.log -grep -rlnP '(\|\|\|\)[0-9a-zA-Z\.\?]+' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/static_text.log +grep -rlnP '(title|alt|aria\-label)(=\")((?!\<\?).)*(>)' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/static_text.log +grep -rlnP '(\|\|\|\)[0-9a-zA-Z\.\?]+' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/static_text.log diff --git a/Inspection/Html/syntax.sh b/Inspection/Html/syntax.sh index 4e37711..db86277 100644 --- a/Inspection/Html/syntax.sh +++ b/Inspection/Html/syntax.sh @@ -7,27 +7,14 @@ echo "Start html syntax inspection" echo "#################################################" # -echo "Image alt missing:" > ${INSPECTION_PATH}/Modules/html_syntax.log -grep -rlnP '(\)' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/html_syntax.log +echo "Image alt missing:" > ${OUTPUT_PATH}/html_syntax.log +grep -rlnP '(\)' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/html_syntax.log -echo "Input type missing:" >> ${INSPECTION_PATH}/Modules/html_syntax.log -grep -rlnP '()' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/html_syntax.log +echo "Input type missing:" >> ${OUTPUT_PATH}/html_syntax.log +grep -rlnP '()' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/html_syntax.log -echo "Input name missing:" >> ${INSPECTION_PATH}/Modules/html_syntax.log -grep -rlnP '()' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/html_syntax.log +echo "Input name missing:" >> ${OUTPUT_PATH}/html_syntax.log +grep -rlnP '()' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/html_syntax.log -echo "Form id missing:" >> ${INSPECTION_PATH}/Modules/html_syntax.log -grep -rlnP '(\)' --include \*.tpl.php Modules >> ${INSPECTION_PATH}/Modules/html_syntax.log - -# -echo "Image alt missing:" > ${INSPECTION_PATH}/Web/html_syntax.log -grep -rlnP '(\)' --include \*.tpl.php Web >> ${INSPECTION_PATH}/Web/html_syntax.log - -echo "Input type missing:" >> ${INSPECTION_PATH}/Web/html_syntax.log -grep -rlnP '()' --include \*.tpl.php Web >> ${INSPECTION_PATH}/Web/html_syntax.log - -echo "Input name missing:" >> ${INSPECTION_PATH}/Web/html_syntax.log -grep -rlnP '()' --include \*.tpl.php Web >> ${INSPECTION_PATH}/Web/html_syntax.log - -echo "Form id missing:" >> ${INSPECTION_PATH}/Web/html_syntax.log -grep -rlnP '(\)' --include \*.tpl.php Web >> ${INSPECTION_PATH}/Web/html_syntax.log \ No newline at end of file +echo "Form id missing:" >> ${OUTPUT_PATH}/html_syntax.log +grep -rlnP '(\)' --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/html_syntax.log \ No newline at end of file diff --git a/Inspection/Html/tags.sh b/Inspection/Html/tags.sh index 8a12377..4c1a7b8 100755 --- a/Inspection/Html/tags.sh +++ b/Inspection/Html/tags.sh @@ -29,6 +29,5 @@ TAG[18]="" for i in "${TAG[@]}" do - grep -rln "$i" --include \*.tpl.php ${ROOT_PATH}/phpOMS >> ${INSPECTION_PATH}/Framework/html_tags.log - grep -rln "$i" --include \*.tpl.php ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/html_tags.log + grep -rln "$i" --include \*.tpl.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/html_tags.log done diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index 56414a7..9a56fe2 100755 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -7,12 +7,7 @@ echo "Start js security inspection" echo "#################################################" # JS code inspection -grep -rlni "onafterprint=\|onbeforeprint=\|onbeforeunload=\|onerror=\|onhaschange=\|onload=\|onmessage=\|onoffline=\|ononline=\|onpagehide=\|onpageshow=\|onpopstate=\|onredo=\|onresize=\|onstorage=\|onund=o\|onunload=\|onblur=\|onchage=\|oncontextmenu=\|onfocus=\|onformchange=\|onforminput=\|oninput=\|oninvalid=\|onreset=\|onselect=\|onsubmit=\|onkeydown=\|onkeypress=\|onkeyup=\|onclick=\|ondblclic=k\|ondrag=\|ondragend=\|ondragenter=\|ondragleave=\|ondragover=\|ondragstart=\|ondrop=\|onmousedown=\|onmousemove=\|onmouseout=\|onmouseover=\|onmouseup=\|onmousewheel=\|onscroll=\|onabor=t\|oncanplay=\|oncanplaythrough=\|ondurationchange=\|onemptied=\|onended=\|onerror=\|onloadeddata=\|onloadedmetadata=\|onloadstart=\|onpause=\|onplay=\|onplaying=\|onprogress=\|onratechange=\|onreadystatechange=\|onseeked=\|onseeking=\|onstalled=\|onsuspend=\|ontimeupdate=\|onvolumechange=" --include=*.js ${ROOT_PATH}/jsOMS >> ${INSPECTION_PATH}/Framework/critical_js.log -grep -rlni "onafterprint=\|onbeforeprint=\|onbeforeunload=\|onerror=\|onhaschange=\|onload=\|onmessage=\|onoffline=\|ononline=\|onpagehide=\|onpageshow=\|onpopstate=\|onredo=\|onresize=\|onstorage=\|onund=o\|onunload=\|onblur=\|onchage=\|oncontextmenu=\|onfocus=\|onformchange=\|onforminput=\|oninput=\|oninvalid=\|onreset=\|onselect=\|onsubmit=\|onkeydown=\|onkeypress=\|onkeyup=\|onclick=\|ondblclic=k\|ondrag=\|ondragend=\|ondragenter=\|ondragleave=\|ondragover=\|ondragstart=\|ondrop=\|onmousedown=\|onmousemove=\|onmouseout=\|onmouseover=\|onmouseup=\|onmousewheel=\|onscroll=\|onabor=t\|oncanplay=\|oncanplaythrough=\|ondurationchange=\|onemptied=\|onended=\|onerror=\|onloadeddata=\|onloadedmetadata=\|onloadstart=\|onpause=\|onplay=\|onplaying=\|onprogress=\|onratechange=\|onreadystatechange=\|onseeked=\|onseeking=\|onstalled=\|onsuspend=\|ontimeupdate=\|onvolumechange=" --include=*.js ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/critical_js.log -grep -rlni "onafterprint=\|onbeforeprint=\|onbeforeunload=\|onerror=\|onhaschange=\|onload=\|onmessage=\|onoffline=\|ononline=\|onpagehide=\|onpageshow=\|onpopstate=\|onredo=\|onresize=\|onstorage=\|onund=o\|onunload=\|onblur=\|onchage=\|oncontextmenu=\|onfocus=\|onformchange=\|onforminput=\|oninput=\|oninvalid=\|onreset=\|onselect=\|onsubmit=\|onkeydown=\|onkeypress=\|onkeyup=\|onclick=\|ondblclic=k\|ondrag=\|ondragend=\|ondragenter=\|ondragleave=\|ondragover=\|ondragstart=\|ondrop=\|onmousedown=\|onmousemove=\|onmouseout=\|onmouseover=\|onmouseup=\|onmousewheel=\|onscroll=\|onabor=t\|oncanplay=\|oncanplaythrough=\|ondurationchange=\|onemptied=\|onended=\|onerror=\|onloadeddata=\|onloadedmetadata=\|onloadstart=\|onpause=\|onplay=\|onplaying=\|onprogress=\|onratechange=\|onreadystatechange=\|onseeked=\|onseeking=\|onstalled=\|onsuspend=\|ontimeupdate=\|onvolumechange=" --include=*.js ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/critical_js.log +grep -rlni "onafterprint=\|onbeforeprint=\|onbeforeunload=\|onerror=\|onhaschange=\|onload=\|onmessage=\|onoffline=\|ononline=\|onpagehide=\|onpageshow=\|onpopstate=\|onredo=\|onresize=\|onstorage=\|onund=o\|onunload=\|onblur=\|onchage=\|oncontextmenu=\|onfocus=\|onformchange=\|onforminput=\|oninput=\|oninvalid=\|onreset=\|onselect=\|onsubmit=\|onkeydown=\|onkeypress=\|onkeyup=\|onclick=\|ondblclic=k\|ondrag=\|ondragend=\|ondragenter=\|ondragleave=\|ondragover=\|ondragstart=\|ondrop=\|onmousedown=\|onmousemove=\|onmouseout=\|onmouseover=\|onmouseup=\|onmousewheel=\|onscroll=\|onabor=t\|oncanplay=\|oncanplaythrough=\|ondurationchange=\|onemptied=\|onended=\|onerror=\|onloadeddata=\|onloadedmetadata=\|onloadstart=\|onpause=\|onplay=\|onplaying=\|onprogress=\|onratechange=\|onreadystatechange=\|onseeked=\|onseeking=\|onstalled=\|onsuspend=\|ontimeupdate=\|onvolumechange=" --include=*.js ${INSPECTION_PATH} >> ${OUTPUT_PATH}/critical_js.log # JS strict type -grep -r -L "\"use strict\";" --include=*.js ${ROOT_PATH}/jsOMS > ${INSPECTION_PATH}/Framework/strict_missing_js.log -grep -r -L "\"use strict\";" --include=*.js ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/strict_missing_js.log -grep -r -L "\"use strict\";" --include=*.js ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/strict_missing_js.log -grep -r -L "\"use strict\";" --include=*.js ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/strict_missing_js.log \ No newline at end of file +grep -r -L "\"use strict\";" --include=*.js ${INSPECTION_PATH} > ${OUTPUT_PATH}/strict_missing_js.log \ No newline at end of file diff --git a/Inspection/Js/style.sh b/Inspection/Js/style.sh index 61fedc7..25848d3 100755 --- a/Inspection/Js/style.sh +++ b/Inspection/Js/style.sh @@ -6,5 +6,4 @@ echo "#################################################" echo "Start js style inspection" echo "#################################################" -npx eslint ${ROOT_PATH}/jsOMS -c ${BUILD_PATH}/Config/.eslintrc.json -o ${INSPECTION_PATH}/Framework/eslint.txt -npx eslint ${ROOT_PATH}/jsOMS -c ${BUILD_PATH}/Config/.eslintrc.json -o ${INSPECTION_PATH}/Test/Js/junit_eslint.xml -f junit +npx eslint ${INSPECTION_PATH} -c ${BUILD_PATH}/Config/.eslintrc.json -o ${OUTPUT_PATH}/eslint.txt diff --git a/Inspection/Php/linting.sh b/Inspection/Php/linting.sh index 5bf90b1..11ea4e1 100755 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -6,16 +6,7 @@ echo "#################################################" echo "Start php linting inspection" echo "#################################################" -find ${ROOT_PATH}/phpOMS -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log -sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Framework/linting_php.log +find ${INSPECTION_PATH} -name "*.php" | xargs -L1 php -l > ${OUTPUT_PATH}/temp.log +sed '/^No syntax.*/ d' < ${OUTPUT_PATH}/temp.log > ${OUTPUT_PATH}/linting_php.log -find ${ROOT_PATH}/Web -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log -sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Framework/linting_php.log - -find ${ROOT_PATH}/Modules -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log -sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Modules/linting_php.log - -find ${ROOT_PATH}/Model -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log -sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Model/linting_php.log - -rm ${INSPECTION_PATH}/logs/temp.log \ No newline at end of file +rm ${OUTPUT_PATH}/temp.log \ No newline at end of file diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index 22aa989..72a816c 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -38,21 +38,12 @@ CODE[27]="action=\"" CODE[28]="ReflectionClass" CODE[29]="TestUtils" -touch ${INSPECTION_PATH}/Framework/critical_php.log -touch ${INSPECTION_PATH}/Modules/critical_php.log -touch ${INSPECTION_PATH}/Model/critical_php.log -touch ${INSPECTION_PATH}/Web/critical_php.log +touch ${OUTPUT_PATH}/critical_php.log for i in "${CODE[@]}" do - grep -rlni "$i" --include \*.php ${ROOT_PATH}/phpOMS >> ${INSPECTION_PATH}/Framework/critical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/critical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Model >> ${INSPECTION_PATH}/Model/critical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/critical_php.log + grep -rlni "$i" --include \*.php ${INSPECTION_PATH} >> ${OUTPUT_PATH}/critical_php.log done # PHP strict type -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/strict_missing_php.log -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/strict_missing_php.log -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/strict_missing_php.log -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/strict_missing_php.log +grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${INSPECTION_PATH} > ${OUTPUT_PATH}/strict_missing_php.log diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index d6c2335..3b77b06 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -7,11 +7,5 @@ echo "Start php stats inspection" echo "#################################################" # -php ${ROOT_PATH}/vendor/bin/phploc ${ROOT_PATH}/phpOMS/ > ${INSPECTION_PATH}/Framework/phploc.log -php ${ROOT_PATH}/vendor/bin/phploc ${ROOT_PATH}/Web/ > ${INSPECTION_PATH}/Web/phploc.log -php ${ROOT_PATH}/vendor/bin/phploc ${ROOT_PATH}/Modules/ > ${INSPECTION_PATH}/Modules/phploc.log -php ${ROOT_PATH}/vendor/bin/phploc ${ROOT_PATH}/Model/ > ${INSPECTION_PATH}/Model/phploc.log - -# -php ${ROOT_PATH}/vendor/bin/phpmetrics --report-html=${INSPECTION_PATH}/Framework/metrics/metrics.html ${ROOT_PATH}/phpOMS/ >> ${INSPECTION_PATH}/Framework/build.log -php ${ROOT_PATH}/vendor/bin/phpmetrics --report-html=${INSPECTION_PATH}/Modules/metrics/metrics.html ${ROOT_PATH}/Modules/ >> ${INSPECTION_PATH}/Modules/build.log +php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log +php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} \ No newline at end of file diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 53417c5..a9d50a8 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -6,12 +6,6 @@ echo "#################################################" echo "Start php style inspection" echo "#################################################" -php ${ROOT_PATH}/vendor/bin/phpcs ${ROOT_PATH}/phpOMS --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${INSPECTION_PATH}/Framework/phpcs.log --report-junit=${INSPECTION_PATH}/Framework/phpcs.xml -php ${ROOT_PATH}/vendor/bin/phpcs ${ROOT_PATH}/Web --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${INSPECTION_PATH}/Web/phpcs.log --report-junit=${INSPECTION_PATH}/Web/phpcs.xml -php ${ROOT_PATH}/vendor/bin/phpcs ${ROOT_PATH}/Modules --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${INSPECTION_PATH}/Modules/phpcs.log --report-junit=${INSPECTION_PATH}/Modules/phpcs.xml -php ${ROOT_PATH}/vendor/bin/phpcs ${ROOT_PATH}/Model --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${INSPECTION_PATH}/Model/phpcs.log --report-junit=${INSPECTION_PATH}/Model/phpcs.xml +php ${TOOLS_PATH}/vendor/bin/phpcs ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml -php ${ROOT_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/rector.log -php ${ROOT_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Modules/rector.log -php ${ROOT_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/rector.log -php ${ROOT_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/rector.log \ No newline at end of file +php ${TOOLS_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index f9a7acc..00a0547 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -6,16 +6,13 @@ echo "#################################################" echo "Start php unit tests inspection" echo "#################################################" -php -d pcov.enabled=1 ${ROOT_PATH}/vendor/bin/phpunit -v --configuration ${ROOT_PATH}/tests/phpunit_default.xml --log-junit ${INSPECTION_PATH}/Test/Php/junit_php.xml --testdox-html ${INSPECTION_PATH}/Test/Php/index.html --coverage-html ${INSPECTION_PATH}/Test/Php/coverage --coverage-clover ${INSPECTION_PATH}/Test/Php/coverage.xml > ${INSPECTION_PATH}/Test/Php/phpunit.log +php -d pcov.enabled=1 ${TOOLS_PATH}/vendor/bin/phpunit -v --configuration ${INSPECTION_PATH}/tests/phpunit_default.xml --log-junit ${OUTPUT_PATH}/junit_php.xml --testdox-html ${OUTPUT_PATH}/phpunit/index.html --coverage-html ${OUTPUT_PATH}/coverage --coverage-clover ${OUTPUT_PATH}/coverage.xml > ${OUTPUT_PATH}/phpunit.log echo "#################################################" echo "Start php static inspection" echo "#################################################" -php -d memory_limit=4G ${ROOT_PATH}/vendor/bin/phpstan analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/phpstan.log -php -d memory_limit=4G ${ROOT_PATH}/vendor/bin/phpstan analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/phpstan.log -php -d memory_limit=4G ${ROOT_PATH}/vendor/bin/phpstan analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/phpstan.log -php -d memory_limit=4G ${ROOT_PATH}/vendor/bin/phpstan analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/phpstan.log +php -d memory_limit=4G ${TOOLS_PATH}/vendor/bin/phpstan analyse --no-progress -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${INSPECTION_PATH} # Cli debugging # php -dzend_extension=xdebug.so -dxdebug.mode=debug -dxdebug.profiler_enable=1 \ No newline at end of file diff --git a/Inspection/Sql/performance.sh b/Inspection/Sql/performance.sh index b14daa0..723c3db 100755 --- a/Inspection/Sql/performance.sh +++ b/Inspection/Sql/performance.sh @@ -4,6 +4,6 @@ # Mysql required with query logging # sudo apt-get install percona-toolkit -mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/slow_queries.log -mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/locked_queries.log -pt-query-digest /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/query_details.log \ No newline at end of file +mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log > ${OUTPUT_PATH}/slow_queries.log +mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log > ${OUTPUT_PATH}/locked_queries.log +pt-query-digest /var/log/mysql/mysql-slow.log > ${OUTPUT_PATH}/query_details.log \ No newline at end of file diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 28da244..5fdf59d 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -7,8 +7,8 @@ echo "#################################################" echo "Setup database" echo "#################################################" -mysql -e 'drop database if exists oms;' -u ${DB_USER} --password="${DB_PASSWORD}" -mysql -e 'create database oms;' -u ${DB_USER} --password="${DB_PASSWORD}" +mysql -e 'drop database if exists omb;' -u ${DB_USER} --password="${DB_PASSWORD}" +mysql -e 'create database omb;' -u ${DB_USER} --password="${DB_PASSWORD}" # Build js #. Js/build.sh @@ -66,121 +66,17 @@ echo "Custom js inspection" echo "#################################################" . ${BUILD_PATH}/Inspection/Js/security.sh -# Build internal test report -echo "#################################################" -echo "Internal test report" -echo "#################################################" - -echo -e "Internal test report" > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Unit test" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Test/Php/phpunit.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Static test" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/phpstan.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/phpstan.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/phpstan.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/phpstan.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "PHP style test" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/phpcs.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/phpcs.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/phpcs.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/phpcs.log > ${INSPECTION_PATH}/internal_test_report.txt - -cat ${INSPECTION_PATH}/Framework/rector.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/rector.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/rector.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/rector.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "JS style test" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/eslint.txt > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Stats" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/phploc.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/phploc.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/phploc.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/phploc.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "PHP security tests" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/critical_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/critical_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/critical_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/critical_php.log > ${INSPECTION_PATH}/internal_test_report.txt - -cat ${INSPECTION_PATH}/Framework/strict_missing_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/strict_missing_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/strict_missing_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/strict_missing_php.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "JS security tests" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/critical_js.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/critical_js.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/critical_js.log > ${INSPECTION_PATH}/internal_test_report.txt - -cat ${INSPECTION_PATH}/Framework/strict_missing_js.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/strict_missing_js.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/strict_missing_js.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/strict_missing_js.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Linting tests" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/linting_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/linting_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Model/linting_php.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/linting_php.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "DB queries" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Sql/slow_queries.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Sql/locked_queries.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Sql/query_details.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Html tags" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Framework/html_tags.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/html_tags.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Html syntax" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/html_syntax.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/html_syntax.log > ${INSPECTION_PATH}/internal_test_report.txt - -echo -e "\n\n#################################################" > ${INSPECTION_PATH}/internal_test_report.txt -echo "Static text" > ${INSPECTION_PATH}/internal_test_report.txt -echo -e "#################################################\n\n" > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Modules/static_text.log > ${INSPECTION_PATH}/internal_test_report.txt -cat ${INSPECTION_PATH}/Web/static_text.log > ${INSPECTION_PATH}/internal_test_report.txt - # Build external test report echo "#################################################" echo "Test report" echo "#################################################" -php {TOOLS_PATH}/TestReportGenerator/src/index.php \ +php ${TOOLS_PATH}/TestReportGenerator/src/index.php \ -b ${ROOT_PATH} \ -l ${BUILD_PATH}/Config/reportLang.php \ --s ${INSPECTION_PATH}/Test/Php/junit_phpcs.xml \ --sj ${INSPECTION_PATH}/Test/Js/junit_eslint.xml \ --a ${INSPECTION_PATH}/Test/Php/phpstan.json \ --c ${INSPECTION_PATH}/Test/Php/coverage.xml \ --u ${INSPECTION_PATH}/Test/Php/junit_php.xml \ --d ${INSPECTION_PATH}/Test/ReportExternal \ +-s ${OUTPUT_PATH}/junit_phpcs.xml \ +-sj ${OUTPUT_PATH}/junit_eslint.xml \ +-a ${OUTPUT_PATH}/phpstan.json \ +-c ${OUTPUT_PATH}/coverage.xml \ +-u ${OUTPUT_PATH}/junit_php.xml \ +-d ${OUTPUT_PATH}/ReportExternal \ --version 1.0.0 diff --git a/config.sh b/config.sh index 2720c29..482cbb4 100755 --- a/config.sh +++ b/config.sh @@ -7,7 +7,6 @@ BUILD_PATH="/var/www/html/Build" TOOLS_PATH="/var/www/html/Tools" RELEASE_PATH="/var/www/html/Release" -INSPECTION_PATH="/var/www/html/Inspection" # Web WEB_URL="http://jingga.app" diff --git a/php.sh b/php.sh new file mode 100644 index 0000000..03e2777 --- /dev/null +++ b/php.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Include config +. config.sh + +if [ $# -eq 0 ]; then + echo "No parameters provided." + exit 1 +fi + +INSPECTION_PATH=$1 +OUTPUT_PATH=$2 + +# Run inspection +. ${BUILD_PATH}/Inspection/inspect.sh From 865292fae5c4eb1bc7d3f77f64d8205ed6edd650 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 01:38:02 +0000 Subject: [PATCH 02/26] fix inspection --- php.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php.sh b/php.sh index 03e2777..1a0bd66 100644 --- a/php.sh +++ b/php.sh @@ -8,8 +8,8 @@ if [ $# -eq 0 ]; then exit 1 fi -INSPECTION_PATH=$1 -OUTPUT_PATH=$2 +INSPECTION_PATH="$1" +OUTPUT_PATH="$2" # Run inspection . ${BUILD_PATH}/Inspection/inspect.sh From 330b9380838de35c56669529096b941940f3ddbf Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 01:42:24 +0000 Subject: [PATCH 03/26] fix inspection --- php.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/php.sh b/php.sh index 1a0bd66..0a99c46 100644 --- a/php.sh +++ b/php.sh @@ -1,7 +1,10 @@ #!/bin/bash +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" +source "$SCRIPT_DIR/script2.sh" + # Include config -. config.sh +. "$SCRIPT_DIR/config.sh" if [ $# -eq 0 ]; then echo "No parameters provided." From a8cfa90b4d77b78ecbad9e8dd4585d829666f0ab Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 01:53:34 +0000 Subject: [PATCH 04/26] fix inspection --- Inspection/inspect.sh | 2 +- config.sh | 7 +++---- php.sh | 6 ++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 5fdf59d..109d29e 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -71,7 +71,7 @@ echo "#################################################" echo "Test report" echo "#################################################" php ${TOOLS_PATH}/TestReportGenerator/src/index.php \ --b ${ROOT_PATH} \ +-b ${INSPECTION_PATH} \ -l ${BUILD_PATH}/Config/reportLang.php \ -s ${OUTPUT_PATH}/junit_phpcs.xml \ -sj ${OUTPUT_PATH}/junit_eslint.xml \ diff --git a/config.sh b/config.sh index 482cbb4..74b8b34 100755 --- a/config.sh +++ b/config.sh @@ -1,11 +1,10 @@ #!/bin/bash # Paths -BASE_PATH="/var/www/html" -ROOT_PATH="/var/www/html/Karaka" -BUILD_PATH="/var/www/html/Build" +BASE_PATH="${BUILD_PATH}/.." +ROOT_PATH="${BUILD_PATH}/.." -TOOLS_PATH="/var/www/html/Tools" +TOOLS_PATH="${BUILD_PATH}/.." RELEASE_PATH="/var/www/html/Release" # Web diff --git a/php.sh b/php.sh index 0a99c46..3128804 100644 --- a/php.sh +++ b/php.sh @@ -1,10 +1,8 @@ #!/bin/bash -SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -source "$SCRIPT_DIR/script2.sh" - # Include config -. "$SCRIPT_DIR/config.sh" +BUILD_PATH="$(dirname "$(readlink -f "$0")")" +. "$BUILD_PATH/config.sh" if [ $# -eq 0 ]; then echo "No parameters provided." From 530c61f2cb7f41a140c01a7d860838f80492c0b6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 02:02:09 +0000 Subject: [PATCH 05/26] fix inspection --- Inspection/Html/static_text.sh | 2 +- Inspection/Html/syntax.sh | 2 +- Inspection/Html/tags.sh | 2 +- Inspection/Js/security.sh | 2 +- Inspection/Js/style.sh | 2 +- Inspection/Json/linting.sh | 2 +- Inspection/Php/linting.sh | 2 +- Inspection/Php/security.sh | 2 +- Inspection/Php/stats.sh | 2 +- Inspection/Php/style.sh | 2 +- Inspection/Php/tests.sh | 2 +- Inspection/Sql/performance.sh | 2 +- Inspection/inspect.sh | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Inspection/Html/static_text.sh b/Inspection/Html/static_text.sh index 1bf9c78..bef942f 100644 --- a/Inspection/Html/static_text.sh +++ b/Inspection/Html/static_text.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start static text inspection" diff --git a/Inspection/Html/syntax.sh b/Inspection/Html/syntax.sh index db86277..7e67909 100644 --- a/Inspection/Html/syntax.sh +++ b/Inspection/Html/syntax.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start html syntax inspection" diff --git a/Inspection/Html/tags.sh b/Inspection/Html/tags.sh index 4c1a7b8..f7e42c1 100755 --- a/Inspection/Html/tags.sh +++ b/Inspection/Html/tags.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start html tags inspection" diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index 9a56fe2..8cd3810 100755 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start js security inspection" diff --git a/Inspection/Js/style.sh b/Inspection/Js/style.sh index 25848d3..ab5f5ad 100755 --- a/Inspection/Js/style.sh +++ b/Inspection/Js/style.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start js style inspection" diff --git a/Inspection/Json/linting.sh b/Inspection/Json/linting.sh index ddf6cba..177ae40 100755 --- a/Inspection/Json/linting.sh +++ b/Inspection/Json/linting.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start json linting inspection" diff --git a/Inspection/Php/linting.sh b/Inspection/Php/linting.sh index 11ea4e1..52bcdba 100755 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start php linting inspection" diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index 72a816c..b58a1ad 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start php security inspection" diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index 3b77b06..dae0ab0 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start php stats inspection" diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index a9d50a8..18d2041 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start php style inspection" diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index 00a0547..c02aeed 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" echo "#################################################" echo "Start php unit tests inspection" diff --git a/Inspection/Sql/performance.sh b/Inspection/Sql/performance.sh index 723c3db..2d4bcc7 100755 --- a/Inspection/Sql/performance.sh +++ b/Inspection/Sql/performance.sh @@ -1,6 +1,6 @@ #!/bin/bash -. config.sh +. "$BUILD_PATH/config.sh" # Mysql required with query logging # sudo apt-get install percona-toolkit diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 109d29e..65c4832 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -1,7 +1,7 @@ #!/bin/bash # Include config -. config.sh +. "$BUILD_PATH/config.sh" # Setup database echo "#################################################" From 72f2912f130ec0ce650105f6dcd2b72d8fe1052b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 02:15:59 +0000 Subject: [PATCH 06/26] fix inspection --- Inspection/Html/static_text.sh | 2 +- Inspection/Html/syntax.sh | 2 +- Inspection/Html/tags.sh | 2 +- Inspection/Js/security.sh | 2 +- Inspection/Js/style.sh | 2 +- Inspection/Json/linting.sh | 2 +- Inspection/Php/linting.sh | 2 +- Inspection/Php/security.sh | 2 +- Inspection/Php/stats.sh | 2 +- Inspection/Php/style.sh | 2 +- Inspection/Php/tests.sh | 2 +- Inspection/Sql/performance.sh | 2 +- Inspection/inspect.sh | 2 +- php.sh | 7 ++++++- 14 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Inspection/Html/static_text.sh b/Inspection/Html/static_text.sh index bef942f..670014c 100644 --- a/Inspection/Html/static_text.sh +++ b/Inspection/Html/static_text.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start static text inspection" diff --git a/Inspection/Html/syntax.sh b/Inspection/Html/syntax.sh index 7e67909..e61eda6 100644 --- a/Inspection/Html/syntax.sh +++ b/Inspection/Html/syntax.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start html syntax inspection" diff --git a/Inspection/Html/tags.sh b/Inspection/Html/tags.sh index f7e42c1..2271199 100755 --- a/Inspection/Html/tags.sh +++ b/Inspection/Html/tags.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start html tags inspection" diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index 8cd3810..2522fab 100755 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start js security inspection" diff --git a/Inspection/Js/style.sh b/Inspection/Js/style.sh index ab5f5ad..3d08af2 100755 --- a/Inspection/Js/style.sh +++ b/Inspection/Js/style.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start js style inspection" diff --git a/Inspection/Json/linting.sh b/Inspection/Json/linting.sh index 177ae40..1cfba8b 100755 --- a/Inspection/Json/linting.sh +++ b/Inspection/Json/linting.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start json linting inspection" diff --git a/Inspection/Php/linting.sh b/Inspection/Php/linting.sh index 52bcdba..e601ea9 100755 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start php linting inspection" diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index b58a1ad..381821e 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start php security inspection" diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index dae0ab0..8e07be8 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start php stats inspection" diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 18d2041..1823df9 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start php style inspection" diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index c02aeed..adc15cd 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" echo "#################################################" echo "Start php unit tests inspection" diff --git a/Inspection/Sql/performance.sh b/Inspection/Sql/performance.sh index 2d4bcc7..90817e6 100755 --- a/Inspection/Sql/performance.sh +++ b/Inspection/Sql/performance.sh @@ -1,6 +1,6 @@ #!/bin/bash -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" # Mysql required with query logging # sudo apt-get install percona-toolkit diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 65c4832..be03f5e 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -1,7 +1,7 @@ #!/bin/bash # Include config -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" # Setup database echo "#################################################" diff --git a/php.sh b/php.sh index 3128804..1264785 100644 --- a/php.sh +++ b/php.sh @@ -2,7 +2,7 @@ # Include config BUILD_PATH="$(dirname "$(readlink -f "$0")")" -. "$BUILD_PATH/config.sh" +. "${BUILD_PATH}/config.sh" if [ $# -eq 0 ]; then echo "No parameters provided." @@ -12,5 +12,10 @@ fi INSPECTION_PATH="$1" OUTPUT_PATH="$2" +mkdir -p ${OUTPUT_PATH} +mkdir -p ${OUTPUT_PATH}/coverage +mkdir -p ${OUTPUT_PATH}/phpunit +mkdir -p ${OUTPUT_PATH}/metrics + # Run inspection . ${BUILD_PATH}/Inspection/inspect.sh From cfd5fdf84f12d309cc892f1a3648868f417b8e2e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 02:59:02 +0000 Subject: [PATCH 07/26] fix server install and inspections --- Helper/Scripts/serverInstall.sh | 3 +++ Inspection/inspect.sh | 4 ++-- php.sh | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Helper/Scripts/serverInstall.sh b/Helper/Scripts/serverInstall.sh index 4385afd..5ddaa29 100644 --- a/Helper/Scripts/serverInstall.sh +++ b/Helper/Scripts/serverInstall.sh @@ -63,12 +63,15 @@ mysql -u root -p CREATE USER 'jingga'@'%' IDENTIFIED BY 'dYg8#@wLiWJ3vE'; CREATE USER 'demo'@'%' IDENTIFIED BY 'orange'; +CREATE USER 'test'@'%' IDENTIFIED BY 'orange'; CREATE DATABASE jingga COMMENT 'Main application database'; CREATE DATABASE demo COMMENT 'Demo application database'; +CREATE DATABASE omt COMMENT 'Tests'; GRANT ALL PRIVILEGES ON jingga.* TO 'jingga'@'%'; GRANT ALL PRIVILEGES ON demo.* TO 'demo'@'%'; +GRANT ALL PRIVILEGES ON omt.* TO 'test'@'%'; FLUSH PRIVILEGES; diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index be03f5e..6545bc4 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -7,8 +7,8 @@ echo "#################################################" echo "Setup database" echo "#################################################" -mysql -e 'drop database if exists omb;' -u ${DB_USER} --password="${DB_PASSWORD}" -mysql -e 'create database omb;' -u ${DB_USER} --password="${DB_PASSWORD}" +mysql -e 'drop database if exists omt;' -u ${DB_USER} --password="${DB_PASSWORD}" +mysql -e 'create database omt;' -u ${DB_USER} --password="${DB_PASSWORD}" # Build js #. Js/build.sh diff --git a/php.sh b/php.sh index 1264785..bb40b17 100644 --- a/php.sh +++ b/php.sh @@ -12,6 +12,12 @@ fi INSPECTION_PATH="$1" OUTPUT_PATH="$2" +if [ "$OUTPUT_PATH" == "/" ] || [ "$OUTPUT_PATH" == "/etc" ]; then + echo "Bad path" + exit 1 +fi + +rm -rf ${OUTPUT_PATH} mkdir -p ${OUTPUT_PATH} mkdir -p ${OUTPUT_PATH}/coverage mkdir -p ${OUTPUT_PATH}/phpunit From 8a6654a91ee401b7116f7b8a73870d2d7d8e284b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 03:11:36 +0000 Subject: [PATCH 08/26] fix db credentials --- config.sh | 4 ++-- php.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.sh b/config.sh index 74b8b34..8557ef4 100755 --- a/config.sh +++ b/config.sh @@ -12,8 +12,8 @@ WEB_URL="http://jingga.app" MAIL_ADDR="" # Authentications -DB_USER="root" -DB_PASSWORD="root" +DB_USER="test" +DB_PASSWORD="orange" # Git variables GITHUB_URL[0]="https://github.com/Karaka-Management/Karaka.git" diff --git a/php.sh b/php.sh index bb40b17..4214004 100644 --- a/php.sh +++ b/php.sh @@ -19,6 +19,7 @@ fi rm -rf ${OUTPUT_PATH} mkdir -p ${OUTPUT_PATH} +mkdir -p ${OUTPUT_PATH}/ReportExternal mkdir -p ${OUTPUT_PATH}/coverage mkdir -p ${OUTPUT_PATH}/phpunit mkdir -p ${OUTPUT_PATH}/metrics From 0517460081fcb1275882bd58a758cbf6cfde04c8 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 03:20:43 +0000 Subject: [PATCH 09/26] Add more exclusions --- Config/phpmetrics.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Config/phpmetrics.json b/Config/phpmetrics.json index 4ccd726..e42a8b2 100644 --- a/Config/phpmetrics.json +++ b/Config/phpmetrics.json @@ -4,6 +4,8 @@ ".git", "tests", "vendor", + "Admin/Install/Application", + "Install/Application", "Resources" ] } \ No newline at end of file From b908e88f906454fe9ab73184d70025929d87e908 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 03:34:29 +0000 Subject: [PATCH 10/26] add additional directory --- Config/phpstan_autoloader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Config/phpstan_autoloader.php b/Config/phpstan_autoloader.php index 241a45d..11ccea7 100755 --- a/Config/phpstan_autoloader.php +++ b/Config/phpstan_autoloader.php @@ -12,6 +12,7 @@ function module_autoloader($class) { __DIR__ . '/../../MainRepository/Resources/', __DIR__ . '/../../MainRepository/Resources/tcpdf/', __DIR__ . '/../../MainRepository/Resources/Stripe/', + __DIR__ . '/../../../', ]; $class = \ltrim($class, '\\'); From 6258b9259e7af5f062345eac3377cb1b3d7695a0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 03:35:50 +0000 Subject: [PATCH 11/26] add same directory level search --- Config/phpstan_autoloader.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Config/phpstan_autoloader.php b/Config/phpstan_autoloader.php index 11ccea7..a05453a 100755 --- a/Config/phpstan_autoloader.php +++ b/Config/phpstan_autoloader.php @@ -53,6 +53,15 @@ function module_autoloader($class) { return; } } + + $class = \str_replace('Modules/', '/', $class); + foreach ($paths as $path) { + if (\is_file($file = $path . $class . '.php')) { + include_once $file; + + return; + } + } } spl_autoload_register('module_autoloader'); From ee64336497ea17287c3890d1019c5f0b4cce7e76 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 05:24:15 +0000 Subject: [PATCH 12/26] ensure script continuation --- Helper/Scripts/cloneall.sh | 1 + Inspection/Php/security.sh | 2 +- Inspection/Php/stats.sh | 4 ++-- Inspection/Php/style.sh | 4 ++-- Inspection/Php/tests.sh | 4 ++-- Inspection/inspect.sh | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Helper/Scripts/cloneall.sh b/Helper/Scripts/cloneall.sh index c2a3cb7..15ae18b 100644 --- a/Helper/Scripts/cloneall.sh +++ b/Helper/Scripts/cloneall.sh @@ -8,4 +8,5 @@ curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git checkout develop" \; find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git submodule foreach 'git checkout develop || true'" \; +find ./src -maxdepth 1 -type d \( ! -name . \) -exec bash -c "git -C '{}' pull" \; find ./src -maxdepth 1 -type d \( ! -name . \) -exec bash -c "Build/php.sh '{}' '{}/build'" \; \ No newline at end of file diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index 381821e..6e06cc1 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -46,4 +46,4 @@ do done # PHP strict type -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${INSPECTION_PATH} > ${OUTPUT_PATH}/strict_missing_php.log +grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${INSPECTION_PATH} > ${OUTPUT_PATH}/strict_missing_php.log || true diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index 8e07be8..169b898 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -7,5 +7,5 @@ echo "Start php stats inspection" echo "#################################################" # -php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log -php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} \ No newline at end of file +php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log || true +php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} || true \ No newline at end of file diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 1823df9..4fe8821 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -6,6 +6,6 @@ echo "#################################################" echo "Start php style inspection" echo "#################################################" -php ${TOOLS_PATH}/vendor/bin/phpcs ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml +php ${TOOLS_PATH}/vendor/bin/phpcs ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml || true -php ${TOOLS_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log +php ${TOOLS_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log || true diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index adc15cd..9e27e42 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -6,13 +6,13 @@ echo "#################################################" echo "Start php unit tests inspection" echo "#################################################" -php -d pcov.enabled=1 ${TOOLS_PATH}/vendor/bin/phpunit -v --configuration ${INSPECTION_PATH}/tests/phpunit_default.xml --log-junit ${OUTPUT_PATH}/junit_php.xml --testdox-html ${OUTPUT_PATH}/phpunit/index.html --coverage-html ${OUTPUT_PATH}/coverage --coverage-clover ${OUTPUT_PATH}/coverage.xml > ${OUTPUT_PATH}/phpunit.log +php -dpcov.enabled=1 -dxdebug.mode=coverage ${TOOLS_PATH}/vendor/bin/phpunit -v --configuration ${INSPECTION_PATH}/tests/phpunit_default.xml --log-junit ${OUTPUT_PATH}/junit_php.xml --testdox-html ${OUTPUT_PATH}/phpunit/index.html --coverage-html ${OUTPUT_PATH}/coverage --coverage-clover ${OUTPUT_PATH}/coverage.xml > ${OUTPUT_PATH}/phpunit.log || true echo "#################################################" echo "Start php static inspection" echo "#################################################" -php -d memory_limit=4G ${TOOLS_PATH}/vendor/bin/phpstan analyse --no-progress -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${INSPECTION_PATH} +php -d memory_limit=4G ${TOOLS_PATH}/vendor/bin/phpstan analyse --no-progress -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${INSPECTION_PATH} || true # Cli debugging # php -dzend_extension=xdebug.so -dxdebug.mode=debug -dxdebug.profiler_enable=1 \ No newline at end of file diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 6545bc4..acc623b 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -73,7 +73,7 @@ echo "#################################################" php ${TOOLS_PATH}/TestReportGenerator/src/index.php \ -b ${INSPECTION_PATH} \ -l ${BUILD_PATH}/Config/reportLang.php \ --s ${OUTPUT_PATH}/junit_phpcs.xml \ +-s ${OUTPUT_PATH}/phpcs.xml \ -sj ${OUTPUT_PATH}/junit_eslint.xml \ -a ${OUTPUT_PATH}/phpstan.json \ -c ${OUTPUT_PATH}/coverage.xml \ From 9fb157e3cab475c9033a3f5b53d0a3466f6dabd5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 15:52:14 +0000 Subject: [PATCH 13/26] fix autoload --- Config/phpstan_autoloader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Config/phpstan_autoloader.php b/Config/phpstan_autoloader.php index a05453a..72ec45a 100755 --- a/Config/phpstan_autoloader.php +++ b/Config/phpstan_autoloader.php @@ -12,6 +12,7 @@ function module_autoloader($class) { __DIR__ . '/../../MainRepository/Resources/', __DIR__ . '/../../MainRepository/Resources/tcpdf/', __DIR__ . '/../../MainRepository/Resources/Stripe/', + __DIR__ . '/../../src', __DIR__ . '/../../../', ]; From f17998b71c8e24598433b1f535a53f344d5a1d45 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 16:07:56 +0000 Subject: [PATCH 14/26] fix autoloading --- Config/phpstan_autoloader.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Config/phpstan_autoloader.php b/Config/phpstan_autoloader.php index 72ec45a..1591239 100755 --- a/Config/phpstan_autoloader.php +++ b/Config/phpstan_autoloader.php @@ -12,7 +12,7 @@ function module_autoloader($class) { __DIR__ . '/../../MainRepository/Resources/', __DIR__ . '/../../MainRepository/Resources/tcpdf/', __DIR__ . '/../../MainRepository/Resources/Stripe/', - __DIR__ . '/../../src', + __DIR__ . '/../../src/', __DIR__ . '/../../../', ]; @@ -55,11 +55,32 @@ function module_autoloader($class) { } } + + foreach ($paths as $path) { + if (($file = \realpath($path . 'oms-' . $class2 . '.php'))) { + include_once $file; + + return; + } elseif (($file = \realpath($file = $path . 'oms-' . $class3 . '.php')) && \stripos($file, $class2) !== false) { + include_once $file; + + return; + } elseif (\is_file($file = $path . 'oms-' . $class . '.php')) { + include_once $file; + + return; + } + } + $class = \str_replace('Modules/', '/', $class); foreach ($paths as $path) { if (\is_file($file = $path . $class . '.php')) { include_once $file; + return; + } elseif (\is_file($file = $path . 'oms-' . $class . '.php')) { + include_once $file; + return; } } From 3335fb129e8b6ec3e3cea0912824b4fdfec3d43d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 20:41:26 +0000 Subject: [PATCH 15/26] fix setup and phpstan autoloader --- Config/phpstan_autoloader.php | 7 +++++-- Helper/Scripts/serverInstall.sh | 2 +- Inspection/Php/tests.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Config/phpstan_autoloader.php b/Config/phpstan_autoloader.php index 1591239..8f3a133 100755 --- a/Config/phpstan_autoloader.php +++ b/Config/phpstan_autoloader.php @@ -39,6 +39,7 @@ function module_autoloader($class) { } } + // github and normal foreach ($paths as $path) { if (($file = \realpath($path . $class2 . '.php'))) { include_once $file; @@ -55,7 +56,7 @@ function module_autoloader($class) { } } - + // own server foreach ($paths as $path) { if (($file = \realpath($path . 'oms-' . $class2 . '.php'))) { include_once $file; @@ -72,7 +73,9 @@ function module_autoloader($class) { } } - $class = \str_replace('Modules/', '/', $class); + $paths[] = __DIR__ . '/../../src/Karaka/'; + + $class = \ltrim(\str_replace('Modules/', '/', $class), '/'); foreach ($paths as $path) { if (\is_file($file = $path . $class . '.php')) { include_once $file; diff --git a/Helper/Scripts/serverInstall.sh b/Helper/Scripts/serverInstall.sh index 5ddaa29..ddfb41f 100644 --- a/Helper/Scripts/serverInstall.sh +++ b/Helper/Scripts/serverInstall.sh @@ -10,7 +10,7 @@ export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" > apt-get update apt-get upgrade -apt-get install git git-lfs snapd ufw software-properties-common composer +apt-get install git git-lfs snapd ufw software-properties-common composer nodejs npm # Security diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index 9e27e42..ef8a996 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -12,7 +12,7 @@ echo "#################################################" echo "Start php static inspection" echo "#################################################" -php -d memory_limit=4G ${TOOLS_PATH}/vendor/bin/phpstan analyse --no-progress -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${INSPECTION_PATH} || true +php -dmemory_limit=4G ${TOOLS_PATH}/vendor/bin/phpstan analyse --error-format=prettyJson --no-progress -l 9 -c ${BUILD_PATH}/Config/phpstan.neon ${INSPECTION_PATH} > ${OUTPUT_PATH}/phpstan.json || true # Cli debugging # php -dzend_extension=xdebug.so -dxdebug.mode=debug -dxdebug.profiler_enable=1 \ No newline at end of file From c448c3d59ebfd061d3d0cadcb716b75ef9ba081e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 1 Oct 2023 22:48:35 +0000 Subject: [PATCH 16/26] use default redme text --- Helper/Scripts/copycontent.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Helper/Scripts/copycontent.sh diff --git a/Helper/Scripts/copycontent.sh b/Helper/Scripts/copycontent.sh new file mode 100644 index 0000000..01408d7 --- /dev/null +++ b/Helper/Scripts/copycontent.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +find ./Modules -type f -name README.md -exec sh -c 'cat README.md > "{}"' \; \ No newline at end of file From c3464c2a3b08147ee9afe0707642d87b4a451489 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 01:08:00 +0000 Subject: [PATCH 17/26] build/test optimization --- php.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/php.sh b/php.sh index 4214004..67f9fc1 100644 --- a/php.sh +++ b/php.sh @@ -5,12 +5,16 @@ BUILD_PATH="$(dirname "$(readlink -f "$0")")" . "${BUILD_PATH}/config.sh" if [ $# -eq 0 ]; then - echo "No parameters provided." - exit 1 + echo "No parameters provided." + exit 1 fi -INSPECTION_PATH="$1" -OUTPUT_PATH="$2" +REPO_PATH="$1" +BASE_NAME=$(basename "$REPO_PATH" .git) +INSPECTION_PATH="$2/$BASE_NAME" +OUTPUT_PATH="$2/$BASE_NAME/build" + +rm -rf ${INSPECTION_PATH} if [ "$OUTPUT_PATH" == "/" ] || [ "$OUTPUT_PATH" == "/etc" ]; then echo "Bad path" @@ -24,5 +28,17 @@ mkdir -p ${OUTPUT_PATH}/coverage mkdir -p ${OUTPUT_PATH}/phpunit mkdir -p ${OUTPUT_PATH}/metrics +git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH} +git -C ${INSPECTION_PATH} checkout develop +git -C ${INSPECTION_PATH} submodule foreach 'git checkout develop || true' +git -C ${INSPECTION_PATH} pull + +if [[ ${BASE_NAME} == *"oms-"* ]]; then + git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH}/Karaka + git -C ${INSPECTION_PATH}/Karaka checkout develop + git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git checkout develop || true' + git -C ${INSPECTION_PATH}/Karaka pull +fi + # Run inspection . ${BUILD_PATH}/Inspection/inspect.sh From 0cf0e357f5784af0612c4aedd2497a3a6e598013 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 01:19:26 +0000 Subject: [PATCH 18/26] fix paths --- php.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/php.sh b/php.sh index 67f9fc1..5dba5f8 100644 --- a/php.sh +++ b/php.sh @@ -11,8 +11,8 @@ fi REPO_PATH="$1" BASE_NAME=$(basename "$REPO_PATH" .git) -INSPECTION_PATH="$2/$BASE_NAME" -OUTPUT_PATH="$2/$BASE_NAME/build" +INSPECTION_PATH="$(realpath "$2")/${BASE_NAME}" +OUTPUT_PATH="$(realpath "$2")/${BASE_NAME}/build" rm -rf ${INSPECTION_PATH} @@ -30,14 +30,16 @@ mkdir -p ${OUTPUT_PATH}/metrics git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH} git -C ${INSPECTION_PATH} checkout develop -git -C ${INSPECTION_PATH} submodule foreach 'git checkout develop || true' git -C ${INSPECTION_PATH} pull +git -C ${INSPECTION_PATH} submodule foreach 'git checkout develop || true' +git -C ${INSPECTION_PATH} submodule foreach 'git pull || true' if [[ ${BASE_NAME} == *"oms-"* ]]; then git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH}/Karaka git -C ${INSPECTION_PATH}/Karaka checkout develop - git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git checkout develop || true' git -C ${INSPECTION_PATH}/Karaka pull + git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git checkout develop || true' + git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git pull || true' fi # Run inspection From fd29806ea2cc6351f01b50117122afece3450b18 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 01:23:17 +0000 Subject: [PATCH 19/26] fix paths --- php.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/php.sh b/php.sh index 5dba5f8..7c63a13 100644 --- a/php.sh +++ b/php.sh @@ -14,19 +14,18 @@ BASE_NAME=$(basename "$REPO_PATH" .git) INSPECTION_PATH="$(realpath "$2")/${BASE_NAME}" OUTPUT_PATH="$(realpath "$2")/${BASE_NAME}/build" -rm -rf ${INSPECTION_PATH} - -if [ "$OUTPUT_PATH" == "/" ] || [ "$OUTPUT_PATH" == "/etc" ]; then +if [ "$OUTPUT_PATH" == "/" ] || [ "$INSPECTION_PATH" == "/" ]; then echo "Bad path" exit 1 fi -rm -rf ${OUTPUT_PATH} -mkdir -p ${OUTPUT_PATH} -mkdir -p ${OUTPUT_PATH}/ReportExternal -mkdir -p ${OUTPUT_PATH}/coverage -mkdir -p ${OUTPUT_PATH}/phpunit -mkdir -p ${OUTPUT_PATH}/metrics +rm -rf "${INSPECTION_PATH}" + +mkdir -p "${OUTPUT_PATH}" +mkdir -p "${OUTPUT_PATH}/ReportExternal" +mkdir -p "${OUTPUT_PATH}/coverage" +mkdir -p "${OUTPUT_PATH}/phpunit" +mkdir -p "${OUTPUT_PATH}/metrics" git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH} git -C ${INSPECTION_PATH} checkout develop From c36eae008c7259c70b4bdca3753ea1549feba318 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 01:33:08 +0000 Subject: [PATCH 20/26] fix inspections --- Inspection/inspect.sh | 12 ++++++------ php.sh | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index acc623b..1dd9319 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -26,12 +26,6 @@ echo "MYSQL queries" echo "#################################################" . ${BUILD_PATH}/Inspection/Sql/performance.sh -# Stats & metrics -echo "#################################################" -echo "PHP stats" -echo "#################################################" -. ${BUILD_PATH}/Inspection/Php/stats.sh - # Linting echo "#################################################" echo "Json and PHP linting" @@ -66,6 +60,12 @@ echo "Custom js inspection" echo "#################################################" . ${BUILD_PATH}/Inspection/Js/security.sh +# Stats & metrics +echo "#################################################" +echo "PHP stats" +echo "#################################################" +. ${BUILD_PATH}/Inspection/Php/stats.sh + # Build external test report echo "#################################################" echo "Test report" diff --git a/php.sh b/php.sh index 7c63a13..2fa8218 100644 --- a/php.sh +++ b/php.sh @@ -21,24 +21,24 @@ fi rm -rf "${INSPECTION_PATH}" -mkdir -p "${OUTPUT_PATH}" -mkdir -p "${OUTPUT_PATH}/ReportExternal" -mkdir -p "${OUTPUT_PATH}/coverage" -mkdir -p "${OUTPUT_PATH}/phpunit" -mkdir -p "${OUTPUT_PATH}/metrics" - git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH} git -C ${INSPECTION_PATH} checkout develop git -C ${INSPECTION_PATH} pull git -C ${INSPECTION_PATH} submodule foreach 'git checkout develop || true' git -C ${INSPECTION_PATH} submodule foreach 'git pull || true' +mkdir -p "${OUTPUT_PATH}" +mkdir -p "${OUTPUT_PATH}/ReportExternal" +mkdir -p "${OUTPUT_PATH}/coverage" +mkdir -p "${OUTPUT_PATH}/phpunit" +mkdir -p "${OUTPUT_PATH}/metrics" + if [[ ${BASE_NAME} == *"oms-"* ]]; then - git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH}/Karaka - git -C ${INSPECTION_PATH}/Karaka checkout develop - git -C ${INSPECTION_PATH}/Karaka pull - git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git checkout develop || true' - git -C ${INSPECTION_PATH}/Karaka submodule foreach 'git pull || true' + git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH}/MainRepository + git -C ${INSPECTION_PATH}/MainRepository checkout develop + git -C ${INSPECTION_PATH}/MainRepository pull + git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git checkout develop || true' + git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git pull || true' fi # Run inspection From 2a2f494ce55caa9717cfdc49f2c055b313623278 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 02:56:46 +0000 Subject: [PATCH 21/26] fix autoloading --- Config/phpmetrics.json | 3 ++- Helper/Scripts/serverInstall.sh | 3 +++ Inspection/Php/stats.sh | 2 +- Inspection/Php/style.sh | 2 +- Inspection/Php/tests.sh | 2 +- php.sh | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Config/phpmetrics.json b/Config/phpmetrics.json index e42a8b2..53d2b82 100644 --- a/Config/phpmetrics.json +++ b/Config/phpmetrics.json @@ -1,8 +1,9 @@ { - "composer": false, + "composer": true, "excludes": [ ".git", "tests", + "MainRepository", "vendor", "Admin/Install/Application", "Install/Application", diff --git a/Helper/Scripts/serverInstall.sh b/Helper/Scripts/serverInstall.sh index ddfb41f..c553eca 100644 --- a/Helper/Scripts/serverInstall.sh +++ b/Helper/Scripts/serverInstall.sh @@ -39,6 +39,9 @@ service fail2ban restart apt-get install php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 libapache2-mpm-itk apache2-utils mariadb-server mariadb-client wkhtmltopdf tesseract-ocr poppler-utils +pecl install pcov +#echo "extension=pcov.so" > /etc/php/cli/conf.d/20-xdebug.ini + mkdir -p /var/cache/apache2 mkdir -p /var/cache/apache2/tmrank chown -R www-data:www-data /var/cache/apache2 diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index 169b898..e5b2622 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -8,4 +8,4 @@ echo "#################################################" # php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log || true -php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} || true \ No newline at end of file +php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --junit=${OUTPUT_PATH}/junit_php.xml --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} || true \ No newline at end of file diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 4fe8821..f665703 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -8,4 +8,4 @@ echo "#################################################" php ${TOOLS_PATH}/vendor/bin/phpcs ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml || true -php ${TOOLS_PATH}/vendor/bin/rector --dry-run --config ${BUILD_PATH}/Config/rector.php process ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log || true +php ${TOOLS_PATH}/vendor/bin/rector process --dry-run --config ${BUILD_PATH}/Config/rector.php ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log || true diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index ef8a996..77971e2 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -6,7 +6,7 @@ echo "#################################################" echo "Start php unit tests inspection" echo "#################################################" -php -dpcov.enabled=1 -dxdebug.mode=coverage ${TOOLS_PATH}/vendor/bin/phpunit -v --configuration ${INSPECTION_PATH}/tests/phpunit_default.xml --log-junit ${OUTPUT_PATH}/junit_php.xml --testdox-html ${OUTPUT_PATH}/phpunit/index.html --coverage-html ${OUTPUT_PATH}/coverage --coverage-clover ${OUTPUT_PATH}/coverage.xml > ${OUTPUT_PATH}/phpunit.log || true +php -dpcov.enabled=1 -dxdebug.mode=coverage ${TOOLS_PATH}/vendor/bin/phpunit -v --configuration ${INSPECTION_PATH}/tests/phpunit_default.xml --log-junit ${OUTPUT_PATH}/junit_php.xml --testdox-html ${OUTPUT_PATH}/phpunit.html --coverage-html ${OUTPUT_PATH}/coverage --coverage-clover ${OUTPUT_PATH}/coverage.xml > ${OUTPUT_PATH}/phpunit.log || true echo "#################################################" echo "Start php static inspection" diff --git a/php.sh b/php.sh index 2fa8218..ff824a8 100644 --- a/php.sh +++ b/php.sh @@ -34,7 +34,7 @@ mkdir -p "${OUTPUT_PATH}/phpunit" mkdir -p "${OUTPUT_PATH}/metrics" if [[ ${BASE_NAME} == *"oms-"* ]]; then - git clone --recurse-submodules ${REPO_PATH} ${INSPECTION_PATH}/MainRepository + git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git ${INSPECTION_PATH}/MainRepository git -C ${INSPECTION_PATH}/MainRepository checkout develop git -C ${INSPECTION_PATH}/MainRepository pull git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git checkout develop || true' From 9b24b004167f917e3dd1e15fb64ab74f0f1ca2fd Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 03:22:57 +0000 Subject: [PATCH 22/26] optimize build --- Helper/Scripts/testall.sh | 7 +++++++ php.sh | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 Helper/Scripts/testall.sh diff --git a/Helper/Scripts/testall.sh b/Helper/Scripts/testall.sh new file mode 100644 index 0000000..fe6e06b --- /dev/null +++ b/Helper/Scripts/testall.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +CNTX="users"; NAME="Karaka-Management"; PAGE=1 +curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | + grep -e 'clone_url*' | + cut -d \" -f 4 | + xargs -L1 git clone \ No newline at end of file diff --git a/php.sh b/php.sh index ff824a8..03a285f 100644 --- a/php.sh +++ b/php.sh @@ -34,11 +34,13 @@ mkdir -p "${OUTPUT_PATH}/phpunit" mkdir -p "${OUTPUT_PATH}/metrics" if [[ ${BASE_NAME} == *"oms-"* ]]; then - git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git ${INSPECTION_PATH}/MainRepository - git -C ${INSPECTION_PATH}/MainRepository checkout develop - git -C ${INSPECTION_PATH}/MainRepository pull - git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git checkout develop || true' - git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git pull || true' + mkdir -p ${INSPECTION_PATH}/MainRepository + cp -R ${INSPECTION_PATH}/../Karaka/* ${INSPECTION_PATH}/MainRepository +# git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git ${INSPECTION_PATH}/MainRepository +# git -C ${INSPECTION_PATH}/MainRepository checkout develop +# git -C ${INSPECTION_PATH}/MainRepository pull +# git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git checkout develop || true' +# git -C ${INSPECTION_PATH}/MainRepository submodule foreach 'git pull || true' fi # Run inspection From 7198b3a8b121908ba7f5f5907f5cc64e7e59c2a1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 14:11:38 +0000 Subject: [PATCH 23/26] fix phpcs paths and add install all modules --- Config/phpcs.xml | 1 + Helper/Scripts/testall.sh | 110 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/Config/phpcs.xml b/Config/phpcs.xml index 1130e7d..8430a01 100755 --- a/Config/phpcs.xml +++ b/Config/phpcs.xml @@ -7,6 +7,7 @@ *.tpl.php *.xls.php */Build/* +*/MainRepository/* */Cache/* */Demo/* */Docs/* diff --git a/Helper/Scripts/testall.sh b/Helper/Scripts/testall.sh index fe6e06b..e7de773 100644 --- a/Helper/Scripts/testall.sh +++ b/Helper/Scripts/testall.sh @@ -1,7 +1,107 @@ #!/bin/bash -CNTX="users"; NAME="Karaka-Management"; PAGE=1 -curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | - grep -e 'clone_url*' | - cut -d \" -f 4 | - xargs -L1 git clone \ No newline at end of file +GITHUB[0]="https://github.com/Karaka-Management/jsOMS.git" +GITHUB[1]="https://github.com/Karaka-Management/Karaka.git" +GITHUB[2]="https://github.com/Karaka-Management/oms-Accounting.git" +GITHUB[3]="https://github.com/Karaka-Management/oms-AccountsPayable.git" +GITHUB[4]="https://github.com/Karaka-Management/oms-AccountsReceivable.git" +GITHUB[5]="https://github.com/Karaka-Management/oms-Admin.git" +GITHUB[6]="https://github.com/Karaka-Management/oms-AreaManager.git" +GITHUB[7]="https://github.com/Karaka-Management/oms-Arrival.git" +GITHUB[8]="https://github.com/Karaka-Management/oms-AssemblyManagement.git" +GITHUB[9]="https://github.com/Karaka-Management/oms-AssetManagement.git" +GITHUB[10]="https://github.com/Karaka-Management/oms-Attribute.git" +GITHUB[11]="https://github.com/Karaka-Management/oms-Auditor.git" +GITHUB[12]="https://github.com/Karaka-Management/oms-Backup.git" +GITHUB[13]="https://github.com/Karaka-Management/oms-Balance.git" +GITHUB[14]="https://github.com/Karaka-Management/oms-BankAccounting.git" +GITHUB[15]="https://github.com/Karaka-Management/oms-Billing.git" +GITHUB[16]="https://github.com/Karaka-Management/oms-BudgetManagement.git" +GITHUB[17]="https://github.com/Karaka-Management/oms-BusinessExpenses.git" +GITHUB[18]="https://github.com/Karaka-Management/oms-Calendar.git" +GITHUB[19]="https://github.com/Karaka-Management/oms-CapacityPlanning.git" +GITHUB[20]="https://github.com/Karaka-Management/oms-CashManagement.git" +GITHUB[21]="https://github.com/Karaka-Management/oms-Chart.git" +GITHUB[22]="https://github.com/Karaka-Management/oms-Chat.git" +GITHUB[23]="https://github.com/Karaka-Management/oms-Checklist.git" +GITHUB[24]="https://github.com/Karaka-Management/oms-ClientEvaluation.git" +GITHUB[25]="https://github.com/Karaka-Management/oms-ClientManagement.git" +GITHUB[26]="https://github.com/Karaka-Management/oms-CMS.git" +GITHUB[27]="https://github.com/Karaka-Management/oms-Comments.git" +GITHUB[28]="https://github.com/Karaka-Management/oms-Contact.git" +GITHUB[29]="https://github.com/Karaka-Management/oms-ContractManagement.git" +GITHUB[30]="https://github.com/Karaka-Management/oms-Controlling.git" +GITHUB[31]="https://github.com/Karaka-Management/oms-CreditManagement.git" +GITHUB[32]="https://github.com/Karaka-Management/oms-Dashboard.git" +GITHUB[33]="https://github.com/Karaka-Management/oms-Database.git" +GITHUB[34]="https://github.com/Karaka-Management/oms-DatabaseEditor.git" +GITHUB[35]="https://github.com/Karaka-Management/oms-Draw.git" +GITHUB[36]="https://github.com/Karaka-Management/oms-Editor.git" +GITHUB[37]="https://github.com/Karaka-Management/oms-EmployeeEvaluation.git" +GITHUB[38]="https://github.com/Karaka-Management/oms-EquipmentManagement.git" +GITHUB[39]="https://github.com/Karaka-Management/oms-EventManagement.git" +GITHUB[40]="https://github.com/Karaka-Management/oms-Exchange.git" +GITHUB[41]="https://github.com/Karaka-Management/oms-Finance.git" +GITHUB[42]="https://github.com/Karaka-Management/oms-FleetManagement.git" +GITHUB[43]="https://github.com/Karaka-Management/oms-Help.git" +GITHUB[44]="https://github.com/Karaka-Management/oms-Helper.git" +GITHUB[45]="https://github.com/Karaka-Management/oms-Home.git" +GITHUB[46]="https://github.com/Karaka-Management/oms-HumanResourceManagement.git" +GITHUB[47]="https://github.com/Karaka-Management/oms-HumanResourceTimeRecording.git" +GITHUB[48]="https://github.com/Karaka-Management/oms-IncomeStatement.git" +GITHUB[49]="https://github.com/Karaka-Management/oms-InvestmentManagement.git" +GITHUB[50]="https://github.com/Karaka-Management/oms-ItemManagement.git" +GITHUB[51]="https://github.com/Karaka-Management/oms-Kanban.git" +GITHUB[52]="https://github.com/Karaka-Management/oms-Knowledgebase.git" +GITHUB[53]="https://github.com/Karaka-Management/oms-KPI.git" +GITHUB[54]="https://github.com/Karaka-Management/oms-Labeling.git" +GITHUB[55]="https://github.com/Karaka-Management/oms-LoanManagement.git" +GITHUB[56]="https://github.com/Karaka-Management/oms-Logistics.git" +GITHUB[57]="https://github.com/Karaka-Management/oms-LotTracking.git" +GITHUB[58]="https://github.com/Karaka-Management/oms-Marketing.git" +GITHUB[59]="https://github.com/Karaka-Management/oms-Media.git" +GITHUB[60]="https://github.com/Karaka-Management/oms-Messages.git" +GITHUB[61]="https://github.com/Karaka-Management/oms-Monitoring.git" +GITHUB[62]="https://github.com/Karaka-Management/oms-MyPrivate.git" +GITHUB[63]="https://github.com/Karaka-Management/oms-Navigation.git" +GITHUB[64]="https://github.com/Karaka-Management/oms-News.git" +GITHUB[65]="https://github.com/Karaka-Management/oms-OnlineResourceWatcher.git" +GITHUB[66]="https://github.com/Karaka-Management/oms-Organization.git" +GITHUB[67]="https://github.com/Karaka-Management/oms-Payment.git" +GITHUB[68]="https://github.com/Karaka-Management/oms-Payroll.git" +GITHUB[69]="https://github.com/Karaka-Management/oms-Production.git" +GITHUB[70]="https://github.com/Karaka-Management/oms-ProductionPlanning.git" +GITHUB[71]="https://github.com/Karaka-Management/oms-Profile.git" +GITHUB[72]="https://github.com/Karaka-Management/oms-ProjectManagement.git" +GITHUB[73]="https://github.com/Karaka-Management/oms-Purchase.git" +GITHUB[74]="https://github.com/Karaka-Management/oms-PurchaseAnalysis.git" +GITHUB[75]="https://github.com/Karaka-Management/oms-QA.git" +GITHUB[76]="https://github.com/Karaka-Management/oms-QualityAssurance.git" +GITHUB[77]="https://github.com/Karaka-Management/oms-QualityControl.git" +GITHUB[78]="https://github.com/Karaka-Management/oms-QualityManagement.git" +GITHUB[79]="https://github.com/Karaka-Management/oms-ResearchDevelopment.git" +GITHUB[80]="https://github.com/Karaka-Management/oms-RiskManagement.git" +GITHUB[81]="https://github.com/Karaka-Management/oms-Sales.git" +GITHUB[82]="https://github.com/Karaka-Management/oms-SalesAnalysis.git" +GITHUB[83]="https://github.com/Karaka-Management/oms-Search.git" +GITHUB[84]="https://github.com/Karaka-Management/oms-ShiftPlanning.git" +GITHUB[85]="https://github.com/Karaka-Management/oms-Shipping.git" +GITHUB[86]="https://github.com/Karaka-Management/oms-Shop.git" +GITHUB[87]="https://github.com/Karaka-Management/oms-Spreadsheet.git" +GITHUB[88]="https://github.com/Karaka-Management/oms-StockTaking.git" +GITHUB[89]="https://github.com/Karaka-Management/oms-SupplierManagement.git" +GITHUB[90]="https://github.com/Karaka-Management/oms-Support.git" +GITHUB[91]="https://github.com/Karaka-Management/oms-Surveys.git" +GITHUB[92]="https://github.com/Karaka-Management/oms-Tag.git" +GITHUB[93]="https://github.com/Karaka-Management/oms-Tasks.git" +GITHUB[94]="https://github.com/Karaka-Management/oms-TestModule.git" +GITHUB[95]="https://github.com/Karaka-Management/oms-Tools.git" +GITHUB[96]="https://github.com/Karaka-Management/oms-WarehouseManagement.git" +GITHUB[97]="https://github.com/Karaka-Management/oms-Workflow.git" +GITHUB[98]="https://github.com/Karaka-Management/Organization-Guide.git" +GITHUB[99]="https://github.com/Karaka-Management/phpOMS.git" + +for i in "${GITHUB[@]}" +do + sh Build/php.sh "$i" ./src +done \ No newline at end of file From a3e2faea37a2fd68c8d54063903be969460f8d42 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 2 Oct 2023 23:52:59 +0000 Subject: [PATCH 24/26] fix build scripts --- Helper/Scripts/testall.sh | 1 - Inspection/Php/style.sh | 2 +- php.sh | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Helper/Scripts/testall.sh b/Helper/Scripts/testall.sh index e7de773..d4f53ab 100644 --- a/Helper/Scripts/testall.sh +++ b/Helper/Scripts/testall.sh @@ -98,7 +98,6 @@ GITHUB[94]="https://github.com/Karaka-Management/oms-TestModule.git" GITHUB[95]="https://github.com/Karaka-Management/oms-Tools.git" GITHUB[96]="https://github.com/Karaka-Management/oms-WarehouseManagement.git" GITHUB[97]="https://github.com/Karaka-Management/oms-Workflow.git" -GITHUB[98]="https://github.com/Karaka-Management/Organization-Guide.git" GITHUB[99]="https://github.com/Karaka-Management/phpOMS.git" for i in "${GITHUB[@]}" diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index f665703..6086d35 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -6,6 +6,6 @@ echo "#################################################" echo "Start php style inspection" echo "#################################################" -php ${TOOLS_PATH}/vendor/bin/phpcs ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml || true +php ${TOOLS_PATH}/vendor/bin/phpcs --severity=1 ${INSPECTION_PATH} --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${OUTPUT_PATH}/phpcs.log --report-junit=${OUTPUT_PATH}/phpcs.xml || true php ${TOOLS_PATH}/vendor/bin/rector process --dry-run --config ${BUILD_PATH}/Config/rector.php ${INSPECTION_PATH} > ${OUTPUT_PATH}/rector.log || true diff --git a/php.sh b/php.sh index 03a285f..3f104b2 100644 --- a/php.sh +++ b/php.sh @@ -35,7 +35,7 @@ mkdir -p "${OUTPUT_PATH}/metrics" if [[ ${BASE_NAME} == *"oms-"* ]]; then mkdir -p ${INSPECTION_PATH}/MainRepository - cp -R ${INSPECTION_PATH}/../Karaka/* ${INSPECTION_PATH}/MainRepository + cp -R ${INSPECTION_PATH}/../../Karaka/* ${INSPECTION_PATH}/MainRepository # git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git ${INSPECTION_PATH}/MainRepository # git -C ${INSPECTION_PATH}/MainRepository checkout develop # git -C ${INSPECTION_PATH}/MainRepository pull From 8d218ecc1a0e39b379d6d1fcadd7df00cb27ad4c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 4 Oct 2023 15:51:32 +0000 Subject: [PATCH 25/26] cleanup scripts --- Helper/Scripts/install.sh | 10 +++- Helper/Scripts/serverInstall.sh | 2 +- buildProject.php | 15 ------ buildProject.sh | 95 --------------------------------- 4 files changed, 9 insertions(+), 113 deletions(-) delete mode 100755 buildProject.php delete mode 100755 buildProject.sh diff --git a/Helper/Scripts/install.sh b/Helper/Scripts/install.sh index d4a4b35..0a870dd 100644 --- a/Helper/Scripts/install.sh +++ b/Helper/Scripts/install.sh @@ -16,7 +16,13 @@ add-apt-repository ppa:ondrej/php apt-get update -apt-get install php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 mysql-server wkhtmltopdf tesseract-ocr poppler-utils +apt-get install php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 mariadb-server mariadb-client wkhtmltopdf tesseract-ocr poppler-utils + +apt-get install curl libcurl4-openssl-dev libxml2 libxml2-dev + +mysql_secure_installation +systemctl start mariadb +systemctl enable mariadb a2enmod rewrite a2enmod headers @@ -49,7 +55,7 @@ borg key export /var/www/html repokey ## Developer ############################################################### -apt-get install npm git composer cmake postgresql postgresql-contrib pcov +apt-get install npm git composer nodejs cmake postgresql postgresql-contrib pcov composer install composer update npm install -D jasmine jasmine-node istanbul jasmine-console-reporter supertest jasmine-supertest selenium-webdriver chromedriver geckodriver eslint diff --git a/Helper/Scripts/serverInstall.sh b/Helper/Scripts/serverInstall.sh index c553eca..6dbe78d 100644 --- a/Helper/Scripts/serverInstall.sh +++ b/Helper/Scripts/serverInstall.sh @@ -10,7 +10,7 @@ export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" > apt-get update apt-get upgrade -apt-get install git git-lfs snapd ufw software-properties-common composer nodejs npm +apt-get install git snapd ufw software-properties-common composer nodejs npm # Security diff --git a/buildProject.php b/buildProject.php deleted file mode 100755 index 56cdbaf..0000000 --- a/buildProject.php +++ /dev/null @@ -1,15 +0,0 @@ - /dev/null 2>/dev/null &'); - - echo 'Installing'; -} else { - echo 'Invalid payload'; -} diff --git a/buildProject.sh b/buildProject.sh deleted file mode 100755 index a84ab90..0000000 --- a/buildProject.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# Include config -. config.sh - -# Clean setup -echo "#################################################" -echo "Remove old setup" -echo "#################################################" - -# Previous cleanup -rm -r -f ${ROOT_PATH} -rm -r -f ${BASE_PATH}/phpOMS -rm -r -f ${BASE_PATH}/jsOMS -rm -r -f ${BASE_PATH}/cssOMS -rm -r -f ${TOOLS_PATH} - -rm -r -f ${INSPECTION_PATH} -mkdir -p ${INSPECTION_PATH} - -cd ${BASE_PATH} - -echo "#################################################" -echo "Setup repositories" -echo "#################################################" - -# Create git repositories -for i in "${GITHUB_URL[@]}" -do - git clone -b ${GIT_BRANCH} $i >/dev/null -done - -cd ${ROOT_PATH} -git submodule update --init --recursive >/dev/null -git submodule foreach git checkout develop >/dev/null - -echo "#################################################" -echo "Setup build output" -echo "#################################################" - -# Creating directories for inspection -mkdir -p ${INSPECTION_PATH}/logs -mkdir -p ${INSPECTION_PATH}/Framework/logs -mkdir -p ${INSPECTION_PATH}/Framework/metrics -#mkdir -p ${INSPECTION_PATH}/Framework/pdepend -mkdir -p ${INSPECTION_PATH}/Framework/phpcs -mkdir -p ${INSPECTION_PATH}/Framework/phpcpd -mkdir -p ${INSPECTION_PATH}/Framework/linting -mkdir -p ${INSPECTION_PATH}/Framework/html - -mkdir -p ${INSPECTION_PATH}/Modules/logs -mkdir -p ${INSPECTION_PATH}/Modules/metrics -#mkdir -p ${INSPECTION_PATH}/Modules/pdepend -mkdir -p ${INSPECTION_PATH}/Modules/phpcs -mkdir -p ${INSPECTION_PATH}/Modules/phpcpd -mkdir -p ${INSPECTION_PATH}/Modules/linting -mkdir -p ${INSPECTION_PATH}/Modules/html - -mkdir -p ${INSPECTION_PATH}/Web/logs -mkdir -p ${INSPECTION_PATH}/Web/metrics -#mkdir -p ${INSPECTION_PATH}/Web/pdepend -mkdir -p ${INSPECTION_PATH}/Web/phpcs -mkdir -p ${INSPECTION_PATH}/Web/phpcpd -mkdir -p ${INSPECTION_PATH}/Web/linting -mkdir -p ${INSPECTION_PATH}/Web/html - -mkdir -p ${INSPECTION_PATH}/Framework -mkdir -p ${INSPECTION_PATH}/Web -mkdir -p ${INSPECTION_PATH}/Model -mkdir -p ${INSPECTION_PATH}/Modules - -mkdir -p ${INSPECTION_PATH}/Test/Php -mkdir -p ${INSPECTION_PATH}/Test/Js -mkdir -p ${INSPECTION_PATH}/Test/sitespeed - -mkdir -p ${INSPECTION_PATH}/Sql - -# Permission handling -chmod -R 777 ${ROOT_PATH} - -# Setup tools for inspection -mkdir -p ${TOOLS_PATH} - -echo "#################################################" -echo "Setup tools" -echo "#################################################" - -cd ${ROOT_PATH} -composer install -npm install - -cd ${BUILD_PATH} - -# Run inspection -. ${BUILD_PATH}/Inspection/inspect.sh From 201b8e28e3a327c2e0c3707181f4a1e42e6c7c02 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 15 Oct 2023 11:54:56 +0000 Subject: [PATCH 26/26] fix image creation --- Js/createImages.js | 224 +++++++++++++++++++++++++++++++-------------- 1 file changed, 153 insertions(+), 71 deletions(-) diff --git a/Js/createImages.js b/Js/createImages.js index 14d3828..4f0404d 100755 --- a/Js/createImages.js +++ b/Js/createImages.js @@ -1,80 +1,162 @@ const {By,Key,Builder} = require("selenium-webdriver"); -require("chromedriver"); +const chrome = require('selenium-webdriver/chrome'); let fs = require('fs'); +let path = require('path'); + +const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); async function Screenshot(url, xpath, output) { - let driver = await new Builder().forBrowser("chrome").build(); + let driver = await new Builder().forBrowser("chrome").build(); - await driver.get(url).then(function () { - return driver.manage().setTimeouts({implicit: 3000}); - }).then(function () { - return driver.manage().window().setRect({width: 1440, height: 1024}); - }).then(function () { - return driver.findElement(By.id("iLoginButton")).click(); - }).then(function () { - return driver.sleep(2000); - }).then(function () { - return driver.findElement(By.xpath(xpath)); - }).then(function (ele) { - return ele.takeScreenshot(true); - }).then(function (encodedString) { - return fs.writeFileSync(output, encodedString, 'base64'); - }); + let dir = path.dirname(output); + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }); + } - return driver.quit(); + await driver.get(url).then(function () { + return driver.manage().setTimeouts({implicit: 3000}); + }).then(function () { + return driver.manage().window().setRect({width: 1024, height: 800}); + }).then(function () { + return driver.findElement(By.id("iLoginButton")).click(); + }).then(function () { + return driver.sleep(2000); + }).then(function () { + return driver.findElement(By.xpath(xpath)); + }).then(function (ele) { + return ele.takeScreenshot(true); + }).then(function (encodedString) { + return fs.writeFileSync(output, encodedString, 'base64'); + }); + + return driver.quit(); } -Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//form[@id="fLocalization"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization.png' -).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-time"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-time.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-numeric"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-numeric.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-precision"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-precision.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-weight"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-weight.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-speed"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-speed.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-length"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-length.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-area"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-area.png' - ); -}).then(function () { - Screenshot( - 'http://127.0.0.1/admin/settings/general#c-tab-2', - '//div[@id="settings-localization-volume"]', - __dirname + '/../../Modules/Admin/Docs/Help/img/general/settings-localization-volume.png' - ); -}); +const src = [ + // Help + [ + 'http://192.168.178.38/en/help/general', + '//*[@id="content"]', + __dirname + '/../../Modules/Help/Docs/Help/img/help-general-readme.png' + ], + + [ + 'http://192.168.178.38/en/help/module/list', + '//*[@id="content"]', + __dirname + '/../../Modules/Help/Docs/Help/img/help-general-module-list.png' + ], + [ + 'http://192.168.178.38/en/backend/help/module/single?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Help/Docs/Help/img/help-general-module-readme.png' + ], + [ + 'http://192.168.178.38/en/backend/help/module/single?id=Admin&page=Dev%2Fstructure', + '//*[@id="content"]', + __dirname + '/../../Modules/Help/Docs/Help/img/help-general-module-structure.png' + ], + + [ + 'http://192.168.178.38/en/help/developer?id=Admin&page=Dev%2Fstructure', + '//*[@id="content"]', + __dirname + '/../../Modules/Help/Docs/Help/img/help-developer-readme.png' + ], + + // Groups + [ + 'http://192.168.178.38/en/admin/group/settings?id=3#c-tab-3', + '//*[@id="permissionForm"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-group-settings-permission-form.png' + ], + [ + 'http://192.168.178.38/en/admin/group/settings?id=3#c-tab-3', + '//*[@id="igroup-tabs"]/div[2]/div[3]/div/div[2]/div', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-group-settings-permission-list.png' + ], + + // Accounts + [ + 'http://192.168.178.38/en/admin/account/settings?id=1#c-tab-3', + '//*[@id="permissionForm"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-account-settings-permission-form.png' + ], + [ + 'http://192.168.178.38/en/admin/account/settings?id=1#c-tab-3', + '//*[@id="iaccount-tabs"]/div[2]/div[3]/div/div[2]/div', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-account-settings-permission-list.png' + ], + + // Modules + [ + 'http://192.168.178.38/en/admin/module/info?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-info.png' + ], + [ + 'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-1', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-settings-general.png' + ], + [ + 'http://192.168.178.38/en/admin/module/navigation/list?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-settings-navigation.png' + ], + [ + 'http://192.168.178.38/en/admin/module/route/list?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-settings-routes.png' + ], + [ + 'http://192.168.178.38/en/admin/module/hook/list?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-settings-hooks.png' + ], + [ + 'http://192.168.178.38/en/admin/module/log?id=Admin', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-settings-logs.png' + ], + + // Admin-settings + [ + 'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-1', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-admin-settings-general.png' + ], + [ + 'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-2', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-admin-settings-localization.png' + ], + [ + 'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-3', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-admin-settings-design.png' + ], + [ + 'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-5', + '//*[@id="content"]', + __dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-admin-settings-list.png' + ], +]; +const length = src.length; + +(async function loop() { + for (let i = 0; i < length; ++i) { + try { + Screenshot( + src[i][0], + src[i][1], + src[i][2] + ); + + await delay(1000); + } catch(error) { + console.error(error); + } + } +})(); + +// "C:\Program Files\nodejs\node.exe" Build/Js/createImages.js \ No newline at end of file