UpdateDatabase/MysqlEngineCharset.php
[Pman.Core] / UpdateDatabase / MysqlEngineCharset.php
index 20a1dc7..55a12fb 100644 (file)
@@ -7,8 +7,8 @@
 class Pman_Core_UpdateDatabase_MysqlEngineCharset {
     
     var $dburl;
-    var $schema;
-    var $links;
+    var $schema = array();
+    var $links = array();
     
     function __construct()
     {
@@ -32,10 +32,15 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
         $ff->generateDataobjectsCache(true);
         $this->dburl = parse_url($ff->database);
         
+         print_R($ff->PDO_DataObject);exit;
+        
         $dbini = 'ini_'. basename($this->dburl['path']);
         
         
         $iniCache = $ff->DB_DataObject[$dbini];
+        if (!file_exists($iniCache)) {
+            return;
+        }
         
         $this->schema = parse_ini_file($iniCache, true);
         $this->links = parse_ini_file(preg_replace('/\.ini$/', '.links.ini', $iniCache), true);
@@ -77,7 +82,9 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
                         T.table_name = '{$tbl}' -- COLLATE utf8_general_ci
             ");
                      
-            $ce->fetch();
+            if (!$ce->fetch()) {
+                continue;
+            }
             
             if($ce->csname == 'utf8' && $ce->collatename == 'utf8_general_ci'){
                 echo "utf8: SKIP $tbl\n";
@@ -110,7 +117,7 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
         
         
         $db = DB_DataObject::factory('core_enum')->getDatabaseConnection();
-        $views = $db->getListOf(  'views');
+        $views = $db->getListOf( 'views');  // needs updated pear... 
         
         
         
@@ -126,9 +133,20 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
             
             $ce = DB_DataObject::factory('core_enum');
             
-            $ce->query("select engine from information_schema.tables where table_schema='{$ce->database()}' and table_name = '{$tbl}'");
+            $ce->query("
+                select
+                    engine
+                from
+                    information_schema.tables
+                where
+                    table_schema='{$ce->database()}'
+                    and
+                    table_name = '{$tbl}'
+            ");
 
-            $ce->fetch();
+            if (!$ce->fetch()) {
+                continue;
+            }
             
             if($ce->engine == 'InnoDB' ){
                 echo "InnoDB: SKIP $tbl\n";