From 4dca482319fc40c2a8c9966d21dd585cd775b5c7 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 26 Nov 2020 10:16:44 +0800 Subject: [PATCH] performance with counts --- Pman.php | 8 +++++++- Pman/Roo.php | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Pman.php b/Pman.php index 06b707e..abef5f9 100644 --- a/Pman.php +++ b/Pman.php @@ -755,9 +755,11 @@ class Pman extends HTML_FlexyFramework_Page $mods = $this->modulesList(); - + $is_bootstrap = in_array('BAdmin', $mods); + $this->callModules('applyCSSIncludes', $this); foreach($this->css_includes as $module => $ar) { + if ($ar) { $this->assetArrayToHtml( $ar , 'css'); } @@ -768,6 +770,10 @@ class Pman extends HTML_FlexyFramework_Page foreach($mods as $mod) { // add the css file.. + if ($is_bootstrap && !file_exists($this->rootDir."/Pman/$mod/is_bootstrap")) { + echo '"; + continue; + } $this->outputCSSDir("Pman/$mod","*.css"); } diff --git a/Pman/Roo.php b/Pman/Roo.php index 3cccb1a..a173d24 100644 --- a/Pman/Roo.php +++ b/Pman/Roo.php @@ -243,12 +243,11 @@ class Pman_Roo extends Pman // sets map and countWhat $this->loadMap($x, array( - 'columns' => $_columns, - 'distinct' => empty($_REQUEST['_distinct']) ? false: $_REQUEST['_distinct'], - 'exclude' => empty($_REQUEST['_exclude_columns']) ? false: explode(',', $_REQUEST['_exclude_columns']) - )); - - + 'columns' => $_columns, + 'distinct' => empty($_REQUEST['_distinct']) ? false: $_REQUEST['_distinct'], + 'exclude' => empty($_REQUEST['_exclude_columns']) ? false: explode(',', $_REQUEST['_exclude_columns']) + )); + $this->setFilters($x,$_REQUEST); if (!$this->checkPerm($x,'S', $_REQUEST)) { @@ -258,8 +257,13 @@ class Pman_Roo extends Pman //print_r($x); // build join if req. //DB_DataObject::debugLevel(1); - // var_dump($this->countWhat); - $total = $x->count($this->countWhat); + // count with multiple joins and no conditions can be quite slow - so if there are no conditions - just remove the joins from the count. + $xx = clone($x); + if (empty($xx->_query['condition']) && !empty($xx->_join)) { + $xx->_join = ''; + } + + $total = $xx->count($this->countWhat); // sorting.. // //var_dump($total);exit; -- 2.39.2