|
11 | 11 | namespace Joomla\Component\Joomlaupdate\Administrator\Controller; |
12 | 12 |
|
13 | 13 | use Joomla\CMS\Component\ComponentHelper; |
14 | | -use Joomla\CMS\Factory; |
15 | 14 | use Joomla\CMS\Installer\Installer; |
16 | 15 | use Joomla\CMS\Language\Text; |
17 | 16 | use Joomla\CMS\Log\Log; |
@@ -468,115 +467,14 @@ public function finaliseconfirm() |
468 | 467 | $this->setRedirect('index.php?option=com_joomlaupdate&task=update.finalise&' . Session::getFormToken() . '=1'); |
469 | 468 | } |
470 | 469 |
|
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 | | - |
572 | 470 | /** |
573 | 471 | * Determines the compatibility information for a number of extensions. |
574 | 472 | * |
575 | 473 | * Called by the Joomla Update JavaScript (PreUpdateChecker.checkNextChunk). |
576 | 474 | * |
577 | 475 | * @return void |
578 | | - * @since 4.2.0 |
579 | 476 | * |
| 477 | + * @since 4.2.0 |
580 | 478 | */ |
581 | 479 | public function batchextensioncompatibility() |
582 | 480 | { |
|
0 commit comments