From 43b200139173a83177506db316cbd6344478bf19 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Fri, 31 Jan 2025 10:57:48 +0100 Subject: [PATCH] stuff --- config/docker-files/7.2-Dockerfile | 5 +---- config/docker-files/7.3-Dockerfile | 4 ---- config/docker-files/7.4-Dockerfile | 4 ---- config/docker-files/8.0-Dockerfile | 6 +----- config/docker-files/8.1-Dockerfile | 4 ---- config/docker-files/8.2-Dockerfile | 4 ---- config/docker-files/8.3-Dockerfile | 4 ---- config/docker-files/8.4-Dockerfile | 4 ---- lib/Commands/Sites/Add.php | 4 ++++ lib/Commands/Sites/Remove.php | 7 ++++++- 10 files changed, 12 insertions(+), 34 deletions(-) diff --git a/config/docker-files/7.2-Dockerfile b/config/docker-files/7.2-Dockerfile index 18405ca..ad0a534 100644 --- a/config/docker-files/7.2-Dockerfile +++ b/config/docker-files/7.2-Dockerfile @@ -24,21 +24,18 @@ RUN apt update && apt install -y --no-install-recommends \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup RUN docker-php-source delete \ && apt-get autoremove --purge -y \ && apt-get autoclean -y \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/7.3-Dockerfile b/config/docker-files/7.3-Dockerfile index 91cd748..543aeeb 100644 --- a/config/docker-files/7.3-Dockerfile +++ b/config/docker-files/7.3-Dockerfile @@ -19,19 +19,16 @@ RUN apt update && apt install -y --no-install-recommends \ libxml2-dev \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ locales \ - # Install locales RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup RUN docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -39,7 +36,6 @@ RUN docker-php-source delete \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs RUN sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/7.4-Dockerfile b/config/docker-files/7.4-Dockerfile index 13a1619..58aa991 100644 --- a/config/docker-files/7.4-Dockerfile +++ b/config/docker-files/7.4-Dockerfile @@ -19,19 +19,16 @@ RUN apt update && apt install -y --no-install-recommends \ libxml2-dev \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ locales \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup && docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -39,7 +36,6 @@ RUN apt update && apt install -y --no-install-recommends \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs RUN sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/8.0-Dockerfile b/config/docker-files/8.0-Dockerfile index 689d852..0ee1396 100644 --- a/config/docker-files/8.0-Dockerfile +++ b/config/docker-files/8.0-Dockerfile @@ -19,27 +19,23 @@ RUN apt update && apt install -y --no-install-recommends \ libxml2-dev \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ locales \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup - && docker-php-source delete + && docker-php-source delete \ && apt-get autoremove --purge -y \ && apt-get autoclean -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/8.1-Dockerfile b/config/docker-files/8.1-Dockerfile index f131e36..677597d 100644 --- a/config/docker-files/8.1-Dockerfile +++ b/config/docker-files/8.1-Dockerfile @@ -20,19 +20,16 @@ RUN apt update && apt install -y --no-install-recommends \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ locales \ vim \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup && docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -40,7 +37,6 @@ RUN apt update && apt install -y --no-install-recommends \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/8.2-Dockerfile b/config/docker-files/8.2-Dockerfile index 423e804..efeea3c 100644 --- a/config/docker-files/8.2-Dockerfile +++ b/config/docker-files/8.2-Dockerfile @@ -19,19 +19,16 @@ RUN apt update && apt install -y --no-install-recommends \ libxml2-dev \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ locales \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup && docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -39,7 +36,6 @@ RUN apt update && apt install -y --no-install-recommends \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/8.3-Dockerfile b/config/docker-files/8.3-Dockerfile index 60e0c0c..639668a 100644 --- a/config/docker-files/8.3-Dockerfile +++ b/config/docker-files/8.3-Dockerfile @@ -21,19 +21,16 @@ RUN apt update \ libxml2-dev \ locales \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup && docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -41,7 +38,6 @@ RUN apt update \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs \ && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/config/docker-files/8.4-Dockerfile b/config/docker-files/8.4-Dockerfile index 43d30d2..518d45c 100644 --- a/config/docker-files/8.4-Dockerfile +++ b/config/docker-files/8.4-Dockerfile @@ -22,13 +22,11 @@ RUN apt update \ libxml2-dev \ locales \ libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ - # Install locales && sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \ && sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale \ - # Install php extensions && docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \ && docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip \ @@ -36,7 +34,6 @@ RUN apt update \ # && docker-php-ext-enable memcached redis xdebug \ && pecl install memcached redis \ && docker-php-ext-enable memcached redis \ - # Cleanup && docker-php-source delete \ && apt-get autoremove --purge -y \ @@ -44,7 +41,6 @@ RUN apt update \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ && pecl clear-cache \ - # Enable PS in gs && sed -r -i_bak 's/rights="none" pattern="([EX]?PS[23]*|PDF)"/rights="read | write" pattern="\1"/' \ /etc/ImageMagick-6/policy.xml diff --git a/lib/Commands/Sites/Add.php b/lib/Commands/Sites/Add.php index 0bbd870..f601a6c 100644 --- a/lib/Commands/Sites/Add.php +++ b/lib/Commands/Sites/Add.php @@ -57,6 +57,10 @@ final class Add extends Command throw new Exception('Web path cannot be empty'); } + if ($webPath === 'sites') { + throw new Exception("Web path 'sites' is prohibited"); + } + if (array_key_exists($webPath, Config::getInstance()->get('sites') ?? [])) { throw new Exception('Site "' . $webPath . '" already exists.'); } diff --git a/lib/Commands/Sites/Remove.php b/lib/Commands/Sites/Remove.php index c435b62..ab2f409 100644 --- a/lib/Commands/Sites/Remove.php +++ b/lib/Commands/Sites/Remove.php @@ -2,6 +2,7 @@ namespace Studip\Dockerized\Commands\Sites; +use Exception; use Studip\Dockerized\Config; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -27,6 +28,10 @@ final class Remove extends Command $config = Config::getInstance(); $sites = $config->get('sites') ?? []; + if ($webPath === 'sites') { + throw new Exception("Web path 'sites' is prohibited"); + } + if (!array_key_exists($webPath, $sites)) { $io->error("The site '{$webPath}' does not exist."); return Command::FAILURE; @@ -42,7 +47,7 @@ final class Remove extends Command $config->store(); - $io->success('Site ' . $webPath . ' has been removed.'); + $io->success("Site '{$webPath}' has been removed."); return Command::SUCCESS; } -- GitLab