Fixed: KPI access is now under employee permission in back-office
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -149,6 +149,24 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
'icon' => 'icon-bug'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Debug mode'),
|
||||
'name' => 'debug_mode',
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
),
|
||||
'hint' => $this->l('Enable or disable debug mode. Debug mode will enable extended error reporting.')
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Disable non QloApps modules'),
|
||||
@@ -196,6 +214,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
);
|
||||
|
||||
$this->fields_value['native_module'] = Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
|
||||
$this->fields_value['debug_mode'] = _PS_MODE_DEV_;
|
||||
$this->fields_value['overrides'] = Configuration::get('PS_DISABLE_OVERRIDES');
|
||||
}
|
||||
|
||||
@@ -885,6 +904,12 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
if (Tools::isSubmit('submitAddconfiguration')) {
|
||||
Configuration::updateGlobalValue('PS_DISABLE_NON_NATIVE_MODULE', (int)Tools::getValue('native_module'));
|
||||
Configuration::updateGlobalValue('PS_DISABLE_OVERRIDES', (int)Tools::getValue('overrides'));
|
||||
|
||||
$debugValue = ((int) Tools::getValue('debug_mode') === 1) ? 'true' : 'false';
|
||||
if (!$this->updateDebugMode($debugValue)) {
|
||||
$this->errors[] = $this->l('Unable to update debug mode. Please check file permissions.');
|
||||
}
|
||||
|
||||
Tools::generateIndex();
|
||||
}
|
||||
|
||||
@@ -894,6 +919,26 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDebugMode($value)
|
||||
{
|
||||
$filename = _PS_ROOT_DIR_ . '/config/defines.inc.php';
|
||||
|
||||
if (is_readable($filename)) {
|
||||
$cleanedFileContent = php_strip_whitespace($filename);
|
||||
if (preg_match('/define\(\'_PS_MODE_DEV_\', ([a-zA-Z]+)\);/Ui', $cleanedFileContent)) {
|
||||
$fileContent = Tools::file_get_contents($filename);
|
||||
$fileContent = preg_replace('/define\(\'_PS_MODE_DEV_\', ([a-zA-Z]+)\);/Ui', 'define(\'_PS_MODE_DEV_\', ' . $value . ');', $fileContent);
|
||||
if (@file_put_contents($filename, $fileContent)) {
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
@opcache_invalidate($filename);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function displayAjaxTestServer()
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
|
||||
Reference in New Issue
Block a user