]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6168 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 24 Jul 2023 09:42:55 +0000 (11:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 24 Jul 2023 09:42:55 +0000 (11:42 +0200)
.docker/images/php-dev/Dockerfile
.docker/images/php/Dockerfile
app/Console/Kernel.php
app/Jobs/Maintenance/RemoveDuplicates.php [new file with mode: 0644]

index b2c74b1de2d8d08c087f08edb6aa72b6e8344738..3d4bcaa0a2329fd439a8fa1a6a759848a1fa009a 100644 (file)
@@ -69,6 +69,7 @@ RUN apt -y --no-install-recommends install sshfs python3 python3-pip
 RUN apt -y --no-install-recommends install openssh-server rsyslog
 RUN apt -y --no-install-recommends install wine libwine wine64
 RUN apt -y --no-install-recommends install pdfposter rename
+RUN apt -y --no-install-recommends install jdupes
 
 RUN apt -y --no-install-recommends install locales
 RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && \
index 4389f29b462ad4f3a84f5c61f98748ce01c7c1fd..f3e7d4162afd0bd3c667b7474cae8a6699ad72c5 100644 (file)
@@ -69,6 +69,7 @@ RUN apt -y --no-install-recommends install sshfs python3 python3-pip
 RUN apt -y --no-install-recommends install openssh-server rsyslog
 RUN apt -y --no-install-recommends install wine libwine wine64
 RUN apt -y --no-install-recommends install pdfposter rename
+RUN apt -y --no-install-recommends install jdupes
 
 RUN apt -y --no-install-recommends install locales
 RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && \
index 536d0bed5c7addb1f1a0acdf1bd9406273eedc9a..515c9c33fde610e3e8c2054c329753fe500c3813 100644 (file)
@@ -33,6 +33,7 @@ class Kernel extends \Cubist\Backpack\Console\Kernel
             $schedule->command('job:dispatchNow Maintenance\\\\CheckPublicationsHashAndCid')->dailyAt('3:00');
             $schedule->command('job:dispatchNow Maintenance\\\\CleanDownloads')->dailyAt('4:00');
             $schedule->command('job:dispatchNow Maintenance\\\\CleanFTP')->dailyAt('4:30');
+            $schedule->command('job:dispatchNow Maintenance\\\\RemoveDuplicates')->monthly();
             // WS to Toolbox migration
             $schedule->command('ws:migrate --publications=v2 --documents=missing')->dailyAt('1:00');
             $schedule->command('ws:migrate --publications=missing --documents=missing')->hourly();
diff --git a/app/Jobs/Maintenance/RemoveDuplicates.php b/app/Jobs/Maintenance/RemoveDuplicates.php
new file mode 100644 (file)
index 0000000..da8da62
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Jobs\Maintenance;
+
+use App\Jobs\Base;
+use Cubist\Util\CommandLine;
+
+class RemoveDuplicates extends Base
+{
+    public function handle()
+    {
+        $directories = [protected_path('fluidbookpublication/working'), protected_path('fluidbookpublication/pdf')];
+        foreach ($directories as $directory) {
+            $jdupes = new CommandLine('/usr/bin/jdupes');
+            $jdupes->setArg('l');
+            $jdupes->setArg('r');
+            $jdupes->setArg(null, $directory);
+            $jdupes->execute();
+        }
+    }
+}