/** * Confirm action * @param string $message message for confirm * @param bool $default default selection * @throws yii\base\ExitException */ public function confirmAction($message, $default = false) { if (!Console::confirm($message, $default)) { Console::error(Yii::t('activeuser_backend', 'Action canceled')); Yii::$app->end(); } }
/** * Drop all tables in existing DB * Use it before Migration * @access public */ public function actionDropAllTables() { if ($this->interactive) { if (!Console::confirm('Sure that all tables will be dropped?', false)) { $this->stdout("# Canceled. Nothing happened\n", Console::FG_YELLOW); return 1; } } $this->_dropTables(); }
public function install() { parent::install(); if (Console::confirm('Create upload folder?')) { try { $this->createFolder('@webroot/uploads'); Console::output('Folder @webroot/uploads was created'); } catch (\Exception $e) { Console::output($e->getMessage()); } } }
public function install() { parent::install(); if (Console::confirm('Create assets files?')) { try { $this->createFile('@webroot/js/admin/scripts.js'); echo 'File @webroot/js/admin/scripts.js was created' . PHP_EOL; $this->createFile('@webroot/css/admin/main.css'); echo 'File @webroot/css/admin/main.css was created' . PHP_EOL; } catch (\Exception $e) { echo $e->getMessage() . PHP_EOL; } } }
/** * 用户创建交互 * @param $_model * @return mixed */ private function saveFounderData($_model) { $model = clone $_model; $model->username = Console::prompt('请输入创始人用户名', ['default' => 'admin']); $model->email = Console::prompt('请输入创始人邮箱', ['default' => '*****@*****.**']); $model->password = Console::prompt('请输入创始人密码', ['default' => 'admin']); if (!($user = $model->signup())) { Console::output(Console::ansiFormat("\n输入数据验证错误:", [Console::FG_RED])); foreach ($model->getErrors() as $k => $v) { Console::output(Console::ansiFormat(implode("\n", $v), [Console::FG_RED])); } if (Console::confirm("\n是否重新创建创始人账户:")) { $user = $this->saveFounderData($_model); } } return $user; }
/** * Asks user to confirm by typing y or n. * * @param string $message to echo out before waiting for user input * @param boolean $default this value is returned if no selection is made. * @return boolean whether user confirmed. * Will return true if [[interactive]] is false. */ public function confirm($message, $default = false) { if ($this->interactive) { return Console::confirm($message, $default); } else { return true; } }
public function up() { if (Console::confirm('是否生成测试问题数据?', true)) { $this->generateFakeData(rand(20, 100)); } }
public function actionMigrate() { if (!Console::confirm('Are you sure you want to create sample data. Old data will be lose')) { return self::EXIT_CODE_NORMAL; } $command = Yii::$app->db->createCommand(); $sampleDir = __DIR__ . '/data'; // TRUNCATE TABLE $command->delete('{{%product_stock}}')->execute(); $command->delete('{{%gl_detail}}')->execute(); $command->delete('{{%gl_header}}')->execute(); $command->delete('{{%goods_movement_dtl}}')->execute(); $command->delete('{{%goods_movement}}')->execute(); $command->delete('{{%sales_dtl}}')->execute(); $command->delete('{{%sales}}')->execute(); $command->delete('{{%transfer_dtl}}')->execute(); $command->delete('{{%transfer}}')->execute(); $command->delete('{{%invoice_dtl}}')->execute(); $command->delete('{{%invoice}}')->execute(); $command->delete('{{%payment_dtl}}')->execute(); $command->delete('{{%payment}}')->execute(); $command->delete('{{%warehouse}}')->execute(); $command->delete('{{%branch}}')->execute(); $command->delete('{{%orgn}}')->execute(); $command->delete('{{%vendor}}')->execute(); $command->delete('{{%product_uom}}')->execute(); $command->delete('{{%cogs}}')->execute(); $command->delete('{{%price}}')->execute(); $command->delete('{{%price_category}}')->execute(); $command->delete('{{%product_child}}')->execute(); $command->delete('{{%product}}')->execute(); $command->delete('{{%product_group}}')->execute(); $command->delete('{{%category}}')->execute(); $command->delete('{{%uom}}')->execute(); $command->delete('{{%entri_sheet}}')->execute(); $command->delete('{{%coa}}')->execute(); $command->delete('{{%payment_method}}')->execute(); // orgn $rows = (require $sampleDir . '/orgn.php'); $total = count($rows); echo "\ninsert table {{%orgn}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%orgn}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%orgn}}')->execute(); Console::endProgress(); // branch $rows = (require $sampleDir . '/branch.php'); $total = count($rows); echo "\ninsert table {{%branch}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%branch}}', $this->toAssoc($row, ['id', 'orgn_id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%branch}}')->execute(); Console::endProgress(); // warehouse $rows = (require $sampleDir . '/warehouse.php'); $total = count($rows); echo "\ninsert table {{%warehouse}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%warehouse}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%warehouse}}')->execute(); Console::endProgress(); // customer $rows = (require $sampleDir . '/vendor.php'); $total = count($rows); echo "\ninsert table {{%vendor}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%vendor}}', $this->toAssoc($row, ['id', 'type', 'code', 'name', 'contact_name', 'contact_number', 'status']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%vendor}}')->execute(); Console::endProgress(); // product category $rows = (require $sampleDir . '/category.php'); $total = count($rows); echo "\ninsert table {{%category}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%category}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%category}}')->execute(); Console::endProgress(); // product group $rows = (require $sampleDir . '/product_group.php'); $total = count($rows); echo "\ninsert table {{%product_group}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%product_group}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%product_group}}')->execute(); Console::endProgress(); // price category $rows = (require $sampleDir . '/price_category.php'); $total = count($rows); echo "\ninsert table {{%price_category}}\n"; Console::startProgress(0, $total); $pc_ids = []; foreach ($rows as $i => $row) { $pc_ids[] = $row[0]; $command->insert('{{%price_category}}', $this->toAssoc($row, ['id', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%price_category}}')->execute(); Console::endProgress(); // product $rows = (require $sampleDir . '/product.php'); $total = count($rows); echo "\ninsert table {{%product}}\n"; Console::startProgress(0, $total); $errors = []; foreach ($rows as $i => $line) { $code = strlen($line[2]) <= 13 ? $line[2] : substr($line[2], 0, -2); $row = ['id' => $line[0], 'group_id' => $line[6], 'category_id' => $line[1], 'code' => $code, 'name' => $line[3], 'status' => 10]; try { $command->insert('{{%product}}', $row)->execute(); } catch (\Exception $e) { $row['msg'] = $e->getMessage(); $errors[] = $row; continue; } // cogs $row = ['product_id' => $line[0], 'cogs' => $line[5], 'last_purchase_price' => $line[5]]; $command->insert('{{%cogs}}', $row)->execute(); // price $row = ['product_id' => $line[0], 'price_category_id' => 1, 'price' => $line[4]]; $command->insert('{{%price}}', $row)->execute(); Console::updateProgress($i + 1, $total); } $errorFile = Yii::getAlias('@runtime/data-migrate-error-' . date('His') . '.json'); file_put_contents($errorFile, json_encode($errors)); $command->resetSequence('{{%product}}')->execute(); Console::endProgress(); // uom $rows = (require $sampleDir . '/uom.php'); $total = count($rows); echo "\ninsert table {{%uom}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%uom}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); // product uom $sql = "insert into {{%product_uom}}([[product_id]],[[uom_id]],[[isi]])\n" . "select [[id]],{$row[0]},{$row[3]} from {{%product}}"; $command->setSql($sql)->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%uom}}')->execute(); Console::endProgress(); // coa $rows = (require $sampleDir . '/coa.php'); $total = count($rows); echo "\ninsert table {{%coa}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%coa}}', $this->toAssoc($row, ['id', 'parent_id', 'code', 'name', 'type', 'normal_balance']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%coa}}')->execute(); Console::endProgress(); // entrisheet $rows = (require $sampleDir . '/entri_sheet.php'); $total = count($rows); echo "\ninsert table {{%entri_sheet}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%entri_sheet}}', $this->toAssoc($row, ['id', 'code', 'name', 'd_coa_id', 'k_coa_id']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%entri_sheet}}')->execute(); Console::endProgress(); // payment method $rows = (require $sampleDir . '/payment_method.php'); $total = count($rows); echo "\ninsert table {{%payment_method}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%payment_method}}', $this->toAssoc($row, ['id', 'branch_id', 'method', 'coa_id', 'potongan', 'coa_id_potongan']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%payment_method}}')->execute(); Console::endProgress(); }
/** * Create a user. */ public function actionCreate() { $groups = Group::find()->disableAccessCheck()->orderBy('name')->all(); $this->out("Groups"); $options = []; $i = 1; $defaultGroup = null; foreach ($groups as $group) { $extra = ''; if ($group->system === 'users') { $defaultGroup = $group->primaryKey; $extra = '*'; } $options[$i] = $group->primaryKey; $this->out("{$i}) {$group->descriptor}{$extra}"); $i++; } $options[''] = $defaultGroup; $group = Console::select("Choose", $options); if (empty($group)) { $group = $defaultGroup; } else { $group = $options[$group]; } $user = new User(); $user->scenario = 'creation'; $user->first_name = $this->prompt("First name"); $user->last_name = $this->prompt("Last name"); $user->email = $this->prompt("Email"); $user->status = 1; $user->username = $this->prompt("Username"); $user->password = $this->prompt("Password"); $user->registerRelationModel(['parent_object_id' => $group]); if (!$user->validate()) { \d($user->errors); $this->stderr("User didn't validate!"); exit; } $individual = $user->guessIndividual(); if (empty($individual)) { if (!Console::confirm("No matching individual was found. Continue?")) { $this->stderr("Bye!"); exit; } } elseif (is_object($individual)) { $user->object_individual_id = $individual->primaryKey; if (!Console::confirm("Matching individual was found ({$individual->descriptor})! Continue?")) { $this->stderr("Bye!"); exit; } } else { $options = []; $i = 1; $this->out("Possible Individual Matches..."); foreach ($individual as $ind) { $options[$i] = $ind->primaryKey; $this->out("{$i}) {$ind->descriptor}"); $i++; } $user->object_individual_id = Console::select("Choose", $options); } if ($user->save()) { $this->out("User created!"); } else { \d($user->errors); $this->out("Error creating user!"); } }
/** * Create sample data */ public function actionCreate() { if (!Console::confirm('Are you sure you want to create sample data. Old data will be lose')) { return self::EXIT_CODE_NORMAL; } $command = Yii::$app->db->createCommand(); $sampleDir = __DIR__ . '/samples/zomb'; // TRUNCATE TABLE $command->delete('{{%product_stock}}')->execute(); $command->delete('{{%gl_detail}}')->execute(); $command->delete('{{%gl_header}}')->execute(); $command->delete('{{%goods_movement_dtl}}')->execute(); $command->delete('{{%goods_movement}}')->execute(); $command->delete('{{%sales_dtl}}')->execute(); $command->delete('{{%sales}}')->execute(); $command->delete('{{%transfer_dtl}}')->execute(); $command->delete('{{%transfer}}')->execute(); $command->delete('{{%invoice_dtl}}')->execute(); $command->delete('{{%invoice}}')->execute(); $command->delete('{{%payment_dtl}}')->execute(); $command->delete('{{%payment}}')->execute(); $command->delete('{{%warehouse}}')->execute(); $command->delete('{{%branch}}')->execute(); $command->delete('{{%orgn}}')->execute(); $command->delete('{{%vendor}}')->execute(); $command->delete('{{%product_uom}}')->execute(); $command->delete('{{%cogs}}')->execute(); $command->delete('{{%price}}')->execute(); $command->delete('{{%price_category}}')->execute(); $command->delete('{{%product_child}}')->execute(); $command->delete('{{%product}}')->execute(); $command->delete('{{%product_group}}')->execute(); $command->delete('{{%category}}')->execute(); $command->delete('{{%uom}}')->execute(); $command->delete('{{%entri_sheet}}')->execute(); $command->delete('{{%coa}}')->execute(); $command->delete('{{%payment_method}}')->execute(); // orgn $rows = (require $sampleDir . '/orgn.php'); $total = count($rows); echo "\ninsert table {{%orgn}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%orgn}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%orgn}}')->execute(); Console::endProgress(); // branch $rows = (require $sampleDir . '/branch.php'); $total = count($rows); echo "\ninsert table {{%branch}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%branch}}', $this->toAssoc($row, ['id', 'orgn_id', 'code', 'name', 'addr']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%branch}}')->execute(); Console::endProgress(); // warehouse $rows = (require $sampleDir . '/warehouse.php'); $total = count($rows); echo "\ninsert table {{%warehouse}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%warehouse}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%warehouse}}')->execute(); Console::endProgress(); // customer $rows = (require $sampleDir . '/vendor.php'); $total = count($rows); echo "\ninsert table {{%vendor}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%vendor}}', $this->toAssoc($row, ['id', 'type', 'code', 'name', 'contact_name', 'contact_number', 'status']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%vendor}}')->execute(); Console::endProgress(); // product category $rows = (require $sampleDir . '/category.php'); $total = count($rows); echo "\ninsert table {{%category}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%category}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%category}}')->execute(); Console::endProgress(); // product group $rows = (require $sampleDir . '/product_group.php'); $total = count($rows); echo "\ninsert table {{%product_group}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%product_group}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%product_group}}')->execute(); Console::endProgress(); // price category $rows = (require $sampleDir . '/price_category.php'); $total = count($rows); echo "\ninsert table {{%price_category}}\n"; Console::startProgress(0, $total); $pc_ids = []; foreach ($rows as $i => $row) { $pc_ids[] = $row[0]; $command->insert('{{%price_category}}', $this->toAssoc($row, ['id', 'name']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%price_category}}')->execute(); Console::endProgress(); // product $rows = (require $sampleDir . '/product.php'); $total = count($rows); echo "\ninsert table {{%product}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $row = $this->toAssoc($row, ['id', 'group_id', 'category_id', 'code', 'name', 'status', 'stockable']); $command->insert('{{%product}}', $row)->execute(); // barcode /* * Skip for test $batch = []; for ($j = 0; $j < 3; $j++) { $rand = mt_rand(1000000, 9999999) . mt_rand(100000, 999999); $batch[] = [$rand, $row['id']]; } try { $command->batchInsert('{{%product_child}}', ['barcode', 'product_id'], $batch)->execute(); } catch (Exception $exc) { echo 'Error: ' . $exc->getMessage() . "\n"; } * */ // price /* * Skip for test $batch = []; $price = mt_rand(95, 150) * 1000; foreach ($pc_ids as $pc_id) { $batch[] = [$row['id'], $pc_id, $price - $pc_id * 3000]; } $command->batchInsert('{{%price}}', ['product_id', 'price_category_id', 'price'], $batch)->execute(); */ // cogs /* * Skip for test $command->insert('{{%cogs}}', [ 'product_id' => $row['id'], 'cogs' => $price * 0.65, 'last_purchase_price' => $price - 20000, 'created_at' => time(), 'created_by' => 1, ])->execute(); * */ Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%product}}')->execute(); Console::endProgress(); // price $rows = (require $sampleDir . '/price.php'); $total = count($rows); echo "\ninsert table {{%price}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $pc_ids[] = $row[0]; $command->insert('{{%price}}', $this->toAssoc($row, ['product_id', 'price_category_id', 'price']))->execute(); Console::updateProgress($i + 1, $total); } Console::endProgress(); // cogs $rows = (require $sampleDir . '/cogs.php'); $total = count($rows); echo "\ninsert table {{%cogs}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $pc_ids[] = $row[0]; $command->insert('{{%cogs}}', $this->toAssoc($row, ['product_id', 'cogs', 'last_purchase_price']))->execute(); Console::updateProgress($i + 1, $total); } Console::endProgress(); // uom $rows = (require $sampleDir . '/uom.php'); $total = count($rows); echo "\ninsert table {{%uom}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%uom}}', $this->toAssoc($row, ['id', 'code', 'name']))->execute(); // product uom $sql = "insert into {{%product_uom}}([[product_id]],[[uom_id]],[[isi]])\n" . "select [[id]],{$row[0]},{$row[3]} from {{%product}}"; $command->setSql($sql)->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%uom}}')->execute(); Console::endProgress(); // coa $rows = (require $sampleDir . '/coa.php'); $total = count($rows); echo "\ninsert table {{%coa}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%coa}}', $this->toAssoc($row, ['id', 'parent_id', 'code', 'name', 'type', 'normal_balance']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%coa}}')->execute(); Console::endProgress(); // entrisheet $rows = (require $sampleDir . '/entri_sheet.php'); $total = count($rows); echo "\ninsert table {{%entri_sheet}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%entri_sheet}}', $this->toAssoc($row, ['id', 'code', 'name', 'd_coa_id', 'k_coa_id']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%entri_sheet}}')->execute(); Console::endProgress(); // payment method $rows = (require $sampleDir . '/payment_method.php'); $total = count($rows); echo "\ninsert table {{%payment_method}}\n"; Console::startProgress(0, $total); foreach ($rows as $i => $row) { $command->insert('{{%payment_method}}', $this->toAssoc($row, ['id', 'branch_id', 'method', 'coa_id', 'potongan', 'coa_id_potongan']))->execute(); Console::updateProgress($i + 1, $total); } $command->resetSequence('{{%payment_method}}')->execute(); Console::endProgress(); }
/** * Load sample * @param string $sample * @param \yii\db\Command $command * @param boolean $confirm */ public function load($sample, $command, $confirm = true) { $exists = $command->setSql("select count(*) from {{%{$sample}}}")->queryScalar() > 0; if (!$exists || $confirm && Console::confirm("Overwrote {$sample}")) { $samples = isset($this->_samples[$sample]) ? $this->_samples[$sample] : []; $this->resolveRequired($samples, $command); $file = $this->sourcePath . "/{$sample}.php"; $this->internalLoad($file, ['command' => $command, 'faker' => $this->generator, 'now' => new Expression('NOW()')]); } }
public function actionInstall() { // Determine absolute path $root = str_replace('\\', '/', __DIR__); preg_match('/.+\\/(?=.+\\/.+$)/', $root, $match); $root = $match[0]; // common/config/main-local.php path $main_local = $root . 'common/config/main-local.php'; if (is_writable($main_local)) { $main_local_file = file_get_contents($main_local); // Read old values preg_match('/(?<=host=).+?(?=;)/', $main_local_file, $default['hostname']); preg_match('/(?<=dbname=).+?(?=\',)/', $main_local_file, $default['dbname']); preg_match('/(?<=username\' => \').+?(?=\',)/', $main_local_file, $default['username']); // Prompt for input Console::output("\n" . 'Please specify database connection parameters.' . "\n"); $config['hostname'] = Console::prompt('Database Hostname', ['default' => $default['hostname'][0]]); $config['dbname'] = Console::prompt('Database Name', ['default' => $default['dbname'][0]]); $config['username'] = Console::prompt('Database Username', ['default' => $default['username'][0]]); $config['password'] = Console::prompt('Database Password []'); echo "\n"; // Database Connection $db_connection = new \mysqli($config['hostname'], $config['username'], $config['password']); if (empty($db_connection->connect_error)) { // Write new value $main_local_file = preg_replace('/(?<=host=).+?(?=;)/', $config['hostname'], $main_local_file); $main_local_file = preg_replace('/(?<=dbname=).+?(?=\',)/', $config['dbname'], $main_local_file); $main_local_file = preg_replace('/(?<=username\' => \').+?(?=\',)/', $config['username'], $main_local_file); $main_local_file = preg_replace('/(?<=password\' => \').+?(?=\',)/', $config['password'], $main_local_file); // Write to file file_put_contents($main_local, $main_local_file); $import = Console::confirm('Import SQL file ?' . "\n", true); if (!empty($import)) { // Import SQL $db_connection->set_charset('utf8'); // Read SQL file $sql_file = file_get_contents($root . 'dev/_sql/imagenizer.sql'); // Edit Database Name $sql_file = preg_replace('/(?<=CREATE DATABASE IF NOT EXISTS \\`).+?(?=\\`)/', $config['dbname'], $sql_file); $sql_file = preg_replace('/(?<=USE \\`).+?(?=\\`;)/', $config['dbname'], $sql_file); // Skip comments and new lines then concat multi-line SQL into single line and put each line into an array preg_match_all('/^(?!--)\\S.{0,}?;/sm', $sql_file, $sql_line); // Execute each line iteratively (since mysqli::query() cannot execute multiple line at once) foreach ($sql_line[0] as $key => $value) { $db_connection->query($value); } // Setup root account $this->setRoot(); // Setup Role Based Access Control $this->setRbac(); } // Close Connections $db_connection->close(); } else { if (empty($mute)) { Console::output('Error: Cannot connect to the database.' . "\n"); } exit; } } else { if (empty($mute)) { Console::output('Error: The file "' . $main_local . '" is not writable.' . "\n"); } exit; } if (empty($mute)) { Console::output("\n" . 'Imagenizer was installed successfully.' . "\n"); } }