Tinebase Cli - updateAllAccountsWithAccountEmail
authorPaul Mehrer <p.mehrer@metaways.de>
Thu, 3 Aug 2017 11:38:24 +0000 (13:38 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 3 Aug 2017 12:27:23 +0000 (14:27 +0200)
this forces all Tinebase_User plugins to fire and for example to write
the smtp / imap data of Tinebase_EmailUser

Change-Id: I62f390049df0584566e7a4f9373ce803657e5879
Reviewed-on: http://gerrit.tine20.com/customers/5384
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Frontend/Cli.php

index e2345a8..3c7568d 100644 (file)
@@ -1844,5 +1844,24 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
         }
 
         echo PHP_EOL . 'done' . PHP_EOL . PHP_EOL;
+
+        return 0;
+    }
+
+    public function updateAllAccountsWithAccountEmail()
+    {
+        if (! $this->_checkAdminRight()) {
+            return -1;
+        }
+
+        $userController = Tinebase_User::getInstance();
+        /** @var Tinebase_Model_FullUser $user */
+        foreach ($userController->getFullUsers() as $user) {
+            if (!empty($user->accountEmailAddress)) {
+                $userController->updateUser($user);
+            }
+        }
+
+        return 0;
     }
 }