From 3dfa28ee12e72e27f69a7734bef807c2628e5d53 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 2 Dec 2019 16:12:51 +0800 Subject: [PATCH] Fix #6111 - set up basic infrastructure --- Bjs.php | 2 +- JsTemplate.php | 30 +++++++++++++-------------- RooTrait.php | 4 ++-- UpdateDatabase.php | 7 +++++-- UpdateDatabase/MysqlEngineCharset.php | 15 +++++++++----- UpdateDatabase/MysqlLinks.php | 8 +++++-- 6 files changed, 39 insertions(+), 27 deletions(-) diff --git a/Bjs.php b/Bjs.php index d936bcf9..f2a4379e 100644 --- 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.. diff --git a/JsTemplate.php b/JsTemplate.php index f1387913..ec79d0c4 100644 --- a/JsTemplate.php +++ b/JsTemplate.php @@ -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("
\n");'; - continue; + continue 2; } $ret[] = $in . "ret += Roo.util.Format.htmlEncode(". substr($item,1,-1).');'; - continue; + continue 2; } diff --git a/RooTrait.php b/RooTrait.php index 3f0f4d4f..9a929f1e 100644 --- a/RooTrait.php +++ b/RooTrait.php @@ -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)) { diff --git a/UpdateDatabase.php b/UpdateDatabase.php index c762a48e..d3ec063c 100644 --- a/UpdateDatabase.php +++ b/UpdateDatabase.php @@ -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(); diff --git a/UpdateDatabase/MysqlEngineCharset.php b/UpdateDatabase/MysqlEngineCharset.php index 374e6d7b..ba81c636 100644 --- a/UpdateDatabase/MysqlEngineCharset.php +++ b/UpdateDatabase/MysqlEngineCharset.php @@ -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 ){ diff --git a/UpdateDatabase/MysqlLinks.php b/UpdateDatabase/MysqlLinks.php index 07cf02ff..02db5481 100644 --- a/UpdateDatabase/MysqlLinks.php +++ b/UpdateDatabase/MysqlLinks.php @@ -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); -- 2.39.2