Core/(Logs|Cache) -> Site

This commit is contained in:
Roman 2022-12-04 13:21:40 +01:00
parent b1059717c7
commit 87f7b44010
12 changed files with 11 additions and 15 deletions

@ -83,7 +83,7 @@ namespace Core\API\Logs {
} }
// get all log entries from filesystem (if database failed) // get all log entries from filesystem (if database failed)
$logPath = realpath(implode(DIRECTORY_SEPARATOR, [WEBROOT, "Core", "Logs"])); $logPath = realpath(implode(DIRECTORY_SEPARATOR, [WEBROOT, "Site", "Logs"]));
if ($logPath) { if ($logPath) {
$index = 1; $index = 1;
foreach (scandir($logPath) as $fileName) { foreach (scandir($logPath) as $fileName) {

@ -8,7 +8,7 @@ namespace Core\API {
abstract class RoutesAPI extends Request { abstract class RoutesAPI extends Request {
const ROUTER_CACHE_CLASS = "\\Core\\Cache\\RouterCache"; const ROUTER_CACHE_CLASS = "\\Site\\Cache\\RouterCache";
protected string $routerCachePath; protected string $routerCachePath;

@ -45,7 +45,7 @@ namespace Core\API\Template {
return $this->createError("Invalid template file extension. Allowed: " . implode(",", $allowedExtensions)); return $this->createError("Invalid template file extension. Allowed: " . implode(",", $allowedExtensions));
} }
$templateCache = WEBROOT . "/Core/Cache/Templates/"; $templateCache = WEBROOT . "/Site/Cache/Templates/";
$baseDirs = ["Site", "Core"]; $baseDirs = ["Site", "Core"];
$valid = false; $valid = false;

@ -1,3 +0,0 @@
*
!.gitkeep
!.gitignore

@ -250,7 +250,7 @@ namespace Documents\Install {
$username = posix_getpwuid($userId)['name']; $username = posix_getpwuid($userId)['name'];
$failedRequirements[] = sprintf("<b>%s</b> is not owned by current user: $username ($userId). " . $failedRequirements[] = sprintf("<b>%s</b> is not owned by current user: $username ($userId). " .
"Try running <b>chown -R $userId %s</b> or give the required directories write permissions: " . "Try running <b>chown -R $userId %s</b> or give the required directories write permissions: " .
"<b>Site/Configuration</b>, <b>Core/Cache</b>, <b>Core/External</b>", "<b>Site/Configuration</b>, <b>Site/Cache</b>, <b>Site/Logs</b>, <b>Core/External</b>",
WEBROOT, WEBROOT); WEBROOT, WEBROOT);
$success = false; $success = false;
} }

@ -82,7 +82,7 @@ class Logger {
$module = preg_replace("/[^a-zA-Z0-9-]/", "-", $this->module); $module = preg_replace("/[^a-zA-Z0-9-]/", "-", $this->module);
$date = (\DateTime::createFromFormat('U.u', microtime(true)))->format(self::LOG_FILE_DATE_FORMAT); $date = (\DateTime::createFromFormat('U.u', microtime(true)))->format(self::LOG_FILE_DATE_FORMAT);
$logFile = implode("_", [$module, $severity, $date]) . ".log"; $logFile = implode("_", [$module, $severity, $date]) . ".log";
$logPath = implode(DIRECTORY_SEPARATOR, [WEBROOT, "Core", "Logs", $logFile]); $logPath = implode(DIRECTORY_SEPARATOR, [WEBROOT, "Site", "Logs", $logFile]);
@file_put_contents($logPath, $message); @file_put_contents($logPath, $message);
} }
@ -130,7 +130,7 @@ class Logger {
/** /**
* Calling this method will prevent the logger from persisting log messages (writing to database/file), * Calling this method will prevent the logger from persisting log messages (writing to database/file),
*/ */
public function unitTestMode() { public function unitTestMode(): void {
$this->unitTestMode = true; $this->unitTestMode = true;
} }
} }

@ -31,7 +31,7 @@ class TemplateDocument extends Document {
$this->parameters = $params; $this->parameters = $params;
$this->twigLoader = new FilesystemLoader(self::TEMPLATE_PATH); $this->twigLoader = new FilesystemLoader(self::TEMPLATE_PATH);
$this->twigEnvironment = new Environment($this->twigLoader, [ $this->twigEnvironment = new Environment($this->twigLoader, [
'cache' => WEBROOT . '/Core/Cache/Templates/', 'cache' => WEBROOT . '/Site/Cache/Templates/',
'auto_reload' => true 'auto_reload' => true
]); ]);
$this->twigEnvironment->addExtension(new CustomTwigFunctions()); $this->twigEnvironment->addExtension(new CustomTwigFunctions());

@ -1 +0,0 @@
DENY FROM ALL

@ -113,7 +113,7 @@ class Router {
* This file is automatically generated by the RoutesAPI on $date. * This file is automatically generated by the RoutesAPI on $date.
*/ */
namespace Core\Cache; namespace Site\Cache;
$uses $uses
class RouterCache extends Router { class RouterCache extends Router {

@ -13,8 +13,8 @@ RUN apt-get update -y && \
docker-php-ext-install gd && \ docker-php-ext-install gd && \
npm install --global yarn && ln -s /usr/local/bin/yarn /usr/bin/yarn npm install --global yarn && ln -s /usr/local/bin/yarn /usr/bin/yarn
# Runkit (no stable release available) # Runkit for unit testing (no stable release available)
RUN pecl install runkit7-4.0.0a3 && docker-php-ext-enable runkit7 && \ RUN pecl install runkit7-4.0.0a6 && docker-php-ext-enable runkit7 && \
echo "runkit.internal_override=1" >> /usr/local/etc/php/conf.d/docker-php-ext-runkit7.ini echo "runkit.internal_override=1" >> /usr/local/etc/php/conf.d/docker-php-ext-runkit7.ini
# mysqli, zip, gmp # mysqli, zip, gmp

@ -40,7 +40,7 @@ if ($installation) {
} else { } else {
$router = null; $router = null;
$routerCacheClass = '\Core\Cache\RouterCache'; $routerCacheClass = '\Site\Cache\RouterCache';
$routerCachePath = getClassPath($routerCacheClass); $routerCachePath = getClassPath($routerCacheClass);
if (is_file($routerCachePath)) { if (is_file($routerCachePath)) {
@include_once $routerCachePath; @include_once $routerCachePath;