From 993e29957c4f5a673682b5807345f72bbd468640 Mon Sep 17 00:00:00 2001 From: john Date: Tue, 2 Oct 2018 17:52:16 +0800 Subject: [PATCH] sync --- UpdateDatabase.php | 15 ++++----- UpdateDatabase/VerifyExtensions.php | 49 +++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/UpdateDatabase.php b/UpdateDatabase.php index fe6656e6..70693bb3 100644 --- a/UpdateDatabase.php +++ b/UpdateDatabase.php @@ -157,7 +157,6 @@ class Pman_Core_UpdateDatabase extends Pman function get($args, $opts=array()) { - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError')); $this->checkSystem(); @@ -197,7 +196,14 @@ class Pman_Core_UpdateDatabase extends Pman echo "Checi options\n"; $this->checkOpts($opts); - + $response = $this->curl("http://localhost{$this->local_base_url}/Core/UpdateDatabase/VerifyExtensions"); + $json = json_decode($response, true); + + if(empty($json['data']) || $json['data'] != 'DONE'){ + echo $response. "\n"; + echo "Please install the above extensions and restart the apache.\n"; + exit; + } // do this first, so the innodb change + utf8 fixes column max sizes @@ -986,7 +992,6 @@ class Pman_Core_UpdateDatabase extends Pman } HTML_FlexyFramework::get()->generateDataobjectsCache(true); - $this->updateDataEnums(); $this->updateDataGroups(); $this->updateDataCompanies(); @@ -995,10 +1000,6 @@ class Pman_Core_UpdateDatabase extends Pman $c = DB_DataObject::Factory('I18n'); $c->buildDB(); - - - - } function fixMysqlInnodb() diff --git a/UpdateDatabase/VerifyExtensions.php b/UpdateDatabase/VerifyExtensions.php index 6f543383..10763a50 100644 --- a/UpdateDatabase/VerifyExtensions.php +++ b/UpdateDatabase/VerifyExtensions.php @@ -1,11 +1,54 @@ required_extensions);exit; + $extensions = $error = array(); + + $ff = HTML_FlexyFramework::get(); + + foreach($this->modulesList() as $m) { + + $fd = $ff->rootDir. "/Pman/$m/UpdateDatabase.php"; + + if (!file_exists($fd)) { + continue; + } + require_once $fd; + $cls = new ReflectionClass('Pman_'. $m . '_UpdateDatabase'); + $props = $cls->getDefaultProperties(); + + if(!empty($props['required_extensions'])) { + $extensions = array_merge($extensions, $props['required_extensions']); + } + } + + foreach ($extensions as $e){ + + if(extension_loaded($e)) { + continue; + } + + $error[] = "Error: Please install php extension: {$e}"; + } + + if(!empty($error)) { + $this->jerr($error); + } + + $this->jok("DONE"); + } } \ No newline at end of file -- 2.39.2