]> git.mxchange.org Git - friendica.git/commitdiff
Add loop to console storage move
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 20 Mar 2019 04:42:50 +0000 (00:42 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 20 Mar 2019 04:42:50 +0000 (00:42 -0400)
- Add timestamp to output messages

src/Core/Console/Storage.php

index 8b02d874c56f02bd3cddbbccc1c8bcb2b7821bd0..ce89ce1e2cb7e469571d14e6c9b3a3146e8a2aa4 100644 (file)
@@ -28,9 +28,10 @@ Synopsis
         Set current storage backend
             name        storage backend to use. see "list".
     
-    bin/console storage move [table]
+    bin/console storage move [table] [-n 5000]
         Move stored data to current storage backend.
             table       one of "photo" or "attach". default to both
+            -n          limit of processed entry batch size
 HELP;
                return $help;
        }
@@ -130,7 +131,17 @@ HELP;
                }
 
                $current = StorageManager::getBackend();
-               $r = StorageManager::move($current, $tables);
-               $this->out(sprintf('Moved %d files', $r));
+               $total = 0;
+
+               do {
+                       $moved = StorageManager::move($current, $tables, $this->getOption('n', 5000));
+                       if ($moved) {
+                               $this->out(date('[Y-m-d H:i:s] ') . sprintf('Moved %d files', $moved));
+                       }
+
+                       $total += $moved;
+               } while ($moved);
+
+               $this->out(sprintf(date('[Y-m-d H:i:s] ') . 'Moved %d files total', $total));
        }
 }