DataObjects/Core_enum.php
[Pman.Core] / UpdateDatabase.php
index 61c81f3..a35420d 100644 (file)
@@ -155,6 +155,9 @@ class Pman_Core_UpdateDatabase extends Pman
            
             DB_DataObject::factory('companies')->initCompanies($this, $opts);
         }
+        
+        $this->runExtensions();
+         
          
     }
     function output() {
@@ -184,7 +187,7 @@ class Pman_Core_UpdateDatabase extends Pman
        
         
         $ar = $this->modulesList();
-       
+        
         
         foreach($ar as $m) {
              echo "Importing SQL from module $m\n";
@@ -277,6 +280,7 @@ class Pman_Core_UpdateDatabase extends Pman
         
         echo $psql_cmd . "\n" ;
         echo "scan : $dir\n";
+        
         if (is_file($dir)) {
             $files = array($dir);
 
@@ -290,7 +294,6 @@ class Pman_Core_UpdateDatabase extends Pman
         //usort($files, $lsort);
         
         
-        
         foreach($files as $bfn) {
 
 
@@ -317,7 +320,6 @@ class Pman_Core_UpdateDatabase extends Pman
 
             echo "$bfn:   $cmd ". ($ff->cli ? "\n" : "<BR>\n");
 
-
             passthru($cmd);
 
             if ($fn) {
@@ -340,6 +342,9 @@ class Pman_Core_UpdateDatabase extends Pman
     
     function importmysqldir($dburl, $dir)
     {
+        
+        $this->fixMysqlInnodb(); /// run once 
+        
         echo "Import MYSQL :: $dir\n";
         
         
@@ -657,6 +662,10 @@ class Pman_Core_UpdateDatabase extends Pman
                 'name' => 'system-email-from',
                 'type' => 0, // system
             ),
+            array(
+                'name' => 'core-person-signup-bcc',
+                'type' => 0, // system
+            ),
         ));
         
     }
@@ -718,16 +727,23 @@ class Pman_Core_UpdateDatabase extends Pman
     
     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);
-        
-        // I think it needs to look in the mysql directory.... to see if the idb exists..
+        if ($db->Value == 'OFF') {
+            die("Error: set innodb_file_per_table = 1 in my.cnf\n\n");
+        }
         
+        $done_check = true;;
 
         
         
         
@@ -826,4 +842,32 @@ class Pman_Core_UpdateDatabase extends Pman
        
     }
     
+    var $extensions = array(
+        'EngineCharset',
+        'Links',
+    );
+    
+    function runExtensions()
+    {
+        
+        $ff = HTML_Flexyframework::get();
+        
+        $dburl = parse_url($ff->DB_DataObject['database']);
+        
+        $dbtype = $dburl['scheme'];
+       
+        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();
+            
+        }
+        
+    }
 }
\ No newline at end of file