Example #1
0
	public function export_database_schema() {
		if (!ENABLE_DEVELOPER_OPTIONS) { 
			return false;
		}
		$db = Loader::db();
		$ab = Database::getADOSChema();
		$xml = $ab->ExtractSchema();
		$this->set('schema', $xml);
	}
Example #2
0
 public static function installDB($xmlFile)
 {
     if (!file_exists($xmlFile)) {
         return false;
     }
     // currently this is just done from xml
     $db = Loader::db();
     // this sucks - but adodb generates errors at the beginning because it attempts
     // to find a table that doesn't exist!
     $handler = $db->IgnoreErrors();
     if (Database::getDebug() == false) {
         ob_start();
     }
     $schema = Database::getADOSChema();
     $sql = $schema->ParseSchema($xmlFile);
     $db->IgnoreErrors($handler);
     if (!$sql) {
         $result->message = $db->ErrorMsg();
         return $result;
     }
     $r = $schema->ExecuteSchema();
     if (Database::getDebug() == false) {
         $dbLayerErrorMessage = ob_get_contents();
         ob_end_clean();
     }
     $result = new stdClass();
     $result->result = false;
     if ($dbLayerErrorMessage != '') {
         $result->message = $dbLayerErrorMessage;
         return $result;
     }
     if (!$r) {
         $result->message = $db->ErrorMsg();
         return $result;
     }
     $result->result = true;
     $db->CacheFlush();
     return $result;
 }