]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Storage.php
Merge pull request #10575 from MrPetovan/bug/10019-peertube-embed
[friendica.git] / src / Console / Storage.php
index 09e062049ff21bcaadf87b738df1a88abfe63709..93bbb26579a28db8b72110d29b69ccc7b844b659 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -23,6 +23,7 @@ namespace Friendica\Console;
 
 use Asika\SimpleConsole\CommandArgsException;
 use Friendica\Core\StorageManager;
+use Friendica\Model\Storage\StorageException;
 
 /**
  * tool to manage storage backend and stored data from CLI
@@ -106,7 +107,7 @@ HELP;
                $isregisterd = false;
                foreach ($this->storageManager->listBackends() as $name => $class) {
                        $issel = ' ';
-                       if ($current::getName() == $name) {
+                       if ($current && $current::getName() == $name) {
                                $issel = '*';
                                $isregisterd = true;
                        };
@@ -165,6 +166,10 @@ HELP;
                $current = $this->storageManager->getBackend();
                $total = 0;
 
+               if (is_null($current)) {
+                       throw new StorageException(sprintf("Cannot move to legacy storage. Please select a storage backend."));
+               }
+
                do {
                        $moved = $this->storageManager->move($current, $tables, $this->getOption('n', 5000));
                        if ($moved) {