]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7010 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Jul 2024 09:04:55 +0000 (11:04 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Jul 2024 09:04:55 +0000 (11:04 +0200)
app/Console/Commands/FluidbookHostAbuse.php [new file with mode: 0644]

diff --git a/app/Console/Commands/FluidbookHostAbuse.php b/app/Console/Commands/FluidbookHostAbuse.php
new file mode 100644 (file)
index 0000000..2d3f5b8
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Console\Commands\Base\ToolboxCommand;
+use App\Fluidbook\Packager\Download;
+use App\Models\FluidbookPublication;
+use Cubist\Util\Text;
+
+class FluidbookHostAbuse extends ToolboxCommand
+{
+    protected $signature = 'fluidbook:hosting:abuse {id}';
+    protected $description = 'Move fluidbook to a temporary hosting';
+
+    public function handle()
+    {
+        $ids = Text::multiExplode(' ,', $this->argument('id', ''));
+
+        foreach ($ids as $id) {
+            /** @var FluidbookPublication $fb */
+            $fb = FluidbookPublication::withoutGlobalScopes()->find($id);
+            $fb->install_online = ['server' => 43, 'path' => $id];
+            $fb->saveQuietly();
+
+            $download = new Download($fb, 'online', 'install', $this->getUser());
+            $download->handle();
+
+            $fb->redirectDemo = 'https://abuse.hosting2.fluidbook.com/' . $id . '/';
+            $fb->saveQuietly();
+        }
+    }
+}