diff --git a/Core/Objects/DatabaseEntity/Controller/DatabaseEntity.class.php b/Core/Objects/DatabaseEntity/Controller/DatabaseEntity.class.php index 4a40ad2..a726a81 100644 --- a/Core/Objects/DatabaseEntity/Controller/DatabaseEntity.class.php +++ b/Core/Objects/DatabaseEntity/Controller/DatabaseEntity.class.php @@ -125,6 +125,7 @@ abstract class DatabaseEntity implements ArrayAccess, JsonSerializable { public function preInsert(array &$row) { } public function postFetch(SQL $sql, array $row) { } public static function getPredefinedValues(): array { return []; } + public function postDelete() { } public static function fromRow(SQL $sql, array $row): static { $handler = self::getHandler($sql); @@ -207,6 +208,7 @@ abstract class DatabaseEntity implements ArrayAccess, JsonSerializable { } if ($handler->delete($this->id)) { + $this->postDelete(); $this->id = null; return true; } diff --git a/Core/core.php b/Core/core.php index 62bf7b4..6bd7886 100644 --- a/Core/core.php +++ b/Core/core.php @@ -284,4 +284,21 @@ function parseClass($class): string { function isClass(string $str): bool { $path = getClassPath($str); return is_file($path) && class_exists($str); +} + +function rrmdir(string $dir): void { + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object !== "." && $object !== "..") { + $path = $dir . DIRECTORY_SEPARATOR . $object; + if (is_dir($path) && !is_link($path)) { + rrmdir($path); + } else { + unlink($path); + } + } + } + rmdir($dir); + } } \ No newline at end of file diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 460a438..7d395b9 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -11,8 +11,8 @@ RUN mkdir -p /application/core/Configuration /var/www/.gnupg && \ # YAML + dev dependencies + additional packages RUN apt-get update -y && \ - apt-get install -y libyaml-dev libzip-dev libgmp-dev libpng-dev gnupg2 $ADDITIONAL_PACKAGES && \ - pecl install yaml && docker-php-ext-enable yaml && \ + apt-get install -y libyaml-dev libzip-dev libgmp-dev libpng-dev libmagickwand-dev gnupg2 $ADDITIONAL_PACKAGES && \ + printf "\n" | pecl install yaml imagick && docker-php-ext-enable yaml imagick && \ docker-php-ext-install gd # NodeJS diff --git a/img/.gitignore b/img/.gitignore new file mode 100644 index 0000000..8fc0d80 --- /dev/null +++ b/img/.gitignore @@ -0,0 +1 @@ +uploads/