static function update($schema = 'Myisam') { $config = Config::getInstance(); $rootLogin = $config->superuser['login']; try { // throws an exception if invalid Piwik::checkValidLoginString($rootLogin); } catch (\Exception $e) { throw new \Exception('Superuser login name "' . $rootLogin . '" is no longer a valid format. ' . $e->getMessage() . ' Edit your config/config.ini.php to change it.'); } }
function validateOwner() { try { $login = $this->owner->getValue(); if (!empty($login)) { Piwik::checkValidLoginString($login); } } catch (\Exception $e) { $this->setMessage($e->getMessage()); return false; } return true; }
public function doUpdate(Updater $updater) { $config = Config::getInstance(); try { $superuser = $config->superuser; } catch (\Exception $e) { return; } if (empty($superuser['login'])) { return; } $rootLogin = $superuser['login']; try { // throws an exception if invalid Piwik::checkValidLoginString($rootLogin); } catch (\Exception $e) { throw new \Exception('Superuser login name "' . $rootLogin . '" is no longer a valid format. ' . $e->getMessage() . ' Edit your config/config.ini.php to change it.'); } }
/** * @dataProvider getValidLoginStringData */ public function testCheckValidLoginString($toTest) { $this->assertNull(Piwik::checkValidLoginString($toTest)); }
private function checkLogin($userLogin) { if ($this->userExists($userLogin)) { throw new Exception(Piwik::translate('UsersManager_ExceptionLoginExists', $userLogin)); } Piwik::checkValidLoginString($userLogin); }