From 7e05e57b5b557a2557ef3dbc54736ba8d5597b9d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 19 Apr 2022 23:37:06 +0200 Subject: [PATCH] update php version --- Config/.eslintrc.json | 4 ++-- Config/snippets.code-snippets | 8 +++---- Helper/findMissingAdminTest.php | 2 +- Helper/findMissingNullModelTest.php | 4 ++-- Helper/inspectproject.sh | 33 +++++++++++++++++------------ README.md | 2 +- Tools/langUsageInspector.php | 2 +- VM/config.vm.provision | 14 ++++++------ 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Config/.eslintrc.json b/Config/.eslintrc.json index 91caea6..5f265b3 100644 --- a/Config/.eslintrc.json +++ b/Config/.eslintrc.json @@ -335,7 +335,7 @@ } ], "no-unused-vars": [ - "error", + "warn", { "args": "none", "caughtErrors": "none", @@ -353,7 +353,7 @@ ], "no-useless-call": "error", "no-useless-computed-key": "error", - "no-useless-constructor": "error", + "no-useless-constructor": "warn", "no-useless-rename": "error", "no-useless-return": "error", "no-void": "error", diff --git a/Config/snippets.code-snippets b/Config/snippets.code-snippets index 9f55668..3a4f919 100755 --- a/Config/snippets.code-snippets +++ b/Config/snippets.code-snippets @@ -6,7 +6,7 @@ "/**", " * Karaka", " *", - " * PHP Version 8.0", + " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", @@ -49,7 +49,7 @@ "/**", " * Karaka", " *", - " * PHP Version 8.0", + " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", @@ -83,7 +83,7 @@ "/**", " * Karaka", " *", - " * PHP Version 8.0", + " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", @@ -218,7 +218,7 @@ "/**", " * Karaka", " *", - " * PHP Version 8.0", + " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", diff --git a/Helper/findMissingAdminTest.php b/Helper/findMissingAdminTest.php index cba4e68..e56f56e 100644 --- a/Helper/findMissingAdminTest.php +++ b/Helper/findMissingAdminTest.php @@ -2,7 +2,7 @@ /** * Karaka * - * PHP Version 8.0 + * PHP Version 8.1 * * @package Helper * @copyright Dennis Eichhorn diff --git a/Helper/findMissingNullModelTest.php b/Helper/findMissingNullModelTest.php index 911e09a..34676ff 100644 --- a/Helper/findMissingNullModelTest.php +++ b/Helper/findMissingNullModelTest.php @@ -2,7 +2,7 @@ /** * Karaka * - * PHP Version 8.0 + * PHP Version 8.1 * * @package Helper * @copyright Dennis Eichhorn @@ -59,7 +59,7 @@ foreach ($modules as $module) { . '/**' . "\n" . ' * Karaka' . "\n" . ' *' . "\n" - . ' * PHP Version 8.0' . "\n" + . ' * PHP Version 8.1' . "\n" . ' *' . "\n" . ' * @package tests' . "\n" . ' * @copyright Dennis Eichhorn' . "\n" diff --git a/Helper/inspectproject.sh b/Helper/inspectproject.sh index 74f6d9f..059f6e6 100755 --- a/Helper/inspectproject.sh +++ b/Helper/inspectproject.sh @@ -1,27 +1,34 @@ #!/bin/bash +SCRIPT=$(readlink -f "$0") +BPATH=$(dirname "$SCRIPT") + # html checks -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '(\)' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '()' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '()' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '(style=)' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)' -find ./Web ./Install ./Modules -name "*tpl.php" | xargs grep -P '(\|\|\|\)[0-9a-zA-Z\.\?]+)' +printf "\nHTML checks\n\n" +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(\)' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '()' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '()' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(style=)' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)' +find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(\|\|\|\)[0-9a-zA-Z\.\?]+)' # php/js strict checks -grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ./phpOMS ./Web ./Modules ./Model -grep -r -L "\"use strict\";" --include=*.js ./jsOMS ./Modules ./Model +printf "\nStrict checks\n\n" +grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${BPATH}/../../phpOMS ${BPATH}/../../Web ${BPATH}/../../Modules ${BPATH}/../../Model # php/js has logs -find ./Web ./phpOMS ./Model ./Modules -name "*.js" | xargs grep 'console.log(' -find ./Web ./jsOMS ./Model ./Modules -name "*.php" | xargs grep 'var_dump(' +printf "\nLog checks\n\n" +find ${BPATH}/../../Web ${BPATH}/../../phpOMS ${BPATH}/../../Model ${BPATH}/../../Modules -name "*.js" | xargs -0 grep 'console.log(' +find ${BPATH}/../../Web ${BPATH}/../../jsOMS ${BPATH}/../../Model ${BPATH}/../../Modules -name "*.php" | xargs -0 grep 'var_dump(' # js uses on actions -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 ./jsOMS ./Model ./Modules ./Web +printf "\nJs Action checks\n\n" +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 ${BPATH}/../../jsOMS ${BPATH}/../../Model ${BPATH}/../../Modules ${BPATH}/../../Web # white spaces at end of line -find ./Web ./phpOMS ./jsOMS ./cOMS ./Model ./Build ./Modules \( -name "*.php" -o -name "*.js" -o -name "*.sh" -o -name "*.cpp" -o -name "*.h" -o -name "*.json" \) | xargs grep -P ' $' +printf "\nWhitespace check\n\n" +find ${BPATH}/../../Web ${BPATH}/../../phpOMS ${BPATH}/../../jsOMS ${BPATH}/../../cOMS ${BPATH}/../../Model ${BPATH}/../../Build ${BPATH}/../../Modules \( -name "*.php" -o -name "*.js" -o -name "*.sh" -o -name "*.cpp" -o -name "*.h" -o -name "*.json" \) | xargs -0 grep -P ' $' # php cs + phpstan + eslint ./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" diff --git a/README.md b/README.md index 647f4fe..20a119a 100755 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The last feature is the backend and documentation generation based on the DocBlo The build system will take care of most requirements, the following tools and commands have to be available on the system. - software-properties-common npm git php8.0 php8.0-dev php8.0-cli php8.0-common php8.0-mysql php8.0-pgsql php8.0-xdebug php8.0-opcache php8.0-pdo php8.0-sqlite php8.0-mbstring php8.0-curl php8.0-imap php8.0-bcmath php8.0-zip php8.0-dom php8.0-xml php8.0-phar php8.0-gd php-pear apache2 mysql-server postgresql postgresql-contrib vsftpd tesseract-ocr wget curl grep xarg sed composer + software-properties-common npm git 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 postgresql postgresql-contrib vsftpd tesseract-ocr wget curl grep xarg sed composer ## Inspections diff --git a/Tools/langUsageInspector.php b/Tools/langUsageInspector.php index b008412..c0c9a8d 100755 --- a/Tools/langUsageInspector.php +++ b/Tools/langUsageInspector.php @@ -2,7 +2,7 @@ /** * Karaka * - * PHP Version 8.0 + * PHP Version 8.1 * * Inspect .lang.php files and check them for errors/optimization * diff --git a/VM/config.vm.provision b/VM/config.vm.provision index d370833..dd44900 100644 --- a/VM/config.vm.provision +++ b/VM/config.vm.provision @@ -6,18 +6,18 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", inline: <<-SHELL apt-get update - apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common + apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common add-apt-repository ppa:ondrej/php apt-get update - apt-get install -y apache2 mysql-server php8.0 php8.0-mysql + apt-get install -y apache2 mysql-server php8.1 php8.1-mysql cp /home/spl1nes/Orange-Management/Build/VM/oms.conf /etc/apache2/sites-available/oms.conf a2ensite development.conf - a2dissite 000-default.conf + a2dissite 000-default.conf systemctl reload apache2 - echo "create database development" | mysql - echo "CREATE USER 'development'@'localhost' IDENTIFIED BY 'development'" | mysql - echo "GRANT ALL PRIVILEGES ON development.* TO 'development'@'localhost';" | mysql - echo "flush privileges" | mysql + echo "create database development" | mysql + echo "CREATE USER 'development'@'localhost' IDENTIFIED BY 'development'" | mysql + echo "GRANT ALL PRIVILEGES ON development.* TO 'development'@'localhost';" | mysql + echo "flush privileges" | mysql SHELL end