Skip to content

Commit

Permalink
#3359 Reset php opcache when cache is cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Trofimov committed Jan 5, 2022
1 parent 7deb646 commit 6def70d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
12 changes: 11 additions & 1 deletion inc/classes/BxDolCacheUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct ()
'css' => array('option' => 'sys_template_cache_css_enable'),
'js' => array('option' => 'sys_template_cache_js_enable'),
'purifier' => array(),
'opcache' => array(),
'custom' => array(),
);
}
Expand All @@ -44,6 +45,9 @@ function isEnabled($sCache)
if(!isset($this->_aCacheTypes[$sCache]))
return false;

if ('opcache' == $sCache)
return function_exists('opcache_reset');

return !isset($this->_aCacheTypes[$sCache]['option']) || getParam($this->_aCacheTypes[$sCache]['option']) == 'on';
}

Expand Down Expand Up @@ -102,7 +106,13 @@ protected function _action($sCache, $sMode = 'clear')
$oConfig->set('Cache.DefinitionImpl', null);
$oHtmlPurifier = new HTMLPurifier($oConfig);
$oHtmlPurifier->purify('');
break;
$mixedResult = array('code' => 0, 'message' => _t('_adm_dbd_msg_c_clean_success'));
break;
case 'opcache':
if (function_exists('opcache_reset'))
opcache_reset();
$mixedResult = array('code' => 0, 'message' => _t('_adm_dbd_msg_c_clean_success'));
break;
}

return $mixedResult;
Expand Down
3 changes: 2 additions & 1 deletion modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@
<string name="_adm_dbd_txt_c_clear_purifier"><![CDATA[Clear Purifier cache]]></string>
<string name="_adm_dbd_txt_c_js"><![CDATA[JavaScript]]></string>
<string name="_adm_dbd_txt_c_clear_js"><![CDATA[Clear JavaScript cache]]></string>
<string name="_adm_dbd_txt_c_clear_custom"><![CDATA[Clear Custom cache]]></string>
<string name="_adm_dbd_txt_c_clear_custom"><![CDATA[Clear Custom cache]]></string>
<string name="_adm_dbd_txt_c_clear_opcache"><![CDATA[Clear Opcache]]></string>
<string name="_adm_dbd_err_c_clean_failed"><![CDATA[Failed to clean cache]]></string>
<string name="_adm_dbd_msg_c_clean_success"><![CDATA[Cache was successfully cleaned]]></string>
<string name="_adm_dbd_msg_c_all_disabled"><![CDATA[All caches are disabled]]></string>
Expand Down
3 changes: 2 additions & 1 deletion modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@
<string name="_adm_dbd_txt_c_clear_purifier"><![CDATA[Очистить кэш Purifier]]></string>
<string name="_adm_dbd_txt_c_js"><![CDATA[JavaScript]]></string>
<string name="_adm_dbd_txt_c_clear_js"><![CDATA[Очистить кэш JavaScript]]></string>
<string name="_adm_dbd_txt_c_clear_custom"><![CDATA[Очистить специальный кэш]]></string>
<string name="_adm_dbd_txt_c_clear_custom"><![CDATA[Очистить специальный кэш]]></string>
<string name="_adm_dbd_txt_c_clear_opcache"><![CDATA[Очистить Opcache]]></string>
<string name="_adm_dbd_err_c_clean_failed"><![CDATA[Не удалось очистить кэш]]></string>
<string name="_adm_dbd_msg_c_clean_success"><![CDATA[Кэш был удачно очищен]]></string>
<string name="_adm_dbd_msg_c_all_disabled"><![CDATA[Весь кэш был отключён]]></string>
Expand Down
1 change: 1 addition & 0 deletions studio/classes/BxDolStudioDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function __construct()
array('name' => 'css'),
array('name' => 'js'),
array('name' => 'purifier'),
array('name' => 'opcache'),
array('name' => 'custom')
);

Expand Down

0 comments on commit 6def70d

Please sign in to comment.