Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r15417 -r15421 --- branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15417) +++ branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15421) @@ -1,6 +1,6 @@ Special == 'current') { + if ( $event->Special == 'current' ) { return $this->Application->GetVar('m_cat_id'); } $event->setEventParam('raise_warnings', 0); $page_id = parent::getPassedID($event); - if ($page_id === false) { + if ( $page_id === false ) { $template = $event->getEventParam('page'); - if (!$template) { + if ( !$template ) { $template = $this->Application->GetVar('t'); } // bug: when template contains "-" symbols (or others, that stripDisallowed will replace) it's not found - if (!array_key_exists($template, $page_by_template)) { + if ( !array_key_exists($template, $page_by_template) ) { $template_crc = kUtil::crc32(mb_strtolower($template)); $sql = 'SELECT ' . $this->Application->getUnitOption($event->Prefix, 'IDField') . ' @@ -633,14 +633,16 @@ $page_id = $page_by_template[$template]; } - if ($page_id === false && EDITING_MODE) { + if ( $page_id === false && EDITING_MODE ) { // create missing pages, when in editing mode - $object = $this->Application->recallObject($this->Prefix . '.rebuild', null, Array('skip_autoload' => true)); + $object = $this->Application->recallObject($this->Prefix . '.rebuild', NULL, Array ('skip_autoload' => true)); /* @var $object CategoriesItem */ - $created = $this->_prepareAutoPage($object, $template, null, SMS_MODE_AUTO); // create virtual (not system!) page - if ($created) { - if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild') || !$this->Application->isAdmin) { + $created = $this->_prepareAutoPage($object, $template, NULL, SMS_MODE_AUTO); // create virtual (not system!) page + if ( $created ) { + $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode'); + + if ( $rebuild_mode == CategoryPermissionRebuild::SILENT || !$this->Application->isAdmin ) { $updater = $this->Application->makeClass('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ @@ -656,12 +658,12 @@ } } - if ($page_id) { + if ( $page_id ) { $page_by_template[$template] = $page_id; } } - if (!$page_id && !$this->Application->isAdmin) { + if ( !$page_id && !$this->Application->isAdmin ) { $page_id = $this->Application->GetVar('m_cat_id'); } @@ -1259,13 +1261,15 @@ */ protected function _ensurePermCacheRebuild($event) { - if ( $this->Application->ConfigValue('QuickCategoryPermissionRebuild') ) { + $rebild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode'); + + if ( $rebild_mode == CategoryPermissionRebuild::SILENT ) { $updater = $this->Application->makeClass('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ $updater->OneStepRun(); } - else { + elseif ( $rebild_mode == CategoryPermissionRebuild::AUTOMATIC ) { // rebuild with progress bar $event->redirect = 'categories/cache_updater'; } @@ -2227,35 +2231,35 @@ function OnAfterRebuildThemes($event) { $sql = 'SELECT t.ThemeId, CONCAT( tf.FilePath, \'/\', tf.FileName ) AS Path, tf.FileMetaInfo - FROM '.TABLE_PREFIX.'ThemeFiles AS tf - LEFT JOIN '.TABLE_PREFIX.'Themes AS t ON t.ThemeId = tf.ThemeId + FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf + LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId WHERE t.Enabled = 1 AND tf.FileType = 1 AND ( SELECT COUNT(CategoryId) FROM ' . TABLE_PREFIX . 'Categories c WHERE CONCAT(\'/\', c.Template, \'.tpl\') = CONCAT( tf.FilePath, \'/\', tf.FileName ) AND (c.ThemeId = t.ThemeId) ) = 0 '; $files = $this->Conn->Query($sql, 'Path'); - if (!$files) { + if ( !$files ) { // all possible pages are already created - return ; + return; } set_time_limit(0); ini_set('memory_limit', -1); - $dummy = $this->Application->recallObject($event->Prefix . '.rebuild', null, Array ('skip_autoload' => true)); + $dummy = $this->Application->recallObject($event->Prefix . '.rebuild', NULL, Array ('skip_autoload' => true)); /* @var $dummy CategoriesItem */ $error_count = 0; foreach ($files as $a_file => $file_info) { $status = $this->_prepareAutoPage($dummy, $a_file, $file_info['ThemeId'], SMS_MODE_FORCE, unserialize($file_info['FileMetaInfo'])); // create system page - if (!$status) { + if ( !$status ) { $error_count++; } } - if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild')) { + if ( $this->Application->ConfigValue('CategoryPermissionRebuildMode') == CategoryPermissionRebuild::SILENT ) { $updater = $this->Application->makeClass('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ @@ -2264,7 +2268,7 @@ $this->_resetMenuCache(); - if ($error_count) { + if ( $error_count ) { // allow user to review error after structure page creation $event->MasterEvent->redirect = false; }