Skip to content

Commit dd4adb6

Browse files
authored
[K7.0] Fix for removing Kunena via Tools (#9925)
* Fix for removing Kunena via Tools * [K7.0] Fix: install scripts deleteFiles must je relative, and removed unused… (#9914) * Fix: install scripts deleteFiles must je relative, and removed unused min requirements (these are enforced by package * [K7.0] PLG kunena easysocial (#9915) * [untested] plg_kunena_easysocial refactoring into service provider plugin * refactored kunena easysocial + cleanup other kunena integration plugins * Fix: 403 forbidden * Fix: install scripts deleteFiles must je relative, and removed unused min requirements (these are enforced by package * Uninstall via Joomla Extension manager * Fix for removing Kunena via Tools * Uninstall via Joomla Extension manager
1 parent f2dac91 commit dd4adb6

File tree

13 files changed

+854
-1072
lines changed

13 files changed

+854
-1072
lines changed

src/admin/kunena.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
charset="utf8">sql/install/mysql/create_tables.utf8.sql</file>
2424
</sql>
2525
</install>
26+
<uninstall>
27+
<sql>
28+
<file
29+
driver="mysql"
30+
charset="utf8">sql/uninstall/mysql/uninstall.mysql.utf8.sql</file>
31+
</sql>
32+
</uninstall>
2633
<files folder="site">
2734
<folder>language</folder>
2835
<folder>src</folder>

src/admin/language/en-GB/com_kunena.controllers.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ COM_KUNENA_AJAX_RECOUNT_WAIT = "Recounting forum statistics, please wait!"
123123
COM_KUNENA_AJAX_ERROR = "An Error Occurred"
124124
COM_KUNENA_AJAX_DETAILS_BELOW = "Please see more details below."
125125
COM_KUNENA_AJAX_REQUESTED_RECOUNTED = "Requested statistics were recounted."
126-
COM_KUNENA_TOOLS_UNINSTALL_LOGIN_FAILED = "Login failed to launch uninstall process"
127-
COM_KUNENA_TOOLS_UNINSTALL_LOGIN_SECRETKEY_INVALID = "The secretkey entered is empty or it's not a number"
128126

129127
; JROOT/administrator/components/com_kunena/controllers/topicicons.php
130128

src/admin/language/en-GB/com_kunena.install.ini

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ COM_KUNENA_INSTALL_STEP_FINISH = "Finish Installation"
7676
COM_KUNENA_INSTALL_STEP_INSTALL = "Select an Installation or Upgrade Option"
7777
COM_KUNENA_INSTALL_STEP_PLUGINS = "Install Plug-ins"
7878
COM_KUNENA_INSTALL_STEP_PREPARE = "Prepare Installation"
79-
COM_KUNENA_INSTALL_UNINSTALL = "Remove Kunena"
80-
COM_KUNENA_INSTALL_UNINSTALL_DESC = "Remove Kunena together with its data and all the files."
81-
COM_KUNENA_INSTALL_UNINSTALL_HINT = "You can use this option if you want to start over with a clean installation."
82-
COM_KUNENA_INSTALL_UNINSTALL_WARN = "This action will delete all the data from your forum, including categories, posts and attachments."
8379
COM_KUNENA_INSTALL_UPGRADE = "Upgrade Kunena"
8480
COM_KUNENA_INSTALL_UPGRADE_DESC = "Upgrade Kunena from version #VERSION_OLD# to #VERSION#."
8581
COM_KUNENA_INSTALL_UPGRADE_HINT = "Use this option to upgrade Kunena #VERSION_OLD# to the current version."

src/admin/language/en-GB/com_kunena.views.ini

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,6 @@ COM_KUNENA_C_SYNCEUSERSDESC = "Sync the Kunena user table with the Joomla user t
10111011
COM_KUNENA_GIT_INSTALL = "Git Install"
10121012
COM_KUNENA_GIT_INSTALL_DESC = "Git Installation"
10131013
COM_KUNENA_RECOUNTFORUMS = "Recount Category Statistics"
1014-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS = "Uninstall Kunena"
1015-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS_DESC = "Uninstall Kunena from joomla included database"
10161014

10171015
; JROOT/administrator/components/com_kunena/views/tools/tmpl/menu.php
10181016

@@ -1250,18 +1248,6 @@ COM_KUNENA_DIAGNOSTICS_LABEL_FIX_ISSUES = "FIX ISSUES"
12501248
COM_KUNENA_DIAGNOSTICS_LABEL_TEST_PASSED = "TEST PASSED"
12511249
COM_KUNENA_DIAGNOSTICS_LABEL_DELETE_BROKEN_ITEMS = "DELETE BROKEN ITEMS"
12521250

1253-
; JROOT/administrator/components/com_kunena/views/tools/tmpl/uninstall.php
1254-
1255-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_TITLE = "Uninstall Kunena"
1256-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_ALERTBOX_WARNING = "WARNING!"
1257-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_ALERTBOX_DESC = "Proceed with caution. This action is irreversible and will permanently delete this Kunena installation."
1258-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_DESC = "All user data in the database including categories, topics, messages, and attachments will be deleted. Kunena installation directories will be removed from you Joomla install including the Kunena Site Component, Kunena Administrator Component, and Kunena Library. If you don't have a backup there is no way to go back and restore this data."
1259-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_TFA_DESC = "In order to execute the process, you need to log in with a super-administrator account. If you have Two-Factor Authentication enabled you may need to include the authenticator code to proceed."
1260-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_LOGIN = "Username"
1261-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_PASSWORD = "Password"
1262-
COM_KUNENA_TOOLS_BUTTON_UNINSTALL_PROCESS = "Execute the process"
1263-
COM_KUNENA_TOOLS_LABEL_UNINSTALL_SECRETKEY = "Secret key"
1264-
12651251
; JROOT/administrator/components/com_kunena/views/logs
12661252

12671253
COM_KUNENA_LOG_MANAGER = "Logs"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
DROP TABLE IF EXISTS `#__kunena_aliases`;
2+
DROP TABLE IF EXISTS `#__kunena_announcement`;
3+
DROP TABLE IF EXISTS `#__kunena_attachments`;
4+
DROP TABLE IF EXISTS `#__kunena_categories`;
5+
DROP TABLE IF EXISTS `#__kunena_karma`;
6+
DROP TABLE IF EXISTS `#__kunena_configuration`;
7+
DROP TABLE IF EXISTS `#__kunena_topics`;
8+
DROP TABLE IF EXISTS `#__kunena_messages`;
9+
DROP TABLE IF EXISTS `#__kunena_messages_text`;
10+
DROP TABLE IF EXISTS `#__kunena_polls`;
11+
DROP TABLE IF EXISTS `#__kunena_polls_options`;
12+
DROP TABLE IF EXISTS `#__kunena_polls_users`;
13+
DROP TABLE IF EXISTS `#__kunena_private`;
14+
DROP TABLE IF EXISTS `#__kunena_private_attachment_map`;
15+
DROP TABLE IF EXISTS `#__kunena_private_post_map`;
16+
DROP TABLE IF EXISTS `#__kunena_private_user_map`;
17+
DROP TABLE IF EXISTS `#__kunena_ranks`;
18+
DROP TABLE IF EXISTS `#__kunena_rate`;
19+
DROP TABLE IF EXISTS `#__kunena_sessions`;
20+
DROP TABLE IF EXISTS `#__kunena_smileys`;
21+
DROP TABLE IF EXISTS `#__kunena_thankyou`;
22+
DROP TABLE IF EXISTS `#__kunena_user_categories`;
23+
DROP TABLE IF EXISTS `#__kunena_user_read`;
24+
DROP TABLE IF EXISTS `#__kunena_user_topics`;
25+
DROP TABLE IF EXISTS `#__kunena_users`;
26+
DROP TABLE IF EXISTS `#__kunena_users_banned`;
27+
DROP TABLE IF EXISTS `#__kunena_logs`;
28+
DROP TABLE IF EXISTS `#__kunena_version`;

src/admin/src/Controller/InstallController.php

Lines changed: 0 additions & 133 deletions
This file was deleted.

src/admin/src/Controller/ToolsController.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -866,64 +866,6 @@ public function cancel($key = null)
866866
$this->app->redirect(KunenaRoute::_($this->baseurl, false));
867867
}
868868

869-
/**
870-
* Method to completely remove kunena by checking before if the user is a super-administrator
871-
*
872-
* @return void
873-
*
874-
* @since Kunena 4.0
875-
*
876-
* @throws null
877-
* @throws Exception
878-
*/
879-
public function uninstall(): void
880-
{
881-
if (!Session::checkToken()) {
882-
$this->app->enqueueMessage(Text::_('COM_KUNENA_ERROR_TOKEN'), 'error');
883-
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
884-
885-
return;
886-
}
887-
888-
// Check if the user has the super-administrator rights
889-
$username = $this->input->getString('username');
890-
$password = $this->input->getString('password');
891-
$code = $this->input->getInt('secretkey');
892-
893-
$login = KunenaLogin::getInstance();
894-
895-
if ($login->isTFAEnabled()) {
896-
if (empty($code) || $code == 0) {
897-
$this->app->enqueueMessage(Text::_('COM_KUNENA_TOOLS_UNINSTALL_LOGIN_SECRETKEY_INVALID'), 'error');
898-
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
899-
}
900-
}
901-
902-
$params = new Registry();
903-
$Joomlalogin = new KunenaLoginJoomla($params);
904-
905-
try {
906-
$logged = $Joomlalogin->loginUser($username, $password, false);
907-
} catch (Exception $e) {
908-
$this->app->enqueueMessage($e->getMessage(), 'error');
909-
}
910-
911-
$user = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserByUsername($username);
912-
913-
$isRoot = $user->authorise('core.admin');
914-
915-
if ($logged && $isRoot) {
916-
$this->app->setUserState('com_kunena.uninstall.allowed', true);
917-
918-
$this->setRedirect(KunenaRoute::_('administrator/index.php?option=com_kunena&task=install.uninstall&' . Session::getFormToken() . '=1', false));
919-
920-
return;
921-
}
922-
923-
$this->app->enqueueMessage(Text::_('COM_KUNENA_TOOLS_UNINSTALL_LOGIN_FAILED'), 'error');
924-
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
925-
}
926-
927869
/**
928870
* System Report
929871
*

src/admin/src/View/Tools/HtmlView.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Joomla\CMS\Factory;
2020
use Joomla\CMS\Language\Text;
2121
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
22-
use Joomla\CMS\Toolbar\Toolbar;
2322
use Joomla\CMS\Toolbar\ToolbarHelper;
2423
use Kunena\Forum\Libraries\Access\KunenaAccess;
2524
use Kunena\Forum\Libraries\Forum\Topic\KunenaTopicHelper;
@@ -171,11 +170,6 @@ public function display($tpl = null)
171170
$this->setToolBarSubscriptions();
172171
} elseif ($layout == 'syncUsers') {
173172
$this->setToolBarSyncUsers();
174-
} elseif ($layout == 'uninstall') {
175-
$login = KunenaLogin::getInstance();
176-
$this->isTFAEnabled = $login->isTFAEnabled();
177-
178-
$this->setToolBarUninstall();
179173
}
180174

181175
return parent::display($tpl);
@@ -359,19 +353,4 @@ protected function setToolBarSyncUsers(): void
359353
$helpUrl = 'https://docs.kunena.org/en/manual/backend/tools/synchronize-users';
360354
ToolbarHelper::help('COM_KUNENA', false, $helpUrl);
361355
}
362-
363-
/**
364-
* @return void
365-
*
366-
* @since Kunena 6.0
367-
*/
368-
protected function setToolBarUninstall(): void
369-
{
370-
ToolbarHelper::title(Text::_('COM_KUNENA'), 'tools');
371-
ToolbarHelper::spacer();
372-
ToolbarHelper::cancel();
373-
ToolbarHelper::spacer();
374-
$helpUrl = 'https://docs.kunena.org/en/manual/backend/tools/uninstall-kunena';
375-
ToolbarHelper::help('COM_KUNENA', false, $helpUrl);
376-
}
377356
}

src/admin/tmpl/tools/default.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -205,28 +205,6 @@
205205
</a>
206206
</div>
207207

208-
<div class="col-xl-3 col-md-6">
209-
<a href="<?php echo Route::_('index.php?option=com_kunena&view=tools&layout=uninstall'); ?>">
210-
<div class="card proj-t-card comp-card">
211-
<div class="card-body">
212-
<div class="row align-items-center">
213-
<div class="col">
214-
<h6 class="mb-25">
215-
<?php echo Text::_('COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS'); ?>
216-
</h6>
217-
<h3 class="fw-700 text-cyan">
218-
<?php echo Text::_('COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS_DESC'); ?>
219-
</h3>
220-
</div>
221-
<div class="col-auto">
222-
<i class="fas fa-wrench bg-cyan"></i>
223-
</div>
224-
</div>
225-
</div>
226-
</div>
227-
</a>
228-
</div>
229-
230208
<?php if (KunenaForum::isDev()) :
231209
?>
232210
<div class="col-xl-3 col-md-6">

0 commit comments

Comments
 (0)