Skip to content

Commit

Permalink
Fix deleteCoreTableColumns
Browse files Browse the repository at this point in the history
  • Loading branch information
aljawaid committed Jul 16, 2023
1 parent 5ff48fe commit b84379b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Controller/PluginCleaningController.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,23 @@ public function confirmDeleteCoreTableColumns()
*/
public function deleteCoreTableColumns()
{
$table = $this->request->getStringParam('table');
$values = $this->request->getRawFormValues();

if (!empty($values)) {
foreach ($values as $key => $val) {
if ($this->applicationCleaningModel->deleteColumn($table, $key)) {
$this->flash->success(t('Deep Cleaning Complete: Core table columns were deleted successfully'));
} else {
$this->flash->failure(t('Deep Cleaning Failed: Core table columns were not deleted'));
$this->checkCSRFParam();
$plugin_job_name = $this->request->getStringParam('plugin_job_name');

foreach ($this->helper->pluginCleaningHelper->getDeletablePlugins() as $plugin) {
if (($plugin['plugin_title'] == $plugin_job_name) && isset($plugin['core_table_columns'])) {
foreach ($plugin['core_table_columns'] as $tables) {
foreach ($tables as $tablename => $tablecolumns) {
foreach ($tablecolumns as $column) {
if ($this->applicationCleaningModel->deleteColumn($tablename, $column)) {
$this->flash->success(t('Deep Cleaning Complete: Core table columns created by %s were deleted successfully', $plugin_job_name));
} else {
$this->flash->failure(t('Deep Cleaning Failed: Core table columns created by %s were not deleted', $plugin_job_name));
}
}
}
}
}
} else {
$this->flash->failure(t('No columns were selected'));
}

$this->response->redirect($this->helper->url->to('ContentCleanerController', 'show', array('plugin' => 'ContentCleaner')));
Expand Down

0 comments on commit b84379b

Please sign in to comment.