Skip to content

Commit e93c78c

Browse files
authored
Removes fetchExtensionCompatibility in UpdateController class (joomla#45436)
1 parent 11e59d0 commit e93c78c

File tree

2 files changed

+2
-104
lines changed

2 files changed

+2
-104
lines changed

administrator/components/com_joomlaupdate/src/Controller/UpdateController.php

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
namespace Joomla\Component\Joomlaupdate\Administrator\Controller;
1212

1313
use Joomla\CMS\Component\ComponentHelper;
14-
use Joomla\CMS\Factory;
1514
use Joomla\CMS\Installer\Installer;
1615
use Joomla\CMS\Language\Text;
1716
use Joomla\CMS\Log\Log;
@@ -468,115 +467,14 @@ public function finaliseconfirm()
468467
$this->setRedirect('index.php?option=com_joomlaupdate&task=update.finalise&' . Session::getFormToken() . '=1');
469468
}
470469

471-
/**
472-
* Fetch Extension update XML proxy. Used to prevent Access-Control-Allow-Origin errors.
473-
* Prints a JSON string.
474-
* Called from JS.
475-
*
476-
* @since 3.10.0
477-
*
478-
* @deprecated 4.3 will be removed in 6.0
479-
* Use batchextensioncompatibility instead.
480-
* Example: $updateController->batchextensioncompatibility();
481-
*
482-
* @return void
483-
*/
484-
public function fetchExtensionCompatibility()
485-
{
486-
$extensionID = $this->input->get('extension-id', '', 'DEFAULT');
487-
$joomlaTargetVersion = $this->input->get('joomla-target-version', '', 'DEFAULT');
488-
$joomlaCurrentVersion = $this->input->get('joomla-current-version', '', JVERSION);
489-
$extensionVersion = $this->input->get('extension-version', '', 'DEFAULT');
490-
491-
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
492-
$model = $this->getModel('Update');
493-
$upgradeCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaTargetVersion);
494-
$currentCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaCurrentVersion);
495-
$upgradeUpdateVersion = false;
496-
$currentUpdateVersion = false;
497-
498-
$upgradeWarning = 0;
499-
500-
if ($upgradeCompatibilityStatus->state == 1 && !empty($upgradeCompatibilityStatus->compatibleVersions)) {
501-
$upgradeUpdateVersion = end($upgradeCompatibilityStatus->compatibleVersions);
502-
}
503-
504-
if ($currentCompatibilityStatus->state == 1 && !empty($currentCompatibilityStatus->compatibleVersions)) {
505-
$currentUpdateVersion = end($currentCompatibilityStatus->compatibleVersions);
506-
}
507-
508-
if ($upgradeUpdateVersion !== false) {
509-
$upgradeOldestVersion = $upgradeCompatibilityStatus->compatibleVersions[0];
510-
511-
if ($currentUpdateVersion !== false) {
512-
// If there are updates compatible with both CMS versions use these
513-
$bothCompatibleVersions = array_values(
514-
array_intersect($upgradeCompatibilityStatus->compatibleVersions, $currentCompatibilityStatus->compatibleVersions)
515-
);
516-
517-
if (!empty($bothCompatibleVersions)) {
518-
$upgradeOldestVersion = $bothCompatibleVersions[0];
519-
$upgradeUpdateVersion = end($bothCompatibleVersions);
520-
}
521-
}
522-
523-
if (version_compare($upgradeOldestVersion, $extensionVersion, '>')) {
524-
// Installed version is empty or older than the oldest compatible update: Update required
525-
$resultGroup = 2;
526-
} else {
527-
// Current version is compatible
528-
$resultGroup = 3;
529-
}
530-
531-
if ($currentUpdateVersion !== false && version_compare($upgradeUpdateVersion, $currentUpdateVersion, '<')) {
532-
// Special case warning when version compatible with target is lower than current
533-
$upgradeWarning = 2;
534-
}
535-
} elseif ($currentUpdateVersion !== false) {
536-
// No compatible version for target version but there is a compatible version for current version
537-
$resultGroup = 1;
538-
} else {
539-
// No update server available
540-
$resultGroup = 1;
541-
}
542-
543-
// Do we need to capture
544-
$combinedCompatibilityStatus = [
545-
'upgradeCompatibilityStatus' => (object) [
546-
'state' => $upgradeCompatibilityStatus->state,
547-
'compatibleVersion' => $upgradeUpdateVersion,
548-
],
549-
'currentCompatibilityStatus' => (object) [
550-
'state' => $currentCompatibilityStatus->state,
551-
'compatibleVersion' => $currentUpdateVersion,
552-
],
553-
'resultGroup' => $resultGroup,
554-
'upgradeWarning' => $upgradeWarning,
555-
];
556-
557-
$this->app = Factory::getApplication();
558-
$this->app->mimeType = 'application/json';
559-
$this->app->charSet = 'utf-8';
560-
$this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
561-
$this->app->sendHeaders();
562-
563-
try {
564-
echo new JsonResponse($combinedCompatibilityStatus);
565-
} catch (\Exception $e) {
566-
echo $e;
567-
}
568-
569-
$this->app->close();
570-
}
571-
572470
/**
573471
* Determines the compatibility information for a number of extensions.
574472
*
575473
* Called by the Joomla Update JavaScript (PreUpdateChecker.checkNextChunk).
576474
*
577475
* @return void
578-
* @since 4.2.0
579476
*
477+
* @since 4.2.0
580478
*/
581479
public function batchextensioncompatibility()
582480
{

administrator/components/com_joomlaupdate/src/Model/UpdateModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ public function getNonCorePlugins($folderFilter = ['system', 'user', 'authentica
17461746
}
17471747

17481748
/**
1749-
* Called by controller's fetchExtensionCompatibility, which is called via AJAX.
1749+
* Called by controller's batchextensioncompatibility, which is called via AJAX.
17501750
*
17511751
* @param string $extensionID The ID of the checked extension
17521752
* @param string $joomlaTargetVersion Target version of Joomla

0 commit comments

Comments
 (0)