use credentials from config if not set during setup
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 6 Jun 2014 11:13:46 +0000 (13:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 11 Jun 2014 11:59:54 +0000 (13:59 +0200)
Change-Id: Ic6d6df817e261cf3633ab841ee7e5bd12f8cc71a
Reviewed-on: http://gerrit.tine20.com/customers/743
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Addressbook/Setup/Initialize.php

index 072a598..a64c714 100644 (file)
@@ -222,6 +222,19 @@ class Addressbook_Setup_Initialize extends Setup_Initialize
                 $result[$key] = $accounts[$key];
             }
         }
+        
+        if (! isset($result['adminLoginName']) || ! isset($result['adminPassword'])) {
+            $loginConfig = Tinebase_Config::getInstance()->get('login');
+            if ($loginConfig) {
+                $result = array(
+                    'adminLoginName' => $loginConfig->username,
+                    'adminPassword' => $loginConfig->password,
+                );
+            } else {
+                throw Setup_Exception('Inital admin username and password are required');
+            }
+        }
+        
         return $result;
     }