refactor: replace Joomla-7-deprecated APIs (forward compatibility)
Universal: Auto Version Bump / Version Bump (push) Successful in 12s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 15s

Removes accessors deprecated in Joomla 5 and slated for removal in 7
(extension already runs on 6; this future-proofs for 7):
- Factory::getDbo() -> Factory::getContainer()->get(DatabaseInterface::class)
  across plugins, controllers, static helpers, and the install script
- Factory::getUser() -> Factory::getApplication()->getIdentity()
- Factory::getSession() -> Factory::getApplication()->getSession()
- jexit(Text::_('JINVALID_TOKEN')) -> throw new \RuntimeException(..., 403),
  consistent with the access-denied checks already in those controllers

Note: SQL update-version concern is already resolved — the release bumped
to 01.05.00, which matches the 01.05.00.sql update slot.
This commit is contained in:
2026-06-28 14:47:34 -05:00
parent 77cf557b71
commit d6fb2816cf
9 changed files with 30 additions and 30 deletions
@@ -36,14 +36,14 @@ class ImportExportController extends BaseController
*/
public function export(): void
{
Session::checkToken('get') || jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken('get') || throw new \RuntimeException(Text::_('JINVALID_TOKEN'), 403);
if (!Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_mokoog')) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
$app = Factory::getApplication();
$db = Factory::getDbo();
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
// Join with #__content to get article titles for reference
$query = $db->getQuery(true)
@@ -102,7 +102,7 @@ class ImportExportController extends BaseController
*/
public function import(): void
{
Session::checkToken() || jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() || throw new \RuntimeException(Text::_('JINVALID_TOKEN'), 403);
$identity = Factory::getApplication()->getIdentity();
@@ -161,7 +161,7 @@ class ImportExportController extends BaseController
return;
}
$db = Factory::getDbo();
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
$header = fgetcsv($handle);
$created = 0;
$updated = 0;