/** * * @param BackendInterface $interface * @return Dataset */ public function execute($interface = null){ // Default to the system interface. if(!$interface){ $dmi = \DMI::GetSystemDMI(); $interface = $dmi->connection(); } // This actually goes the other way, as the interface has the logic. $interface->execute($this); if( $this->_data === null && $this->_mode == Dataset::MODE_GET ){ // It's been executed, so data should at least be something. $this->_data = []; reset($this->_data); } // Allow Chaining return $this; }
} catch (Exception $e) { // Yeah... I probably don't care at this stage... but maybe I do... \Core\ErrorManagement\exception_handler($e); } } if(!defined('CDN_TYPE')){ define('CDN_TYPE', 'local'); } if(!defined('CDN_LOCAL_ASSETDIR')){ define('CDN_LOCAL_ASSETDIR', 'files/assets/'); } if(!defined('CDN_LOCAL_PUBLICDIR')){ define('CDN_LOCAL_PUBLICDIR', 'files/public/'); } require_once(ROOT_PDIR . 'core/libs/core/Core.class.php'); require_once(ROOT_PDIR . 'core/libs/core/ComponentHandler.class.php'); require_once(ROOT_PDIR . 'core/helpers/UpdaterHelper.class.php'); require_once(ROOT_PDIR . 'core/libs/core/datamodel/Dataset.php'); $db = DMI::GetSystemDMI(); $ds = new \Core\Datamodel\Dataset(); $ds->delete()->table('component')->execute($db); // And now execute reinstall. exec('"' . ROOT_PDIR . '../utilities/reinstall.php' . '"');
/** * Test the database connection given the SESSION data. * Will gracefully handle exceptions. * * @return array */ private function testDatabaseConnection(){ try{ require_once(ROOT_PDIR . 'core/libs/core/datamodel/DMI.class.php'); $dbconn = \DMI::GetSystemDMI(); } // The server can't be located catch(\DMI_ServerNotFound_Exception $e){ return [ 'status' => 'failed', 'message' => $e->getMessage(), 'instructions' => '', ]; } // This is specific to user denied. catch(\DMI_Authentication_Exception $e){ return [ 'status' => 'failed', 'message' => $e->getMessage(), 'instructions' => $this->getDatabaseUserInstructions(), ]; } // Any other error. // Couldn't establish connection... do something fun! catch(\Exception $e){ return [ 'status' => 'failed', 'message' => $e->getMessage(), 'instructions' => $this->getDatabaseDatabaseInstructions(), ]; } // w00t, it must have worked! return ['status' => 'passed', 'message' => 'Connection succeeded', 'instructions' => '']; }
); $maindefines_time = microtime(true); // Now the core of the application, config handler, and all necessary core // settings should be available. /************************** START EXECUTION *****************************/ \Core\Utilities\Profiler\Profiler::GetDefaultProfiler()->record('Core Plus bootstrapped and application starting'); // Datamodel, GOGO! //require_once(ROOT_PDIR . 'core/libs/core/datamodel/DMI.class.php'); try { $dbconn = DMI::GetSystemDMI(); ConfigHandler::_DBReadyHook(); } // This catch statement should be hit anytime the database is not available, // core table doesn't exist, or the like. catch (Exception $e) { error_log($e->getMessage()); // Couldn't establish connection... do something fun! // If it's in development mode, redirect back to the installer, which should hopefully // get whatever problem this was fixed. if (DEVELOPMENT_MODE) { //header('HTTP/1.1 302 Moved Temporarily'); //header('Location: ' . ROOT_WDIR . 'install'); die('Please <a href="' . ROOT_WDIR . 'install' . '">install Core Plus.</a>'); }