]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6646 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Mar 2024 17:21:59 +0000 (18:21 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Mar 2024 17:21:59 +0000 (18:21 +0100)
app/Console/Kernel.php
app/Jobs/Maintenance/UpdateComposedAttributes.php [new file with mode: 0644]
app/Models/FluidbookPublication.php

index aa2b68338cfd62f09f872246a6277d4008b143fc..f1b20289ecc727f6dc39c006c444b8d8fc64106a 100644 (file)
@@ -31,6 +31,7 @@ class Kernel extends \Cubist\Backpack\Console\Kernel
 
         if (config('app.env') === 'production') {
             $schedule->command('job:dispatchNow Maintenance\\\\CheckPublicationsHashAndCid')->dailyAt('3:00');
+            $schedule->command('job:dispatchNow Maintenance\\\\UpdateComposedAttributes')->dailyAt('5: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();
diff --git a/app/Jobs/Maintenance/UpdateComposedAttributes.php b/app/Jobs/Maintenance/UpdateComposedAttributes.php
new file mode 100644 (file)
index 0000000..18e9dd8
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Jobs\Maintenance;
+
+use App\Models\FluidbookPublication;
+
+class UpdateComposedAttributes
+{
+    public function handle()
+    {
+        /** @var FluidbookPublication[] $publications */
+        $publications = FluidbookPublication::withoutGlobalScopes()->where('version', 3)->where('created_ok', 1)->get();
+        foreach ($publications as $publication) {
+            $publication->setComposedAttributes();
+            $publication->saveQuietly();
+        }
+    }
+}
index ca581d2e939de66e40508693e4dd9f8fd2509545..90e0904858850d0ed6c42f7d508b1a6bbb1fcd7b 100644 (file)
@@ -344,7 +344,7 @@ class FluidbookPublication extends ToolboxStatusModel
     }
 
 
-    protected function setComposedAttributes()
+    public function setComposedAttributes()
     {
         /** @var \App\Models\User $owner */
         $owner = \App\Models\User::withoutGlobalScopes()->find($this->owner);