import * as Language from "../../../Language";
import { innerError } from "../../../Dom/Util";
import UiDialog from "../../../Ui/Dialog";
+import { StatusNotOk } from "WoltLabSuite/Core/Ajax/Error";
let codeInput: HTMLInputElement;
type: string;
};
-function detectCode(): void {
+function detectCode(versionNumber: string): void {
const value = codeInput.value.trim();
if (value === "") {
innerError(codeInput, false);
if (json.package && json.password && json.username) {
isValid = true;
- void prepareInstallation(json);
+ void prepareInstallation(json, versionNumber);
}
}
}
return refreshedPackageDatabase;
}
-async function prepareInstallation(data: InstallationCode): Promise<void> {
+async function prepareInstallation(data: InstallationCode, versionNumber: string): Promise<void> {
try {
AjaxStatus.show();
await refreshPackageDatabase();
AjaxStatus.hide();
}
- const response = (await dboAction("prepareInstallation", "wcf\\data\\package\\update\\PackageUpdateAction")
- .payload({
- packages: {
- [data.package]: "",
- },
- authData: {
- username: data.username,
- password: data.password,
- saveCredentials: false,
- isStoreCode: true,
- },
- })
- .dispatch()) as Response;
+ let response: Response;
+ try {
+ response = (await dboAction("prepareInstallation", "wcf\\data\\package\\update\\PackageUpdateAction")
+ .payload({
+ packages: {
+ [data.package]: "",
+ },
+ authData: {
+ username: data.username,
+ password: data.password,
+ saveCredentials: false,
+ isStoreCode: true,
+ },
+ })
+ .dispatch()) as Response;
+ } catch (e) {
+ if (e instanceof StatusNotOk) {
+ try {
+ const json = await e.response.clone().json();
+ if (typeof json.message === "string" && json.message.startsWith("Cannot find the package '")) {
+ codeInput.value = "";
+ innerError(
+ codeInput,
+ Language.getPhrase("wcf.acp.package.error.incompatibleStoreProduct", { versionNumber }),
+ );
+
+ return;
+ }
+ } catch {
+ throw e;
+ }
+ }
+
+ throw e;
+ }
if ("queueID" in response) {
if (response.queueID === null) {
}
}
-export function setup(): void {
+export function setup(versionNumber: string): void {
codeInput = document.getElementById("quickInstallationCode") as HTMLInputElement;
codeInput.addEventListener("focus", () => {
});
codeInput.addEventListener("input", () => {
- detectCode();
+ detectCode(versionNumber);
});
}
require([
"WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation", "WoltLabSuite/Core/Acp/Ui/Package/Search"],
(AcpUiPackageQuickInstallation, AcpUiPackageSearch) => {
+ {jsphrase name='wcf.acp.package.error.incompatibleStoreProduct'}
{jsphrase name='wcf.acp.package.error.uniqueAlreadyInstalled'}
{jsphrase name='wcf.acp.package.install.title'}
{jsphrase name='wcf.acp.package.quickInstallation.code.error.invalid'}
{jsphrase name='wcf.acp.package.update.title'}
{jsphrase name='wcf.acp.package.update.unauthorized'}
- AcpUiPackageQuickInstallation.setup();
+ AcpUiPackageQuickInstallation.setup('{$majorMinorVersion}');
new AcpUiPackageSearch();
{if $errorField === 'uploadPackage'}
* @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*/
-define(["require", "exports", "tslib", "../../../Ajax", "../../../Ajax/Status", "../../../Core", "../../../Language", "../../../Dom/Util", "../../../Ui/Dialog"], function (require, exports, tslib_1, Ajax_1, AjaxStatus, Core_1, Language, Util_1, Dialog_1) {
+define(["require", "exports", "tslib", "../../../Ajax", "../../../Ajax/Status", "../../../Core", "../../../Language", "../../../Dom/Util", "../../../Ui/Dialog", "WoltLabSuite/Core/Ajax/Error"], function (require, exports, tslib_1, Ajax_1, AjaxStatus, Core_1, Language, Util_1, Dialog_1, Error_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setup = void 0;
Language = tslib_1.__importStar(Language);
Dialog_1 = tslib_1.__importDefault(Dialog_1);
let codeInput;
- function detectCode() {
+ function detectCode(versionNumber) {
const value = codeInput.value.trim();
if (value === "") {
(0, Util_1.innerError)(codeInput, false);
const json = maybeJson;
if (json.package && json.password && json.username) {
isValid = true;
- void prepareInstallation(json);
+ void prepareInstallation(json, versionNumber);
}
}
}
}
return refreshedPackageDatabase;
}
- async function prepareInstallation(data) {
+ async function prepareInstallation(data, versionNumber) {
try {
AjaxStatus.show();
await refreshPackageDatabase();
finally {
AjaxStatus.hide();
}
- const response = (await (0, Ajax_1.dboAction)("prepareInstallation", "wcf\\data\\package\\update\\PackageUpdateAction")
- .payload({
- packages: {
- [data.package]: "",
- },
- authData: {
- username: data.username,
- password: data.password,
- saveCredentials: false,
- isStoreCode: true,
- },
- })
- .dispatch());
+ let response;
+ try {
+ response = (await (0, Ajax_1.dboAction)("prepareInstallation", "wcf\\data\\package\\update\\PackageUpdateAction")
+ .payload({
+ packages: {
+ [data.package]: "",
+ },
+ authData: {
+ username: data.username,
+ password: data.password,
+ saveCredentials: false,
+ isStoreCode: true,
+ },
+ })
+ .dispatch());
+ }
+ catch (e) {
+ if (e instanceof Error_1.StatusNotOk) {
+ try {
+ const json = await e.response.clone().json();
+ if (typeof json.message === "string" && json.message.startsWith("Cannot find the package '")) {
+ codeInput.value = "";
+ (0, Util_1.innerError)(codeInput, Language.getPhrase("wcf.acp.package.error.incompatibleStoreProduct", { versionNumber }));
+ return;
+ }
+ }
+ catch {
+ throw e;
+ }
+ }
+ throw e;
+ }
if ("queueID" in response) {
if (response.queueID === null) {
codeInput.value = "";
throw new Error("Unreachable");
}
}
- function setup() {
+ function setup(versionNumber) {
codeInput = document.getElementById("quickInstallationCode");
codeInput.addEventListener("focus", () => {
// Refresh the package database when focusing the input to hide the latency of the package
void refreshPackageDatabase();
});
codeInput.addEventListener("input", () => {
- detectCode();
+ detectCode(versionNumber);
});
}
exports.setup = setup;
{
parent::assignVariables();
+ $majorMinorVersion = \preg_replace('/^(\d+\.\d+)\..*$/', '\\1', \WCF_VERSION);
+
WCF::getTPL()->assign([
'package' => $this->package,
'installingImportedStyle' => $this->stylePackageImportLocation != '',
+ 'majorMinorVersion' => $majorMinorVersion,
]);
}
<item name="wcf.acp.package.error.noValidInstall"><![CDATA[Das angegebene Paket lässt keine Neuinstallation zu.]]></item>
<item name="wcf.acp.package.error.noValidUpdate"><![CDATA[Paket „{$package->getName()}“ kann mit dem angegebenen Archiv nicht aktualisiert werden.]]></item>
<item name="wcf.acp.package.error.majorUpgrade"><![CDATA[Das Paket aktualisiert die Installation auf eine neue Major-Version. Aus Stabilitätsgründen können Major-Upgrades ausschließlich über die Paketserver durchgeführt werden. Detaillierte Informationen zur Durchführung des Upgrades finden sich <a href="https://manual.woltlab.com/de/updates/" class="externalURL">in unserem Handbuch</a>.]]></item>
+ <item name="wcf.acp.package.error.incompatibleStoreProduct"><![CDATA[Das zu installierende Paket ist nicht kompatibel. {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} nur Pakete installieren, die als kompatibel mit WoltLab Suite {literal}{$versionNumber}{/literal} angegeben werden.]]></item>
<item name="wcf.acp.package.identifier"><![CDATA[Bezeichner]]></item>
<item name="wcf.acp.package.information.properties"><![CDATA[Eigenschaften]]></item>
<item name="wcf.acp.package.information.title"><![CDATA[Informationen]]></item>
<item name="wcf.acp.package.error.noValidInstall"><![CDATA[The selected package does not support an installation.]]></item>
<item name="wcf.acp.package.error.noValidUpdate"><![CDATA[Package “{$package->getName()}” cannot be updated using the selected archive.]]></item>
<item name="wcf.acp.package.error.majorUpgrade"><![CDATA[The package updates your community to a new major version. For stability reasons major upgrades may only be performed via the update servers. Detailed information regarding the upgrade process can be found <a href="https://manual.woltlab.com/en/updates/" class="externalURL">in our manual</a>.]]></item>
+ <item name="wcf.acp.package.error.incompatibleStoreProduct"><![CDATA[The package is incompatible and cannot be installed. You can only install packages that are listed as compatible with WoltLab Suite {literal}{$versionNumber}{/literal}.]]></item>
<item name="wcf.acp.package.identifier"><![CDATA[Identifier]]></item>
<item name="wcf.acp.package.information.properties"><![CDATA[Properties]]></item>
<item name="wcf.acp.package.information.title"><![CDATA[Details]]></item>