From 5ffeddb57aa61c035ddefa59755e1b0dbf065ee7 Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 20 Feb 2022 23:17:17 +0100 Subject: [PATCH] Installation Update + Bugfixes --- core/.gitignore | 3 +- core/Api/Swagger.class.php | 2 +- core/Documents/Install.class.php | 123 ++++- core/Driver/SQL/MySQL.class.php | 70 +-- core/External/.htaccess | 1 + core/External/composer.lock | 836 ++++++++++++++++++++++++++++--- core/Templates/base.html | 13 - core/Templates/swagger.twig | 4 +- core/core.php | 7 +- js/install.js | 55 +- 10 files changed, 967 insertions(+), 147 deletions(-) create mode 100644 core/External/.htaccess delete mode 100644 core/Templates/base.html diff --git a/core/.gitignore b/core/.gitignore index 8fca34b..bdcf049 100644 --- a/core/.gitignore +++ b/core/.gitignore @@ -1 +1,2 @@ -TemplateCache \ No newline at end of file +TemplateCache +External/cache \ No newline at end of file diff --git a/core/Api/Swagger.class.php b/core/Api/Swagger.class.php index 928dcae..57309f5 100644 --- a/core/Api/Swagger.class.php +++ b/core/Api/Swagger.class.php @@ -192,7 +192,7 @@ class Swagger extends Request { "definitions" => $definitions ]; - return yaml_emit($yamlData); + return \yaml_emit($yamlData); } } \ No newline at end of file diff --git a/core/Documents/Install.class.php b/core/Documents/Install.class.php index b545407..583990d 100644 --- a/core/Documents/Install.class.php +++ b/core/Documents/Install.class.php @@ -74,10 +74,11 @@ namespace Documents\Install { // Step enum const CHECKING_REQUIREMENTS = 1; - const DATABASE_CONFIGURATION = 2; - const CREATE_USER = 3; - const ADD_MAIL_SERVICE = 4; - const FINISH_INSTALLATION = 5; + const INSTALL_DEPENDENCIES = 2; + const DATABASE_CONFIGURATION = 3; + const CREATE_USER = 4; + const ADD_MAIL_SERVICE = 5; + const FINISH_INSTALLATION = 6; // private string $errorString; @@ -103,12 +104,56 @@ namespace Documents\Install { return NULL; } + private function composerUpdate(bool $dryRun = false): array { + $command = "composer update"; + if ($dryRun) { + $command .= " --dry-run"; + } + + $fds = [ + "1" => ["pipe", "w"], + "2" => ["pipe", "w"], + ]; + + $dir = $this->getExternalDirectory(); + $env = null; + if (!getenv("HOME")) { + $env = ["COMPOSER_HOME" => $dir]; + } + + $proc = proc_open($command, $fds, $pipes, $dir, $env); + $output = stream_get_contents($pipes[1]) . stream_get_contents($pipes[2]); + $status = proc_close($proc); + return [$status, $output]; + } + + private function getExternalDirectory(): string { + return implode(DIRECTORY_SEPARATOR, [WEBROOT, "core", "External"]);; + } + private function getCurrentStep(): int { if (!$this->checkRequirements()["success"]) { return self::CHECKING_REQUIREMENTS; } + $externalDir = $this->getExternalDirectory(); + $vendorDir = $externalDir . DIRECTORY_SEPARATOR . "vendor"; + if (!is_dir($vendorDir)) { + return self::INSTALL_DEPENDENCIES; + } else { + list ($status, $output) = $this->composerUpdate(true); + if ($status !== 0) { + $this->errorString = "Error executing 'composer update --dry-run'. Please verify that the command succeeds locally and then try again. Status Code: $status, Output: $output"; + return self::CHECKING_REQUIREMENTS; + } else { + if (!contains($output, "Nothing to modify in lock file") + || !contains($output, "Nothing to install, update or remove")) { + return self::INSTALL_DEPENDENCIES; + } + } + } + $user = $this->getDocument()->getUser(); $config = $user->getConfiguration(); @@ -163,6 +208,11 @@ namespace Documents\Install { return $step; } + private function command_exist(string $cmd): bool { + $return = shell_exec(sprintf("which %s 2>/dev/null", escapeshellarg($cmd))); + return !empty($return); + } + private function checkRequirements(): array { $msg = $this->errorString; @@ -184,11 +234,21 @@ namespace Documents\Install { } } + if (!function_exists("yaml_emit")) { + $failedRequirements[] = "YAML extension is not installed."; + $success = false; + } + if (version_compare(PHP_VERSION, '7.4', '<')) { $failedRequirements[] = "PHP Version >= 7.4 is required. Got: " . PHP_VERSION . ""; $success = false; } + if (!$this->command_exist("composer")) { + $failedRequirements[] = "Composer is not installed or cannot be found."; + $success = false; + } + if (!$success) { $msg = "The following requirements failed the check:
" . $this->createUnorderedList($failedRequirements); @@ -198,6 +258,11 @@ namespace Documents\Install { return array("success" => $success, "msg" => $msg); } + private function installDependencies(): array { + list ($status, $output) = $this->composerUpdate(); + return ["success" => $status === 0, "msg" => $output]; + } + private function databaseConfiguration(): array { $host = $this->getParameter("host"); @@ -206,22 +271,21 @@ namespace Documents\Install { $password = $this->getParameter("password"); $database = $this->getParameter("database"); $type = $this->getParameter("type"); - $encoding = $this->getParameter("encoding"); - $encoding = ($encoding ? $encoding : "UTF-8"); + $encoding = $this->getParameter("encoding") ?? "UTF8"; $success = true; $missingInputs = array(); - if (is_null($host) || empty($host)) { + if (empty($host)) { $success = false; $missingInputs[] = "Host"; } - if (is_null($port) || empty($port)) { + if (empty($port)) { $success = false; $missingInputs[] = "Port"; } - if (is_null($username) || empty($username)) { + if (empty($username)) { $success = false; $missingInputs[] = "Username"; } @@ -231,12 +295,12 @@ namespace Documents\Install { $missingInputs[] = "Password"; } - if (is_null($database) || empty($database)) { + if (empty($database)) { $success = false; $missingInputs[] = "Database"; } - if (is_null($type) || empty($type)) { + if (empty($type)) { $success = false; $missingInputs[] = "Type"; } @@ -323,17 +387,17 @@ namespace Documents\Install { $success = true; $missingInputs = array(); - if (is_null($username) || empty($username)) { + if (empty($username)) { $success = false; $missingInputs[] = "Username"; } - if (is_null($password) || empty($password)) { + if (empty($password)) { $success = false; $missingInputs[] = "Password"; } - if (is_null($confirmPassword) || empty($confirmPassword)) { + if (empty($confirmPassword)) { $success = false; $missingInputs[] = "Confirm Password"; } @@ -465,6 +529,9 @@ namespace Documents\Install { case self::CHECKING_REQUIREMENTS: return $this->checkRequirements(); + case self::INSTALL_DEPENDENCIES: + return $this->installDependencies(); + case self::DATABASE_CONFIGURATION: return $this->databaseConfiguration(); @@ -612,6 +679,10 @@ namespace Documents\Install { "title" => "Application Requirements", "progressText" => "Checking requirements, please wait a moment…" ), + self::INSTALL_DEPENDENCIES => array( + "title" => "Installing Dependencies", + "progressText" => "Please wait while required dependencies are being installed…", + ), self::DATABASE_CONFIGURATION => array( "title" => "Database configuration", "form" => array( @@ -690,7 +761,9 @@ namespace Documents\Install { if (isset($currentView["progressText"])) { $progressText = $currentView["progressText"]; - $html .= "
$progressText$spinnerIcon
"; + $hidden = (!in_array($this->currentStep, [self::CHECKING_REQUIREMENTS, self::INSTALL_DEPENDENCIES])) + ? " hidden" : ""; + $html .= "
$progressText$spinnerIcon
"; } if (isset($currentView["form"])) { @@ -709,8 +782,7 @@ namespace Documents\Install { } } - $html .= " - "; + $html .= ""; } $buttons = array( @@ -718,8 +790,8 @@ namespace Documents\Install { ); if ($this->currentStep != self::FINISH_INSTALLATION) { - if ($this->currentStep == self::CHECKING_REQUIREMENTS) { - $buttons[] = array("title" => "Retry", "type" => "success", "id" => "btnRetry", "float" => "right"); + if (in_array($this->currentStep, [self::CHECKING_REQUIREMENTS, self::INSTALL_DEPENDENCIES])) { + $buttons[] = array("title" => "Retry", "type" => "success", "id" => "btnRetry", "float" => "right", "hidden" => true); } else { $buttons[] = array("title" => "Submit", "type" => "success", "id" => "btnSubmit", "float" => "right"); } @@ -740,7 +812,8 @@ namespace Documents\Install { $id = $button["id"]; $float = $button["float"]; $disabled = (isset($button["disabled"]) && $button["disabled"]) ? " disabled" : ""; - $button = ""; + $hidden = (isset($button["hidden"]) && $button["hidden"]) ? " hidden" : ""; + $button = ""; if ($float === "left") { $buttonsLeft .= $button; @@ -766,6 +839,10 @@ namespace Documents\Install { "title" => "Checking requirements", "status" => self::ERROR ), + self::INSTALL_DEPENDENCIES => array( + "title" => "Install dependencies", + "status" => self::NOT_STARTED + ), self::DATABASE_CONFIGURATION => array( "title" => "Database configuration", "status" => self::NOT_STARTED @@ -797,7 +874,11 @@ namespace Documents\Install { // POST if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $response = $this->performStep(); + if (!isset($_REQUEST['status'])) { + $response = $this->performStep(); + } else { + $response = ["error" => $this->errorString]; + } $response["step"] = $this->currentStep; die(json_encode($response)); } diff --git a/core/Driver/SQL/MySQL.class.php b/core/Driver/SQL/MySQL.class.php index fc3a6a2..4872111 100644 --- a/core/Driver/SQL/MySQL.class.php +++ b/core/Driver/SQL/MySQL.class.php @@ -86,7 +86,7 @@ class MySQL extends SQL { return $lastError; } - private function getPreparedParams($values) { + private function getPreparedParams($values): array { $sqlParams = array(''); foreach($values as $value) { $paramType = Parameter::parseType($value); @@ -138,48 +138,54 @@ class MySQL extends SQL { $resultRows = array(); $this->lastError = ""; + $stmt = null; + $res = null; + $success = false; - if (is_null($values) || empty($values)) { - $res = mysqli_query($this->connection, $query); - $success = $res !== FALSE; - if ($success && $returnValues) { - while($row = $res->fetch_assoc()) { - $resultRows[] = $row; + try { + if (empty($values)) { + $res = mysqli_query($this->connection, $query); + $success = $res !== FALSE; + if ($success && $returnValues) { + while ($row = $res->fetch_assoc()) { + $resultRows[] = $row; + } } - $res->close(); - } - } else if($stmt = $this->connection->prepare($query)) { + } else if ($stmt = $this->connection->prepare($query)) { - $success = false; - $sqlParams = $this->getPreparedParams($values); - $tmp = array(); - foreach($sqlParams as $key => $value) $tmp[$key] = &$sqlParams[$key]; - if(call_user_func_array(array($stmt, "bind_param"), $tmp)) { - if($stmt->execute()) { - if ($returnValues) { - $res = $stmt->get_result(); - if($res) { - while($row = $res->fetch_assoc()) { - $resultRows[] = $row; + $sqlParams = $this->getPreparedParams($values); + if ($stmt->bind_param(...$sqlParams)) { + if ($stmt->execute()) { + if ($returnValues) { + $res = $stmt->get_result(); + if ($res) { + while ($row = $res->fetch_assoc()) { + $resultRows[] = $row; + } + $success = true; + } else { + $this->lastError = "PreparedStatement::get_result failed: $stmt->error ($stmt->errno)"; } - $res->close(); - $success = true; } else { - $this->lastError = "PreparedStatement::get_result failed: $stmt->error ($stmt->errno)"; + $success = true; } } else { - $success = true; + $this->lastError = "PreparedStatement::execute failed: $stmt->error ($stmt->errno)"; } } else { - $this->lastError = "PreparedStatement::execute failed: $stmt->error ($stmt->errno)"; + $this->lastError = "PreparedStatement::prepare failed: $stmt->error ($stmt->errno)"; } - } else { - $this->lastError = "PreparedStatement::prepare failed: $stmt->error ($stmt->errno)"; + } + } catch (\mysqli_sql_exception $exception) { + $this->lastError = "MySQL::execute failed: $stmt->error ($stmt->errno)"; + } finally { + if ($res !== null && !is_bool($res)) { + $res->close(); } - $stmt->close(); - } else { - $success = false; + if ($stmt !== null && !is_bool($stmt)) { + $stmt->close(); + } } return ($success && $returnValues) ? $resultRows : $success; @@ -195,7 +201,7 @@ class MySQL extends SQL { if ($value instanceof Column) { $columnName = $this->columnName($value->getName()); $updateValues[] = "$leftColumn=VALUES($columnName)"; - } else if($value instanceof Add) { + } else if ($value instanceof Add) { $columnName = $this->columnName($value->getColumn()); $operator = $value->getOperator(); $value = $value->getValue(); diff --git a/core/External/.htaccess b/core/External/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/core/External/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/core/External/composer.lock b/core/External/composer.lock index 5dfb617..3439192 100644 --- a/core/External/composer.lock +++ b/core/External/composer.lock @@ -4,25 +4,664 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4b2f957dbfdda946d9f57c693ac1809a", + "content-hash": "87a2e9cab051caf2f9ae6d46668f0886", "packages": [ { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "name": "beberlei/assert", + "version": "v3.3.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "url": "https://github.com/beberlei/assert.git", + "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655", + "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "*", + "phpstan/phpstan": "*", + "phpunit/phpunit": ">=6.0.0", + "yoast/phpunit-polyfills": "^0.1.0" + }, + "suggest": { + "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Assert/functions.php" + ], + "psr-4": { + "Assert\\": "lib/Assert" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de", + "role": "Lead Developer" + }, + { + "name": "Richard Quadling", + "email": "rquadling@gmail.com", + "role": "Collaborator" + } + ], + "description": "Thin assertion library for input validation in business models.", + "keywords": [ + "assert", + "assertion", + "validation" + ], + "support": { + "issues": "https://github.com/beberlei/assert/issues", + "source": "https://github.com/beberlei/assert/tree/v3.3.2" + }, + "time": "2021-12-16T21:41:27+00:00" + }, + { + "name": "brick/math", + "version": "0.9.3", + "source": { + "type": "git", + "url": "https://github.com/brick/math.git", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", + "vimeo/psalm": "4.9.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Arbitrary-precision arithmetic library", + "keywords": [ + "Arbitrary-precision", + "BigInteger", + "BigRational", + "arithmetic", + "bigdecimal", + "bignum", + "brick", + "math" + ], + "support": { + "issues": "https://github.com/brick/math/issues", + "source": "https://github.com/brick/math/tree/0.9.3" + }, + "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/brick/math", + "type": "tidelift" + } + ], + "time": "2021-08-15T20:50:18+00:00" + }, + { + "name": "chillerlan/php-qrcode", + "version": "4.3.2", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "b625396e0752d79747a55205ae7e191eeb459dcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/b625396e0752d79747a55205ae7e191eeb459dcd", + "reference": "b625396e0752d79747a55205ae7e191eeb459dcd", + "shasum": "" + }, + "require": { + "chillerlan/php-settings-container": "^2.1", + "ext-mbstring": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage": "https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "description": "A QR code generator. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "phpqrcode", + "qr", + "qr code", + "qrcode", + "qrcode-generator" + ], + "support": { + "issues": "https://github.com/chillerlan/php-qrcode/issues", + "source": "https://github.com/chillerlan/php-qrcode/tree/4.3.2" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2021-11-18T08:46:03+00:00" + }, + { + "name": "chillerlan/php-settings-container", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-settings-container.git", + "reference": "ec834493a88682dd69652a1eeaf462789ed0c5f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/ec834493a88682dd69652a1eeaf462789ed0c5f5", + "reference": "ec834493a88682dd69652a1eeaf462789ed0c5f5", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^4.0", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Settings\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A container class for immutable settings objects. Not a DI container. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-settings-container", + "keywords": [ + "PHP7", + "Settings", + "container", + "helper" + ], + "support": { + "issues": "https://github.com/chillerlan/php-settings-container/issues", + "source": "https://github.com/chillerlan/php-settings-container" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2021-09-06T15:17:01+00:00" + }, + { + "name": "christian-riesen/base32", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/ChristianRiesen/base32.git", + "reference": "2e82dab3baa008e24a505649b0d583c31d31e894" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/2e82dab3baa008e24a505649b0d583c31d31e894", + "reference": "2e82dab3baa008e24a505649b0d583c31d31e894", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.17", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^8.5.13 || ^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Base32\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Riesen", + "email": "chris.riesen@gmail.com", + "homepage": "http://christianriesen.com", + "role": "Developer" + } + ], + "description": "Base32 encoder/decoder according to RFC 4648", + "homepage": "https://github.com/ChristianRiesen/base32", + "keywords": [ + "base32", + "decode", + "encode", + "rfc4648" + ], + "support": { + "issues": "https://github.com/ChristianRiesen/base32/issues", + "source": "https://github.com/ChristianRiesen/base32/tree/1.6.0" + }, + "time": "2021-02-26T10:19:33+00:00" + }, + { + "name": "fgrosse/phpasn1", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/fgrosse/PHPASN1.git", + "reference": "eef488991d53e58e60c9554b09b1201ca5ba9296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/eef488991d53e58e60c9554b09b1201ca5ba9296", + "reference": "eef488991d53e58e60c9554b09b1201ca5ba9296", + "shasum": "" + }, + "require": { + "php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "~2.0", + "phpunit/phpunit": "^6.3 || ^7.0 || ^8.0" + }, + "suggest": { + "ext-bcmath": "BCmath is the fallback extension for big integer calculations", + "ext-curl": "For loading OID information from the web if they have not bee defined statically", + "ext-gmp": "GMP is the preferred extension for big integer calculations", + "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "FG\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Friedrich Große", + "email": "friedrich.grosse@gmail.com", + "homepage": "https://github.com/FGrosse", + "role": "Author" + }, + { + "name": "All contributors", + "homepage": "https://github.com/FGrosse/PHPASN1/contributors" + } + ], + "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", + "homepage": "https://github.com/FGrosse/PHPASN1", + "keywords": [ + "DER", + "asn.1", + "asn1", + "ber", + "binary", + "decoding", + "encoding", + "x.509", + "x.690", + "x509", + "x690" + ], + "support": { + "issues": "https://github.com/fgrosse/PHPASN1/issues", + "source": "https://github.com/fgrosse/PHPASN1/tree/v2.4.0" + }, + "time": "2021-12-11T12:41:06+00:00" + }, + { + "name": "myclabs/php-enum", + "version": "1.8.3", + "source": { + "type": "git", + "url": "https://github.com/myclabs/php-enum.git", + "reference": "b942d263c641ddb5190929ff840c68f78713e937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937", + "reference": "b942d263c641ddb5190929ff840c68f78713e937", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "1.*", + "vimeo/psalm": "^4.6.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "MyCLabs\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP Enum contributors", + "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" + } + ], + "description": "PHP Enum implementation", + "homepage": "http://github.com/myclabs/php-enum", + "keywords": [ + "enum" + ], + "support": { + "issues": "https://github.com/myclabs/php-enum/issues", + "source": "https://github.com/myclabs/php-enum/tree/1.8.3" + }, + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum", + "type": "tidelift" + } + ], + "time": "2021-07-05T08:18:36+00:00" + }, + { + "name": "php-mqtt/client", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/php-mqtt/client.git", + "reference": "0a0b2ed1946d466245cfc1ce78b2b8392e160bee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-mqtt/client/zipball/0a0b2ed1946d466245cfc1ce78b2b8392e160bee", + "reference": "0a0b2ed1946d466245cfc1ce78b2b8392e160bee", + "shasum": "" + }, + "require": { + "myclabs/php-enum": "^1.7", + "php": "^7.4|^8.0", + "psr/log": "^1.1|^2.0|^3.0" + }, + "require-dev": { + "phpunit/php-invoker": "^3.0", + "phpunit/phpunit": "^9.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-redis": "Required for the RedisRepository" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpMqtt\\Client\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marvin Mall", + "email": "marvin-mall@msn.com", + "role": "developer" + } + ], + "description": "An MQTT client written in and for PHP.", + "keywords": [ + "client", + "mqtt", + "publish", + "subscribe" + ], + "support": { + "issues": "https://github.com/php-mqtt/client/issues", + "source": "https://github.com/php-mqtt/client/tree/v1.1.3" + }, + "time": "2022-02-15T19:47:14+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "spomky-labs/cbor-php", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/Spomky-Labs/cbor-php.git", + "reference": "9776578000be884cd7864eeb7c37a4ac92d8c995" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Spomky-Labs/cbor-php/zipball/9776578000be884cd7864eeb7c37a4ac92d8c995", + "reference": "9776578000be884cd7864eeb7c37a4ac92d8c995", + "shasum": "" + }, + "require": { + "brick/math": "^0.8.15|^0.9.0", + "php": ">=7.3" + }, + "require-dev": { + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-beberlei-assert": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12" + }, + "suggest": { + "ext-bcmath": "GMP or BCMath extensions will drastically improve the library performance. BCMath extension needed to handle the Big Float and Decimal Fraction Tags", + "ext-gmp": "GMP or BCMath extensions will drastically improve the library performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "CBOR\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Florent Morselli", + "homepage": "https://github.com/Spomky" + }, + { + "name": "All contributors", + "homepage": "https://github.com/Spomky-Labs/cbor-php/contributors" + } + ], + "description": "CBOR Encoder/Decoder for PHP", + "keywords": [ + "Concise Binary Object Representation", + "RFC7049", + "cbor" + ], + "support": { + "issues": "https://github.com/Spomky-Labs/cbor-php/issues", + "source": "https://github.com/Spomky-Labs/cbor-php/tree/v2.0.1" + }, + "funding": [ + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2020-08-31T20:08:03+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -67,7 +706,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -83,25 +722,28 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -116,12 +758,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -147,7 +789,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" }, "funding": [ { @@ -163,20 +805,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "twig/twig", - "version": "v3.3.4", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "65cb6f0b956485e1664f13d023c55298a4bb59ca" + "reference": "972d8604a92b7054828b539f2febb0211dd5945c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/65cb6f0b956485e1664f13d023c55298a4bb59ca", - "reference": "65cb6f0b956485e1664f13d023c55298a4bb59ca", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", + "reference": "972d8604a92b7054828b539f2febb0211dd5945c", "shasum": "" }, "require": { @@ -227,7 +869,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.3.4" + "source": "https://github.com/twigphp/Twig/tree/v3.3.8" }, "funding": [ { @@ -239,7 +881,70 @@ "type": "tidelift" } ], - "time": "2021-11-25T13:46:55+00:00" + "time": "2022-02-04T06:59:48+00:00" + }, + { + "name": "web-auth/cose-lib", + "version": "v3.3.11", + "source": { + "type": "git", + "url": "https://github.com/web-auth/cose-lib.git", + "reference": "efa6ec2ba4e840bc1316a493973c9916028afeeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/efa6ec2ba4e840bc1316a493973c9916028afeeb", + "reference": "efa6ec2ba4e840bc1316a493973c9916028afeeb", + "shasum": "" + }, + "require": { + "beberlei/assert": "^3.2", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "fgrosse/phpasn1": "^2.1", + "php": ">=7.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cose\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Florent Morselli", + "homepage": "https://github.com/Spomky" + }, + { + "name": "All contributors", + "homepage": "https://github.com/web-auth/cose/contributors" + } + ], + "description": "CBOR Object Signing and Encryption (COSE) For PHP", + "homepage": "https://github.com/web-auth", + "keywords": [ + "COSE", + "RFC8152" + ], + "support": { + "source": "https://github.com/web-auth/cose-lib/tree/v3.3.11" + }, + "funding": [ + { + "url": "https://github.com/Spomky", + "type": "github" + }, + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2021-12-04T12:13:35+00:00" } ], "packages-dev": [ @@ -329,9 +1034,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -339,12 +1041,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -488,16 +1190,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "15a90844ad40f127afd244c0cad228de2a80052a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a", + "reference": "15a90844ad40f127afd244c0cad228de2a80052a", "shasum": "" }, "require": { @@ -533,9 +1235,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.1.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-07T21:56:48+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -649,16 +1351,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -693,9 +1395,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", @@ -766,16 +1468,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/665a1ac0a763c51afc30d6d130dac0813092b17f", + "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f", "shasum": "" }, "require": { @@ -831,7 +1533,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.11" }, "funding": [ { @@ -839,7 +1541,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-02-18T12:46:09+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1084,16 +1786,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "1883687169c017d6ae37c58883ca3994cfc34189" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1883687169c017d6ae37c58883ca3994cfc34189", + "reference": "1883687169c017d6ae37c58883ca3994cfc34189", "shasum": "" }, "require": { @@ -1144,11 +1846,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1171,11 +1873,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.14" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -1183,7 +1885,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2022-02-18T12:54:07+00:00" }, { "name": "sebastian/cli-parser", @@ -1691,16 +2393,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -1743,7 +2445,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -1751,7 +2453,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -2265,5 +2967,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/core/Templates/base.html b/core/Templates/base.html deleted file mode 100644 index 2f188a0..0000000 --- a/core/Templates/base.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - {% block head %} - {{ site.title }} - {% endblock %} - - - {% block body %} - {% endblock %} - - \ No newline at end of file diff --git a/core/Templates/swagger.twig b/core/Templates/swagger.twig index 85d857d..294ae5a 100644 --- a/core/Templates/swagger.twig +++ b/core/Templates/swagger.twig @@ -41,13 +41,13 @@ SwaggerUIBundle.plugins.DownloadUrl ], layout: "StandaloneLayout", - {% if user.loggedIn %} + {% if user.loggedIn %} requestInterceptor: request => { request.headers['XSRF-Token'] = '{{ user.session.csrfToken }}'; return request; } + {% endif %} }); - {% endif %} }; diff --git a/core/core.php b/core/core.php index b0bb02f..2c39fc4 100644 --- a/core/core.php +++ b/core/core.php @@ -1,8 +1,11 @@ restarting the process."); + statusBox.html("An error occurred during installation. Try restarting the process."); statusBox.show(); }).always(function() { if(done) done(success); @@ -69,14 +81,34 @@ function sendRequest(params, done) { } function retry() { + let progressText = $("#progressText"); + let wasHidden = progressText.hasClass("hidden"); $("#btnRetry").hide(); - $("#progressText").show(); + progressText.removeClass("hidden"); sendRequest({ }, function(success) { - $("#progressText").hide(); - if(!success) $("#btnRetry").show(); + if (wasHidden) { + $("#progressText").addClass("hidden"); + } + if(!success) { + $("#btnRetry").show(); + } }); } +function waitForStatusChange() { + setTimeout(() => { + requestCurrentStep((step) => { + if (currentState === PENDING) { + if (step !== 2 || step == null) { + document.location.reload(); + } else { + waitForStatusChange(); + } + } + }) + }, 2500); +} + $(document).ready(function() { $("#btnSubmit").click(function() { @@ -101,7 +133,7 @@ $(document).ready(function() { submitButton.prop("disabled",false); submitButton.text(textBefore); } else { - setState(SUCCESFULL); + setState(SUCCESSFUL); } }); }); @@ -160,4 +192,11 @@ $(document).ready(function() { typeField.change(function() { updateDefaultPort(); }); + + // INSTALL_DEPENDENCIES ? + if (getCurrentStep() === 2) { + sendRequest({}, () => { + waitForStatusChange(); + }); + } });