Index: install/english.lang
===================================================================
--- install/english.lang (revision 15378)
+++ install/english.lang (working copy)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<LANGUAGES Version="6">
<LANGUAGE Encoding="base64" PackName="English" LocalName="English" DateFormat="m/d/Y" TimeFormat="g:i A" InputDateFormat="m/d/Y" InputTimeFormat="g:i:s A" DecimalPoint="." ThousandSep="," Charset="utf-8" UnitSystem="2" Locale="en-US" UserDocsUrl="http://docs.in-portal.org/eng/index.php">
<EMAILDESIGNS>
@@ -148,6 +149,7 @@
<PHRASE Label="la_config_AutoRefreshIntervals" Module="Core" Type="1">TGlzdCBhdXRvbWF0aWMgcmVmcmVzaCBpbnRlcnZhbHMgKGluIG1pbnV0ZXMp</PHRASE>
<PHRASE Label="la_config_backup_path" Module="Core" Type="1">QmFja3VwIFBhdGg=</PHRASE>
<PHRASE Label="la_config_CatalogPreselectModuleTab" Module="Core" Type="1">U3dpdGNoIENhdGFsb2cgdGFicyBiYXNlZCBvbiBNb2R1bGU=</PHRASE>
+ <PHRASE Label="la_config_CategoryPermissionRebuildMode" Module="Core" Type="1" Hint="TWFudWFsIC0gbmV2ZXIgcmVidWlsZCBhdXRvbWF0aWNhbGx5DQpTaWxlbnQgLSBhbHdheXMgcmVidWlsZCB3aXRob3V0IHByb2dyZXNzIGJhcg0KQXV0b21hdGljIC0gYWx3YXlzIHJlYnVpbGQsIGJ1dCB1c2UgcHJvZ3Jlc3MgYmFyIG9uIGxhcmdlIHNlY3Rpb24gY291bnQ=">U2VjdGlvbiBQZXJtaXNzaW9uIFJlYnVpbGQgTW9kZQ==</PHRASE>
<PHRASE Label="la_config_CheckStopWords" Module="Core" Type="1">Q2hlY2sgU3RvcCBXb3Jkcw==</PHRASE>
<PHRASE Label="la_config_CKFinderLicenseKey" Module="Core" Type="1">Q0tGaW5kZXIgTGljZW5zZSBLZXk=</PHRASE>
<PHRASE Label="la_config_CKFinderLicenseName" Module="Core" Type="1">Q0tGaW5kZXIgTGljZW5zZSBOYW1l</PHRASE>
@@ -190,7 +192,6 @@
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
<PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1" Hint="U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
- <PHRASE Label="la_config_QuickCategoryPermissionRebuild" Module="Core" Type="1">UXVpY2sgU2VjdGlvbiBQZXJtaXNzaW9uIFJlYnVpbGQ=</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
<PHRASE Label="la_config_RegistrationUsernameRequired" Module="Core" Type="1">VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==</PHRASE>
<PHRASE Label="la_config_RememberLastAdminTemplate" Module="Core" Type="1">UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==</PHRASE>
@@ -770,6 +771,7 @@
<PHRASE Label="la_opt_AnimationFade" Module="Core" Type="1">RmFkZQ==</PHRASE>
<PHRASE Label="la_opt_AnimationSlide" Module="Core" Type="1">U2xpZGU=</PHRASE>
<PHRASE Label="la_opt_AutoDetect" Module="Core" Type="1">QXV0by1EZXRlY3Q=</PHRASE>
+ <PHRASE Label="la_opt_Automatic" Module="Core" Type="1">QXV0b21hdGlj</PHRASE>
<PHRASE Label="la_opt_Before" Module="Core" Type="1">QmVmb3Jl</PHRASE>
<PHRASE Label="la_opt_Bounce" Module="Core" Type="1">Qm91bmNlZA==</PHRASE>
<PHRASE Label="la_opt_Cancelled" Module="Core" Type="1">Q2FuY2VsZWQ=</PHRASE>
@@ -815,6 +817,7 @@
<PHRASE Label="la_opt_IsUnique" Module="Core" Type="1">SXMgdW5pcXVl</PHRASE>
<PHRASE Label="la_opt_LastName" Module="Core" Type="1">TGFzdCBOYW1l</PHRASE>
<PHRASE Label="la_opt_LoggedOut" Module="Core" Type="1">TG9nZ2VkIE91dA==</PHRASE>
+ <PHRASE Label="la_opt_Manual" Module="Core" Type="1">TWFudWFs</PHRASE>
<PHRASE Label="la_opt_min" Module="Core" Type="1">bWludXRlKHMp</PHRASE>
<PHRASE Label="la_opt_ModalWindow" Module="Core" Type="1">TW9kYWwgV2luZG93</PHRASE>
<PHRASE Label="la_opt_month" Module="Core" Type="1">bW9udGgocyk=</PHRASE>
@@ -843,6 +846,7 @@
<PHRASE Label="la_opt_SameWindow" Module="Core" Type="1">U2FtZSBXaW5kb3c=</PHRASE>
<PHRASE Label="la_opt_sec" Module="Core" Type="1">c2Vjb25kKHMp</PHRASE>
<PHRASE Label="la_opt_Semicolon" Module="Core" Type="1">U2VtaS1jb2xvbg==</PHRASE>
+ <PHRASE Label="la_opt_Silent" Module="Core" Type="1">U2lsZW50</PHRASE>
<PHRASE Label="la_opt_Space" Module="Core" Type="1">U3BhY2U=</PHRASE>
<PHRASE Label="la_opt_State" Module="Core" Type="1">U3RhdGU=</PHRASE>
<PHRASE Label="la_opt_Sub-match" Module="Core" Type="1">U3ViLW1hdGNo</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15359)
+++ install/install_data.sql (working copy)
@@ -11,7 +11,7 @@
INSERT INTO SystemSettings VALUES(DEFAULT, 'AllowDeleteRootCats', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_AllowDeleteRootCats', 'checkbox', NULL, NULL, 10.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Catalog_PreselectModuleTab', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_CatalogPreselectModuleTab', 'checkbox', NULL, NULL, 10.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RecycleBinFolder', '', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_RecycleBinFolder', 'text', NULL, NULL, 10.10, 0, 0, NULL);
-INSERT INTO SystemSettings VALUES(DEFAULT, 'QuickCategoryPermissionRebuild', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_QuickCategoryPermissionRebuild', 'checkbox', NULL, NULL, 10.11, 0, 0, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'CategoryPermissionRebuildMode', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_CategoryPermissionRebuildMode', 'select', NULL, '1=la_opt_Manual||2=la_opt_Silent||3=la_opt_Automatic', 10.11, 0, 0, 'hint:la_config_CategoryPermissionRebuildMode');
INSERT INTO SystemSettings VALUES(DEFAULT, 'FilenameSpecialCharReplacement', '-', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_FilenameSpecialCharReplacement', 'select', NULL, '_=+_||-=+-', 10.12, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Search_MinKeyword_Length', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_Search_MinKeyword_Length', 'text', NULL, NULL, 10.13, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ExcludeTemplateSectionsFromSearch', '0', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_ExcludeTemplateSectionsFromSearch', 'checkbox', '', '', 10.14, 0, 0, NULL);
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 15375)
+++ install/install_toolkit.php (working copy)
@@ -887,14 +887,16 @@
$this->Conn->Query('DELETE FROM ' . TABLE_PREFIX . 'CachedUrls');
if ( $refresh_permissions ) {
- if ( $this->Application->ConfigValue('QuickCategoryPermissionRebuild') ) {
+ $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode');
+
+ if ( $rebuild_mode == CategoryPermissionRebuild::SILENT ) {
// refresh permission without progress bar
$updater = $this->Application->makeClass('kPermCacheUpdater');
/* @var $updater kPermCacheUpdater */
$updater->OneStepRun();
}
- else {
+ elseif ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC ) {
// refresh permissions with ajax progress bar (when available)
$this->Application->setDBCache('ForcePermCacheUpdate', 1);
}
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 15390)
+++ install/upgrades.sql (working copy)
@@ -2756,3 +2756,7 @@
ADD CachedTemplateHash INT UNSIGNED NOT NULL DEFAULT '0' AFTER CachedTemplate,
ADD INDEX (NamedParentPathHash),
ADD INDEX (CachedTemplateHash);
+
+# ===== v 5.2.0 =====
+INSERT INTO SystemSettings VALUES(DEFAULT, 'CategoryPermissionRebuildMode', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_CategoryPermissionRebuildMode', 'select', NULL, '1=la_opt_Manual||2=la_opt_Silent||3=la_opt_Automatic', 10.11, 0, 0, 'hint:la_config_CategoryPermissionRebuildMode');
+DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_CONFIG_QUICKCATEGORYPERMISSIONREBUILD';
Index: kernel/constants.php
===================================================================
--- kernel/constants.php (revision 15359)
+++ kernel/constants.php (working copy)
@@ -189,4 +189,10 @@
const PS_DATE_TIME = 'DATE-TIME';
const PS_PREFIX = 'PREFIX';
const PS_USER = 'USER';
- }
\ No newline at end of file
+ }
+
+class CategoryPermissionRebuild {
+ const MANUAL = 1;
+ const SILENT = 2;
+ const AUTOMATIC = 3;
+}
Index: units/admin/admin_tag_processor.php
===================================================================
--- units/admin/admin_tag_processor.php (revision 15420)
+++ units/admin/admin_tag_processor.php (working copy)
@@ -590,10 +590,11 @@
$global_mark = $this->Application->getDBCache('ForcePermCacheUpdate');
$local_mark = $this->Application->RecallVar('PermCache_UpdateRequired');
- if ($global_mark || $local_mark) {
+ if ( $global_mark || $local_mark ) {
$this->Application->RemoveVar('PermCache_UpdateRequired');
+ $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode');
- if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild')) {
+ if ( $rebuild_mode == CategoryPermissionRebuild::SILENT ) {
$updater = $this->Application->makeClass('kPermCacheUpdater');
/* @var $updater kPermCacheUpdater */
@@ -601,7 +602,7 @@
$this->Application->HandleEvent(new kEvent('c:OnResetCMSMenuCache'));
}
- else {
+ elseif ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC ) {
// update with progress bar
return true;
}
Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php (revision 15417)
+++ units/categories/categories_event_handler.php (working copy)
@@ -601,7 +601,7 @@
{
static $page_by_template = Array ();
- if ($event->Special == 'current') {
+ if ( $event->Special == 'current' ) {
return $this->Application->GetVar('m_cat_id');
}
@@ -609,14 +609,14 @@
$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,8 +2231,8 @@
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)
@@ -2236,26 +2240,26 @@
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;
}
Index: units/categories/categories_tag_processor.php
===================================================================
--- units/categories/categories_tag_processor.php (revision 15418)
+++ units/categories/categories_tag_processor.php (working copy)
@@ -511,39 +511,44 @@
kUtil::safeDefine('CACHE_PERM_CHUNK_SIZE', 30);
$continue = $this->Application->GetVar('continue');
- $total_cats = (int) $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Categories');
+ $total_cats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'Categories');
- if ($continue === false && $total_cats > CACHE_PERM_CHUNK_SIZE) {
- // first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update
- return true;
- }
+ if ( $continue === false ) {
+ $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode');
- if ($continue === false) {
+ if ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC && $total_cats > CACHE_PERM_CHUNK_SIZE ) {
+ // first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update
+ return true;
+ }
+
// if we don't have to ask, then assume user selected "Yes" in permcache update dialog
$continue = 1;
}
- $updater = $this->Application->makeClass('kPermCacheUpdater', Array($continue));
+ $updater = $this->Application->makeClass('kPermCacheUpdater', Array ($continue));
/* @var $updater kPermCacheUpdater */
- if ($continue === '0') { // No in dialog
+ if ( $continue === '0' ) { // No in dialog
$updater->clearData();
$this->Application->Redirect($params['destination_template']);
}
$ret = false; // don't ask for update
- if ($continue == 1) { // Initial run
+
+ if ( $continue == 1 ) { // Initial run
$updater->setData();
}
- if ($continue == 2) { // Continuing
+
+ if ( $continue == 2 ) { // Continuing
// called from AJAX request => returns percent
$needs_more = true;
- while ($needs_more && $updater->iteration <= CACHE_PERM_CHUNK_SIZE) {
- // until proceeeded in this step category count exceeds category per step limit
+
+ while ( $needs_more && $updater->iteration <= CACHE_PERM_CHUNK_SIZE ) {
+ // until proceeded in this step category count exceeds category per step limit
$needs_more = $updater->DoTheJob();
}
- if ($needs_more) {
+ if ( $needs_more ) {
// still some categories are left for next step
$updater->setData();
}
@@ -560,6 +565,7 @@
$ret = $updater->getDonePercent();
}
+
return $ret;
}