Exemplo n.º 1
0
 public function createDatasource($hint)
 {
     if (!$this->isRunning()) {
         $this->init();
     }
     $pass = \Amp\Util\StringUtil::createRandom(16);
     $user = \Amp\Util\StringUtil::createHintedRandom($hint, 16, 5, 'abcdefghijklmnopqrstuvwxyz0123456789');
     $datasource = new Datasource();
     $datasource->setDriver($this->adminDatasource->getDriver());
     $datasource->setHost('127.0.0.1');
     $datasource->setPort($this->port);
     $datasource->setSocketPath($this->mysql_socket_path);
     $datasource->setUsername($user);
     $datasource->setPassword($pass);
     $datasource->setDatabase($user);
     return $datasource;
 }
Exemplo n.º 2
0
Arquivo: MySQL.php Projeto: totten/amp
 /**
  * Create a database and grant access to a (new) user
  *
  * @param Datasource $datasource
  */
 public function dropDatabase($datasource)
 {
     $dbh = $this->adminDatasource->createPDO();
     $dbh->exec("DROP DATABASE IF EXISTS `{$datasource->getDatabase()}`");
 }
Exemplo n.º 3
0
 protected function createConfigFile($file, Datasource $datasource, $dataDir)
 {
     $config = array('dsn' => $datasource->toPDODSN(), 'user' => $datasource->getUsername(), 'pass' => $datasource->getPassword(), 'dataDir' => $dataDir);
     $this->fs->dumpFile($file, "<?php\nreturn " . var_export($config, 1) . ";");
 }