/**
  * Populates a database
  *
  * @param $fetched_settings
  */
 public function PopulateDatabase($fetched_settings)
 {
     foreach ($fetched_settings as $key => $value) {
         /**
          * Create a new class yo
          */
         $class = new DatabaseSettings();
         /**
          * If we already have this setting skip
          */
         if ($class->ObtainSetting($key) != null) {
             continue;
         }
         /**
          * Insert this setting
          */
         $class->InsertSetting($key, $value);
         /**
          * Log it
          */
         Install::AddLog('Settings', 'Added setting: ' . $key . ' with value ' . $value . ' to the database.');
     }
 }
<?php

require_once "vendor/autoload.php";
use Syscrack\Helper\Install;
$data = ['database_username' => 'root', 'database_password' => 'password', 'database_database' => 'syscrack_database', 'database_host' => 'localhost', 'email_username' => '*****@*****.**', 'email_password' => 'test123'];
$test = new Install($data);
echo "<h1>Syscrack Install</h1>";
foreach ($test->GetLog() as $key => $value) {
    echo "<br><b>" . $value['action'] . "</b>: " . $value['text'];
}
echo "<h2>Install Finished</h2>";
Example #3
0
 /**
  * Populates our settings.
  */
 public function PopulateSettings()
 {
     new SettingsCreator(function () {
         Install::AddLog('Settings', 'Populated the settings');
     });
 }
 /**
  * Populates our table with love
  *
  * @param $table_columns
  */
 public function PopulateTable($table_columns)
 {
     foreach ($table_columns as $key => $value) {
         /**
          * Lets set the column.
          */
         $column = $key;
         /**
          * If we are primary or an incremental, we need to remove our last character else mySQL might break!
          */
         if ($this->IsPrimary($key)) {
             $column = String::RemoveLast($key);
         }
         /**
          * Lets try and call this function
          */
         $this->CallFunction($value, $column);
         /**
          * Add this to our log
          */
         Install::AddLog('Database', 'Created Column: ' . $key . ' with the type ' . $value);
     }
     /**
      * Then, lets set the primarys!
      */
     try {
         /**
          * This can sometimes explode in your face.
          */
         $this->SetPrimary($table_columns);
     } catch (\Exception $error) {
         Install::AddLog("Database", "Unable to set the primary key in table " . $this->temp_table_name . ". I suggest checking phpmyadmin and seeing if that table has a primary key.");
     }
 }