Bolt\Exception\LowLevelDatabaseException::unsecure PHP Method

unsecure() public static method

public static unsecure ( )
    public static function unsecure()
    {
        return new static("There is no <code>password</code> set for the database connection, and you're using user 'root'.<br/> " . 'That must surely be a mistake, right? ' . "Bolt will stubbornly refuse to run until you've set a password for 'root'.");
    }

Usage Example

Beispiel #1
0
 /**
  * Perform the check for the database folder. We do this seperately, because it can only
  * be done _after_ the other checks, since we need to have the $config, to see if we even
  * _need_ to do this check.
  */
 public function doDatabaseCheck()
 {
     $cfg = $this->config->app['config']->get('general/database');
     $driver = $cfg['driver'];
     if ($driver == 'pdo_sqlite') {
         $this->doDatabaseSqliteCheck($cfg);
         return;
     }
     if (!in_array($driver, ['pdo_mysql', 'pdo_pgsql'])) {
         throw LowLevelDatabaseException::unsupportedDriver($driver);
     }
     if ($driver == 'pdo_mysql' && !$this->mysqlLoaded) {
         throw LowLevelDatabaseException::missingDriver('MySQL', 'pdo_mysql');
     } elseif ($driver == 'pdo_pgsql' && !$this->postgresLoaded) {
         throw LowLevelDatabaseException::missingDriver('PostgreSQL', 'pdo_pgsql');
     }
     if (empty($cfg['dbname'])) {
         throw LowLevelDatabaseException::missingParameter('databasename');
     }
     if (empty($cfg['user'])) {
         throw LowLevelDatabaseException::missingParameter('username');
     }
     if (empty($cfg['password']) && $cfg['user'] === 'root') {
         throw LowLevelDatabaseException::unsecure();
     }
 }