rawCreate() public method

create from sql
Since: 2.4.0
public rawCreate ( )
 /**
  * testRawCreate
  *
  * @since 2.4.0
  */
 public function testRawCreate()
 {
     /* setup */
     $installer = new Installer();
     $installer->init($this->_config);
     $installer->rawCreate();
     /* actual */
     $actual = Db::countTablePrefix();
     /* compare */
     $this->assertEquals(8, $actual);
 }
Example #2
0
 /**
  * install the database
  *
  * @since 3.0.0
  *
  * @param array $optionArray
  *
  * @return boolean
  */
 protected function _database($optionArray = [])
 {
     $adminName = $this->prompt('admin-name', $optionArray);
     $adminUser = $this->prompt('admin-user', $optionArray);
     $adminPassword = $this->prompt('admin-password', $optionArray);
     $adminEmail = $this->prompt('admin-email', $optionArray);
     if ($adminName && $adminUser && $adminPassword && $adminEmail) {
         $installer = new Installer($this->_config);
         $installer->init();
         $installer->rawCreate();
         $installer->insertData(['adminName' => $adminName, 'adminUser' => $adminUser, 'adminPassword' => $adminPassword, 'adminEmail' => $adminEmail]);
         return Db::getStatus() === 2;
     }
     return false;
 }
 /**
  * reinstall
  *
  * @since 2.4.0
  */
 protected static function _reinstall()
 {
     $installer = new Installer(GlobalConfig::getInstance());
     $installer->init();
     $installer->rawDrop();
     $installer->rawCreate();
     $installer->insertData(array('adminName' => 'Admin', 'adminUser' => 'admin', 'adminPassword' => 'admin', 'adminEmail' => 'admin@localhost'));
     /* process modules */
     foreach (self::$_config['modules'] as $key => $value) {
         if (is_dir('modules/' . $key)) {
             $module = new $value();
             $module->install();
         }
     }
     /* access and filter */
     Db::forTablePrefix('groups')->findMany()->set(array('modules' => null, 'filter' => 1))->save();
 }
Example #4
0
 /**
  * install the database
  *
  * @since 3.0.0
  *
  * @param array $installArray
  *
  * @return array
  */
 protected function _install($installArray = [])
 {
     $adminName = $installArray['adminName'];
     $adminUser = $installArray['adminUser'];
     $adminPassword = $installArray['adminPassword'];
     $adminEmail = $installArray['adminEmail'];
     if ($adminName && $adminUser && $adminPassword && $adminEmail) {
         $installer = new Installer($this->_config);
         $installer->init();
         $installer->rawDrop();
         $installer->rawCreate();
         $installer->insertData(['adminName' => $installArray['adminName'], 'adminUser' => $installArray['adminUser'], 'adminPassword' => $installArray['adminPassword'], 'adminEmail' => $installArray['adminEmail']]);
         return Db::getStatus() === 2;
     }
     return false;
 }
Example #5
0
 /**
  * testModule
  *
  * @since 3.0.0
  */
 public function testModule()
 {
     /* setup */
     $installer = new Installer($this->_config);
     $installer->init();
     $installer->rawCreate();
     $this->_request->setServer('argv', ['console.php', 'uninstall', 'module', '--alias', 'TestDummy']);
     $uninstallCommand = new Command\Uninstall($this->_registry, $this->_request, $this->_config);
     /* actual */
     $actual = $uninstallCommand->run('cli');
     /* compare */
     $this->assertTrue($actual);
 }