diff --git a/core/Documents/Install.class.php b/core/Documents/Install.class.php
index 583990d..45a5480 100644
--- a/core/Documents/Install.class.php
+++ b/core/Documents/Install.class.php
@@ -104,8 +104,8 @@ namespace Documents\Install {
return NULL;
}
- private function composerUpdate(bool $dryRun = false): array {
- $command = "composer update";
+ private function composerInstall(bool $dryRun = false): array {
+ $command = "composer install";
if ($dryRun) {
$command .= " --dry-run";
}
@@ -127,8 +127,12 @@ namespace Documents\Install {
return [$status, $output];
}
- private function getExternalDirectory(): string {
- return implode(DIRECTORY_SEPARATOR, [WEBROOT, "core", "External"]);;
+ private function getExternalDirectory(bool $absolute = true): string {
+ if ($absolute) {
+ return implode(DIRECTORY_SEPARATOR, [WEBROOT, "core", "External"]);;
+ } else {
+ return implode(DIRECTORY_SEPARATOR, ["core", "External"]);
+ }
}
private function getCurrentStep(): int {
@@ -138,17 +142,16 @@ namespace Documents\Install {
}
$externalDir = $this->getExternalDirectory();
- $vendorDir = $externalDir . DIRECTORY_SEPARATOR . "vendor";
- if (!is_dir($vendorDir)) {
+ $autoload = implode(DIRECTORY_SEPARATOR, [$externalDir, "vendor", "autoload.php"]);
+ if (!is_file($autoload)) {
return self::INSTALL_DEPENDENCIES;
} else {
- list ($status, $output) = $this->composerUpdate(true);
+ list ($status, $output) = $this->composerInstall(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";
+ $this->errorString = "Error executing 'composer install --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")) {
+ if (!contains($output, "Nothing to install, update or remove")) {
return self::INSTALL_DEPENDENCIES;
}
}
@@ -219,17 +222,19 @@ namespace Documents\Install {
$success = true;
$failedRequirements = array();
- $configDir = "core/Configuration/";
- if (!is_writeable($configDir)) {
- $failedRequirements[] = "$configDir is not writeable. Try running chmod 700 $configDir";
+ if (!is_writeable(WEBROOT)) {
+ $failedRequirements[] = sprintf("%s is not writeable. Try running chmod 700 %s", WEBROOT, WEBROOT);
$success = false;
}
if (function_exists("posix_getuid")) {
$userId = posix_getuid();
- if (fileowner($configDir) !== $userId) {
+ if (fileowner(WEBROOT) !== $userId) {
$username = posix_getpwuid($userId)['name'];
- $failedRequirements[] = "$configDir is not owned by current user: $username ($userId). Try running chown -R $username $configDir";
+ $failedRequirements[] = sprintf("%s is not owned by current user: $username ($userId). " .
+ "Try running chown -R $userId %s or give the required directories write permissions: " .
+ "core/Configuration, core/TemplateCache, core/External",
+ WEBROOT, WEBROOT);
$success = false;
}
}
@@ -259,7 +264,7 @@ namespace Documents\Install {
}
private function installDependencies(): array {
- list ($status, $output) = $this->composerUpdate();
+ list ($status, $output) = $this->composerInstall();
return ["success" => $status === 0, "msg" => $output];
}
diff --git a/core/External/composer.lock b/core/External/composer.lock
index 3439192..7ecf941 100644
--- a/core/External/composer.lock
+++ b/core/External/composer.lock
@@ -527,30 +527,30 @@
},
{
"name": "psr/log",
- "version": "3.0.0",
+ "version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
- "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
},
"require": {
- "php": ">=8.0.0"
+ "php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.x-dev"
+ "dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
- "Psr\\Log\\": "src"
+ "Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -571,9 +571,9 @@
"psr-3"
],
"support": {
- "source": "https://github.com/php-fig/log/tree/3.0.0"
+ "source": "https://github.com/php-fig/log/tree/1.1.4"
},
- "time": "2021-07-14T16:46:02+00:00"
+ "time": "2021-05-03T11:20:27+00:00"
},
{
"name": "spomky-labs/cbor-php",
diff --git a/core/core.php b/core/core.php
index 2c39fc4..c8c99e5 100644
--- a/core/core.php
+++ b/core/core.php
@@ -1,11 +1,11 @@
/usr/local/etc/php/conf.d/ext-yaml.ini && \
+ docker-php-ext-enable yaml
+RUN docker-php-ext-install mysqli zip
+COPY --from=composer /usr/bin/composer /usr/bin/composer
USER www-data
\ No newline at end of file