unsecure() public static method

public static unsecure ( )
Example #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();
     }
 }