Skip to content

Commit

Permalink
Try to delete plugin schema - doesnt work, spinning circle
Browse files Browse the repository at this point in the history
- #12
  • Loading branch information
aljawaid committed May 20, 2023
1 parent cc1125a commit 4c66fa9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
11 changes: 9 additions & 2 deletions Controller/PluginCleaningController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,21 @@ public function confirmDeletePluginSchemaEntry()
{
$this->response->html($this->template->render('contentCleaner:config/modals/plugin_deep_clean', array(
'plugin_job_name' => $this->request->getStringParam('plugin_job_name'),
'plugin_name' => $this->request->getStringParam('plugin_name'),
)));
}

/**
* Delete the Plugin Schema Entry for the Plugin
*
* @author aljawaid
*/
public function deletePluginSchemaEntry()
{
// DELETE THE PLUGIN SCHEMA ENTRY FOR THE PLUGIN
$this->checkCSRFParam();
$plugin_name = $this->request->getStringParam('plugin_name');

if ($this->applicationCleaningModel->purgeUninstalledPluginSchemas()) {
if ($this->pluginCleaningModel->deletePluginSchemaEntry($plugin_name. $plugin_schema_version !== false)) {
$this->flash->success(t('DEEP CLEANING COMPLETE: Plugin registration entry deleted successfully'));
} else {
$this->flash->failure(t('DEEP CLEANING FAILED: Plugin registration entry was not deleted'));
Expand Down
18 changes: 18 additions & 0 deletions Model/PluginCleaningModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,22 @@

class PluginCleaningModel extends Base
{

/**
* Delete Plugin Entry from the Schema Table
* Table: plugin_schema_versions (plugin VARCHAR(80) NOT NULL, version INT NOT NULL DEFAULT 0, PRIMARY KEY(plugin)) ENGINE=InnoDB CHARSET=utf8
*
* @return true
* @author aljawaid
*/
public function deletePluginSchemaEntry($plugin_name, $plugin_schema_version)
{
//$plugin_name = $this->request->getStringParam('plugin_name');

if ($this->db->table('plugin_schema_versions')->eq('plugin', $plugin_name)->exists()) {
$this->db->table('plugin_schema_versions')->eq('plugin', $plugin_name)->remove();
}

return true;
}
}
6 changes: 3 additions & 3 deletions Template/config/modals/plugin_deep_clean.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
</li>
<?php endif ?>
<?php endif ?>
<!-- ContentCleaner: PLUGIN DEEP CLEAN PLUGIN SCHEMA ENTRY -->
<?php if (($incomingController == 'PluginCleaningController') && ($outgoingAction == 'confirmDeletePluginSchemaEntry')): ?>
<?php if (isset($plugin['plugin_schema_version'])): ?>
<!-- ContentCleaner: PLUGIN DEEP CLEAN PLUGIN SCHEMA ENTRY -->
<li class="plugin-job-delete-item">
<i class="fa fa-check fa-li pp-green" aria-hidden="true"></i>
<span class="db-database-icon"></span> <?= t('Plugin Schema Registration Entry') ?>
Expand All @@ -75,9 +75,9 @@
<?php if (($incomingController == 'PluginCleaningController') && ($outgoingAction == 'confirmDeleteCoreTableEntries')): ?>
<?= $this->modal->confirmButtons('PluginCleaningController', 'deleteCoreTableEntries', array('plugin_job_name' => $plugin_job_name, 'plugin' => 'ContentCleaner'), t('Deep Clean')) ?>
<?php endif ?>
<!-- ContentCleaner: PLUGIN DEEP CLEAN PLUGIN SCHEMA ENTRY -->
<?php if (($incomingController == 'PluginCleaningController') && ($outgoingAction == 'confirmDeletePluginSchemaEntry')): ?>
<?= $this->modal->confirmButtons('PluginCleaningController', 'deletePluginSchemaEntry', array('plugin_job_name' => $plugin_job_name, 'plugin' => 'ContentCleaner'), t('Deep Clean')) ?>
<!-- ContentCleaner: PLUGIN DEEP CLEAN PLUGIN SCHEMA ENTRY -->
<?= $this->modal->confirmButtons('PluginCleaningController', 'deletePluginSchemaEntry', array('plugin_name' => $plugin_name, 'plugin' => 'ContentCleaner'), t('Deep Clean')) ?>
<?php endif ?>
</div>
</div>

1 comment on commit 4c66fa9

@aljawaid
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@creecros no matter what I do, this just wont work

Please sign in to comment.