Piwik\Plugins\Installation\Controller::setupSuperUser PHP Метод

setupSuperUser() публичный Метод

Installation Step 5: General Set-up (superuser login/password/email and subscriptions)
public setupSuperUser ( )
    function setupSuperUser()
    {
        $this->checkPiwikIsNotInstalled();
        $superUserAlreadyExists = Access::doAsSuperUser(function () {
            return count(APIUsersManager::getInstance()->getUsersHavingSuperUserAccess()) > 0;
        });
        if ($superUserAlreadyExists) {
            $this->redirectToNextStep('setupSuperUser');
        }
        $view = new View('@Installation/setupSuperUser', $this->getInstallationSteps(), __FUNCTION__);
        $form = new FormSuperUser();
        if ($form->validate()) {
            try {
                $this->createSuperUser($form->getSubmitValue('login'), $form->getSubmitValue('password'), $form->getSubmitValue('email'));
                $email = $form->getSubmitValue('email');
                $newsletterPiwikORG = $form->getSubmitValue('subscribe_newsletter_piwikorg');
                $newsletterProfessionalServices = $form->getSubmitValue('subscribe_newsletter_professionalservices');
                $this->registerNewsletter($email, $newsletterPiwikORG, $newsletterProfessionalServices);
                $this->redirectToNextStep(__FUNCTION__);
            } catch (Exception $e) {
                $view->errorMessage = $e->getMessage();
            }
        }
        $view->addForm($form);
        return $view->render();
    }