DB_DataObject::factory('companies')->initCompanies($this, $opts);
}
- $this->fixLinks();
+
+ $this->runExtensions();
}
$ar = $this->modulesList();
-
+
foreach($ar as $m) {
echo "Importing SQL from module $m\n";
function importmysqldir($dburl, $dir)
{
+
+ $this->fixMysqlInnodb(); /// run once
+
echo "Import MYSQL :: $dir\n";
function fixMysqlInnodb()
{
+
+ static $done_check = false;
+ if ($done_check) {
+ return;
+ }
// innodb in single files is far more efficient that MYD or one big innodb file.
// first check if database is using this format.
$db = DB_DataObject::factory('core_enum');
$db->query("show variables like 'innodb_file_per_table'");
$db->fetch();
- var_dump($db);
- // Value should == ON
-
- // I think it needs to look in the mysql directory.... to see if the idb exists..
- $db = DB_DataObject::factory('core_enum');
- $db->query("SHOW TABLE STATUS");
- // Engine should be InnoDB - and file XXX.idb should exist...
-
+ if ($db->Value == 'OFF') {
+ die("Error: set innodb_file_per_table = 1 in my.cnf\n\n");
+ }
+ $done_check = true;;
}
- function fixLinks()
+ var $extensions = array(
+ 'EngineCharset',
+ 'Links',
+ );
+
+ function runExtensions()
{
$ff = HTML_Flexyframework::get();
$dbtype = $dburl['scheme'];
- $scls = ucfirst($dbtype). 'Links';
- $cls = 'Pman_Core_UpdateDatabase_'. $scls;
- $fn = implode('/',explode('_', $cls)).'.php';
- if (!file_exists(__DIR__.'/UpdateDatabase/'. $scls .'.php')) {
- return;
+ foreach($this->extensions as $ext) {
+
+ $scls = ucfirst($dbtype). $ext;
+ $cls = __CLASS__ . '_'. $scls;
+ $fn = implode('/',explode('_', $cls)).'.php';
+ if (!file_exists(__DIR__.'/UpdateDatabase/'. $scls .'.php')) {
+ return;
+ }
+ require_once $fn;
+ $c = new $cls();
+
}
- require_once $fn;
- $c = new $cls();
-
-
}
}
\ No newline at end of file