From ad288b3f1d8dee15e483e63ea158aad2c4677341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Mon, 10 Jul 2023 05:56:05 +0000 Subject: [PATCH] * Use isServing() instead of IN_USE. --- .../ext/model/hook/loadConfigFromDB.xuanxuan.php | 2 +- framework/control.class.php | 2 +- framework/router.class.php | 10 ++++++++++ module/common/view/header.lite.html.php | 2 +- module/user/model.php | 2 +- www/index.php | 1 - 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/extension/xuanxuan/extension/xuan/common/ext/model/hook/loadConfigFromDB.xuanxuan.php b/extension/xuanxuan/extension/xuan/common/ext/model/hook/loadConfigFromDB.xuanxuan.php index dfa1c25ac0..436ce8f7cd 100644 --- a/extension/xuanxuan/extension/xuan/common/ext/model/hook/loadConfigFromDB.xuanxuan.php +++ b/extension/xuanxuan/extension/xuan/common/ext/model/hook/loadConfigFromDB.xuanxuan.php @@ -1,5 +1,5 @@ app->isServing() || (defined('RUN_MODE') && RUN_MODE == 'api')) { $this->loadModel('setting'); $xxItems = $this->setting->getItems('owner=system&module=common§ion=xuanxuan'); diff --git a/framework/control.class.php b/framework/control.class.php index 8c1c72c37e..8039e915c1 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -38,7 +38,7 @@ class control extends baseControl if($this->config->edition == 'open') return false; /* Code for task #9224. Set requiredFields for workflow. */ - if($this->dbh and (defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api'))) + if($this->dbh && ($this->app->isServing() || (defined('RUN_MODE') and RUN_MODE == 'api'))) { $this->extendExportFields(); $this->extendEditorFields(); diff --git a/framework/router.class.php b/framework/router.class.php index 5d9bf6cd4b..6692ccddbb 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -73,6 +73,16 @@ class router extends baseRouter */ public $fetchModule; + /** + * Check whether app is serving. + * @access public + * @return bool + */ + public function isServing() + { + return !$this->installing && !$this->upgrading; + } + /** * Get the $moduleRoot var. * diff --git a/module/common/view/header.lite.html.php b/module/common/view/header.lite.html.php index 5cb39c9cda..33729b2d77 100755 --- a/module/common/view/header.lite.html.php +++ b/module/common/view/header.lite.html.php @@ -48,7 +48,7 @@ $commonLang = array('zh-cn', 'zh-tw', 'en', 'fr', 'de'); } if($this->app->getViewType() == 'xhtml') css::import($defaultTheme . 'x.style.css'); - if(defined('IN_USE') and commonModel::isTutorialMode()) + if($this->app->isServing() && commonModel::isTutorialMode()) { $wizardModule = isset($_SESSION['wizardModule']) ? $_SESSION['wizardModule'] : $this->moduleName; $wizardMethod = isset($_SESSION['wizardMethod']) ? $_SESSION['wizardMethod'] : $this->methodName; diff --git a/module/user/model.php b/module/user/model.php index b0ba0c1475..798f3df4ff 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -948,7 +948,7 @@ class userModel extends model } /* code for bug #2729. */ - if(defined('IN_USE')) $this->dao->update(TABLE_USER)->set('visits = visits + 1')->set('ip')->eq($ip)->set('last')->eq($last)->where('account')->eq($account)->exec(); + if($this->app->isServing()) $this->dao->update(TABLE_USER)->set('visits = visits + 1')->set('ip')->eq($ip)->set('last')->eq($last)->where('account')->eq($account)->exec(); /* Create cycle todo in login. */ $todoList = $this->dao->select('*')->from(TABLE_TODO)->where('cycle')->eq(1)->andWhere('deleted')->eq('0')->andWhere('account')->eq($user->account)->fetchAll('id'); diff --git a/www/index.php b/www/index.php index af3f4985e6..06b30afa84 100644 --- a/www/index.php +++ b/www/index.php @@ -13,7 +13,6 @@ */ /* Set the error reporting. */ error_reporting(E_ALL); -define('IN_USE', true); /* Start output buffer. */ ob_start();