Пример #1
0
 /**
  * Build Initial Tables
  * @return bool
  */
 public function buildInitialTables()
 {
     $ClassMethods = get_class_methods('Core\\Extensions\\Installer');
     foreach ($ClassMethods as $Key => $Value) {
         if (!strstr($Value, 'build') || strstr($Value, 'Initial')) {
             unset($ClassMethods[$Key]);
         }
     }
     $ClassMethods = array_values($ClassMethods);
     try {
         foreach ($ClassMethods as $Method) {
             $this->assignDBManager();
             $InstallationQuery = $this->{$Method}()->stringify();
             Database::plainSQLPDO($this->Connection, 'DROP TABLE IF EXISTS ' . $this->DBManager->getTableName() . ';');
             Database::plainSQLPDO($this->Connection, $InstallationQuery);
         }
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * Get Installed Patches To Be Displayed On Main Page
  * @return array|bool|mixed
  */
 public function getInstalledPatches()
 {
     return Database::plainSQLPDO($this->Connection, 'SELECT * FROM installed_patches', true, true);
 }
 protected function checkForUserName($Username)
 {
     $Statement = $this->Connection->prepare('SELECT id, username FROM users WHERE username = :username');
     $Statement->bindParam(':username', $Username);
     $Statement->execute();
     if (Database::IsEmpty($Statement)) {
         return false;
     }
     return true;
 }
 /**
  * Execute Query
  * @param $Connection
  * @param bool|false $Return
  * @param bool|false $Multiple
  * @return mixed
  */
 public function executePDO($Connection, $Return = false, $Multiple = false)
 {
     $Statement = $Connection->prepare($this->FinalQuery);
     foreach ($this->Where as $Condition => $Item) {
         $Statement->bindParam($Condition, $this->Relations[$Condition]);
     }
     $Statement->execute();
     if ($Return) {
         if ($Multiple) {
             if (Database::isEmpty($Statement)) {
                 return false;
             } else {
                 return $Statement->fetchAll(\PDO::FETCH_ASSOC);
             }
         } else {
             if (Database::isEmpty($Statement)) {
                 return false;
             } else {
                 return $Statement->fetch(\PDO::FETCH_ASSOC);
             }
         }
     } else {
         return true;
     }
 }
Пример #5
0
 /**
  * Sets Connection To Be Used For Desired Query
  * @param $Connection           - Connection Name
  */
 private static function selectConnection($Connection)
 {
     Database::$SelectedConnection = Database::$Connections[$Connection];
 }