Fix #6111 - set up basic infrastructure
authorAlan Knowles <alan@roojs.com>
Mon, 2 Dec 2019 08:12:51 +0000 (16:12 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 2 Dec 2019 08:12:51 +0000 (16:12 +0800)
Bjs.php
JsTemplate.php
RooTrait.php
UpdateDatabase.php
UpdateDatabase/MysqlEngineCharset.php
UpdateDatabase/MysqlLinks.php

diff --git a/Bjs.php b/Bjs.php
index d936bcf..f2a4379 100644 (file)
--- a/Bjs.php
+++ b/Bjs.php
@@ -26,7 +26,7 @@ class Pman_Core_Bjs {
             switch ($o->xtype) {
                 case "ComboBox":
                     if (!isset($o->{'String hiddenName'})) {
-                        continue;
+                        continue 2;
                     }
                     $this->fields[] = $o->{'String hiddenName'};
                     // fall throught..
index f138791..ec79d0c 100644 (file)
@@ -127,46 +127,46 @@ class Pman_Core_JsTemplate extends Pman {
             //var_Dump(substr($item,-3,2));
             switch(true) {
                 case (!strlen($item)):
-                    continue;
+                    continue 2;
                 
                 case ($inscript && ($item != '{end:}')):
                     $ret[count($ret)-1] .= $item;
-                    continue;
+                    continue 2;
                 
                 case ($inscript && ($item == '{end:}')):
                     $inscript = false;
-                    continue;
+                    continue 2;
                  
              
                 case ($item[0] != '{'):
                     if (!strlen(trim($item))) {
-                        continue;
+                        continue 2;
                     }
                     $ret[] = $in . "ret += ". json_encode($item) . ";";
-                    continue;
+                    continue 2;
                 
                 
                 case ($item == '{script:}'): 
                     $inscript = true;
                      $ret[] = '';
-                    continue;
+                    continue 2;
                 
                 case ($item[1] == '!'):
                     $ret[] = $in . substr($item,2,-1) .';';
-                    continue;
+                    continue 2;
                 
                 
                 case (substr($item,1,3) == 'if('):
                     $ret[] = $in . substr($item,1,-1) . ' {';
                     $indent++;
-                    continue;
+                    continue 2;
                 
                 case (substr($item,1,5) == 'else:'):
                     $indent--;
                     $in = str_repeat("    ", $indent);
                     $ret[] = $in . "} else { ";
                     $indent++;
-                    continue;
+                    continue 2;
                  
                 case (substr($item,1,4) == 'end:'):
                     $indent--;
@@ -176,11 +176,11 @@ class Pman_Core_JsTemplate extends Pman {
                         $fstart = -1;
                         $ret = &$out;
                     }
-                    continue;
+                    continue 2;
                 
                 case (substr($item,1,7) == 'return:'):
                     $ret[] = $in . "return;";
-                    continue;
+                    continue 2;
                 
                 case (substr($item,1,9) == 'function:'):
                     $fstart = $indent;
@@ -191,19 +191,19 @@ class Pman_Core_JsTemplate extends Pman {
                     
                     
                     $ret[] = $in . "var $name = function (" .  $body  . '{';
-                    continue;
+                    continue 2;
                 
                 default:
                     if (substr($item,-3,2) == ':h') {
                         $ret[] = $in . "ret += ".  substr($item,1,-3) . ';';
-                        continue;
+                        continue 2;
                     }
                     if (substr($item,-3,2) == ':b') {
                         $ret[] = $in . "ret += Roo.util.Format.htmlEncode(".  substr($item,1,-3).').split("\n").join("<br/>\n");';
-                        continue;
+                        continue 2;
                     }
                     $ret[] = $in . "ret += Roo.util.Format.htmlEncode(".  substr($item,1,-1).');';
-                    continue;
+                    continue 2;
                 
             }
             
index 3f0f4d4..9a929f1 100644 (file)
@@ -257,7 +257,7 @@ trait Pman_Core_RooTrait {
                         $x->whereAdd("(on_id = $oid  OR 
                                 on_id IN ( SELECT distinct(id) FROM Documents WHERE original = $o ) 
                             )");
-                        continue;
+                        continue 2;
                                 
                     }
                     $x->on_id = $val;
@@ -281,7 +281,7 @@ trait Pman_Core_RooTrait {
                     }
                     
                     
-                    continue;
+                    continue 2;
             }
         }
         if (!empty($q_filtered)) {
index c762a48..d3ec063 100644 (file)
@@ -249,18 +249,20 @@ class Pman_Core_UpdateDatabase extends Pman
         
         // this will trigger errors about freetext indexes - we will have to remove them manually.?
         // otherwise we need to do an sql query to find them, then remove them (not really worth it as it only affects really old code..)
-        
+        echo "Run extensions\n";
+
         $this->runExtensions(); 
 
         
         if (empty($opts['data-only'])) {
+            echo "Import SQL\n";
             $this->importSQL();
         }
         if (!empty($opts['only-module-sql'])) {
             return;
         }
         
-        
+        echo "run Update Modules Data\n";
 
         $this->runUpdateModulesData();
         
@@ -1226,6 +1228,7 @@ class Pman_Core_UpdateDatabase extends Pman
             if (!file_exists(__DIR__.'/UpdateDatabase/'. $scls .'.php')) {
                 return;
             }
+            echo "Running : {$fn}\n";
             require_once $fn;
             $c = new $cls();
             
index 374e6d7..ba81c63 100644 (file)
@@ -13,10 +13,15 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
     
     function __construct()
     {
-          
+        // this might get run before we have imported the database
+        // and hence not have any db.
         $this->loadIniFiles(); //?? shared???
         
+       
         $dbo = DB_DataObject::factory('core_enum');
+        
+        
+       
         if (is_a($dbo, 'PDO_DataObject')) {
             
             $this->views = $dbo->generator()->introspection()->getListOf('views');
@@ -28,10 +33,9 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
         // update the engine first - get's around 1000 character limit on indexes..cd
         // however - Innodb does not support fulltext indexes, so this may fail...
         $this->updateEngine(); 
-        
         $this->updateCharacterSet();
-        
-        
+         
     }
     
     function loadIniFiles()
@@ -113,6 +117,7 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
     {
         $db = DB_DataObject::factory('core_enum');
         $db->query("show variables like 'innodb_file_per_table'");
+        
         $db->fetch();
         
         $pg = HTML_FlexyFramework::get()->page;
@@ -133,7 +138,7 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
         
         $views = $this->views;
         
-        
+         echo "a3\n";
         foreach (array_keys($this->schema) as $tbl){
             
             if(strpos($tbl, '__keys') !== false ){
index 07cf02f..02db548 100644 (file)
@@ -40,7 +40,7 @@ class Pman_Core_UpdateDatabase_MysqlLinks {
     
     var $dburl;
     var $schema;
-    var $links;
+    var $links = array();
     
     function __construct()
     {
@@ -79,7 +79,11 @@ class Pman_Core_UpdateDatabase_MysqlLinks {
         
         
         $iniCache = isset( $ff->PDO_DataObject) ?  $ff->PDO_DataObject['schema_location'] : $ff->DB_DataObject[$dbini];
-               
+        
+        if (strpos($iniCache, DIRECTORY_SEPARATOR) !== false) {
+            echo "SKIP links code - cached ini file has not been created\n";
+            return;
+        }
         $this->schema = parse_ini_file($iniCache, true);
         $this->links = parse_ini_file(preg_replace('/\.ini$/', '.links.ini', $iniCache), true);