- Fixed errors/violations noticed by PHPMD and PHPCS

- Removed parameter perform_sql from public method controllers/system/extensions/CLI_Manager->installExtension
- Added new public method controllers/system/extensions/CLI_Manager->installExtensionNoSQL
- Improved code quality in controllers/system/extensions/Manager->toggleExtension
- controllers/system/extensions/Manager->uploadExtension better check of
  HTTP POST parameter notPerformSql
- application/views/system/extensions/manager.php renamed checkbox
  performSql to notPerformSql
- application/views/system/extensions/tableWidget.php removed PHP close
  tag at the end of the file
- Improved code quality in application/widgets/TableWidget.php
- Removed private method _getColumnsNames from application/widgets/TableWidget.php
- Improved code quality in application/libraries/ExtensionsLib.php
- Added new private methods _getExtensionsPath and _getUploadPath to application/libraries/ExtensionsLib.php
- Changed application/libraries/ExtensionsLib->_toggleExtension to public method toggleExtension
- Removed private properties UPLOAD_PATH and EXTENSIONS_PATH from application/libraries/ExtensionsLib
- Added use imports in application/libraries/ExtensionsLib
- application/libraries/ExtensionsLib->installExtension changed parameters default values
This commit is contained in:
Paolo
2022-03-04 12:26:37 +01:00
parent 8bbc68ca75
commit 15f9762d01
6 changed files with 235 additions and 240 deletions
@@ -31,10 +31,10 @@ class Manager extends Auth_Controller
$this->load->library('ExtensionsLib');
$this->loadPhrases(
array(
'extensions'
)
);
array(
'extensions'
)
);
}
/**
@@ -54,21 +54,16 @@ class Manager extends Auth_Controller
*/
public function toggleExtension()
{
$toggleExtension = false;
$extension_id = $this->input->post('extension_id');
$enabled = $this->input->post('enabled');
if ($enabled === true)
{
$toggleExtension = $this->extensionslib->enableExtension($extension_id);
}
else
{
$toggleExtension = $this->extensionslib->disableExtension($extension_id);
}
// Clean the parameter
if ($enabled !== true) $enable = false;
$this->outputJsonSuccess($toggleExtension);
// Output the enable/disable of the extension
$this->outputJsonSuccess(
$this->extensionslib->toggleExtension($extension_id, $enable)
);
}
/**
@@ -94,9 +89,13 @@ class Manager extends Auth_Controller
*/
public function uploadExtension()
{
$performSql = $this->input->post('performSql');
$notPerformSql = $this->input->post('notPerformSql');
$this->extensionslib->installExtension(null, null, $performSql);
// It converts the notPerformSql parameter from the checkbox value to a boolean one
if ($notPerformSql == 'on') $notPerformSql = true;
if ($notPerformSql !== true) $notPerformSql = false;
$this->extensionslib->installExtension(null, null, !$notPerformSql);
}
}