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)
$logPath = realpath(implode(DIRECTORY_SEPARATOR, [WEBROOT, "Core", "Logs"]));
$logPath = realpath(implode(DIRECTORY_SEPARATOR, [WEBROOT, "Site", "Logs"]));
if ($logPath) {
$index = 1;
foreach (scandir($logPath) as $fileName) {

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

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

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

@ -250,7 +250,7 @@ namespace Documents\Install {
$username = posix_getpwuid($userId)['name'];
$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: " .
"<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);
$success = false;
}

@ -82,7 +82,7 @@ class Logger {
$module = preg_replace("/[^a-zA-Z0-9-]/", "-", $this->module);
$date = (\DateTime::createFromFormat('U.u', microtime(true)))->format(self::LOG_FILE_DATE_FORMAT);
$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);
}
@ -130,7 +130,7 @@ class Logger {
/**
* 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;
}
}

@ -31,7 +31,7 @@ class TemplateDocument extends Document {
$this->parameters = $params;
$this->twigLoader = new FilesystemLoader(self::TEMPLATE_PATH);
$this->twigEnvironment = new Environment($this->twigLoader, [
'cache' => WEBROOT . '/Core/Cache/Templates/',
'cache' => WEBROOT . '/Site/Cache/Templates/',
'auto_reload' => true
]);
$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.
*/
namespace Core\Cache;
namespace Site\Cache;
$uses
class RouterCache extends Router {

@ -13,8 +13,8 @@ RUN apt-get update -y && \
docker-php-ext-install gd && \
npm install --global yarn && ln -s /usr/local/bin/yarn /usr/bin/yarn
# Runkit (no stable release available)
RUN pecl install runkit7-4.0.0a3 && docker-php-ext-enable runkit7 && \
# Runkit for unit testing (no stable release available)
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
# mysqli, zip, gmp

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