<fieldset{if !$serverAuthData|empty} class="marginTop"{/if}>
<legend>{lang}wcf.acp.package.update.server{/lang}</legend>
- <dl>
- <dt>{lang}wcf.acp.package.name{/lang}</dt>
- <dd>{$packageUpdateVersion[packageName]} ({$packageUpdateVersion[packageVersion]})</dd>
- </dl>
+ {if $packageUpdateVersion[packageName]|isset}
+ <dl>
+ <dt>{lang}wcf.acp.package.name{/lang}</dt>
+ <dd>{$packageUpdateVersion[packageName]} ({$packageUpdateVersion[packageVersion]})</dd>
+ </dl>
+ {/if}
<dl>
<dt>{lang}wcf.acp.package.update.server.url{/lang}</dt>
<dd>{@$updateServer->getHighlightedURL()}</dd>
$response = $request->getReply();
// check response
- // 401 = missing/invalid auth data, 403 = valid auth data, but unaccessible
- if ($response['statusCode'] == 401 || $response['statusCode'] == 403) {
- throw new PackageUpdateAuthorizationRequiredException($packageUpdateVersion['packageUpdateServerID'], (!empty($packageUpdateVersion['file']) ? $packageUpdateVersion['file'] : $packageUpdateVersion['server']), $response);
- }
-
if ($response['statusCode'] != 200) {
throw new SystemException(WCF::getLanguage()->get('wcf.acp.packageUpdate.error.downloadFailed', array('$package' => $package)) . ' ('.$response['body'].')');
}
use wcf\data\package\update\PackageUpdateList;
use wcf\data\package\Package;
use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\HTTPUnauthorizedException;
use wcf\system\exception\SystemException;
+use wcf\system\package\PackageUpdateUnauthorizedException;
use wcf\system\Regex;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
$request->execute();
$reply = $request->getReply();
}
+ catch (HTTPUnauthorizedException $e) {
+ throw new PackageUpdateUnauthorizedException($request, $updateServer);
+ }
catch (SystemException $e) {
$reply = $request->getReply();
- if ($reply['statusCode'] == 401) {
- throw new PackageUpdateAuthorizationRequiredException($updateServer['packageUpdateServerID'], $updateServer['server'], $reply);
- }
-
throw new SystemException(WCF::getLanguage()->get('wcf.acp.packageUpdate.error.listNotFound') . ' ('.reset($reply['headers']).')');
}
* @param wcf\data\package\update\server\PackageUpdateServer $updateServer
* @param array $packageUpdateVersion
*/
- public function __construct(HTTPRequest $request, PackageUpdateServer $updateServer, array $packageUpdateVersion) {
+ public function __construct(HTTPRequest $request, PackageUpdateServer $updateServer, array $packageUpdateVersion = array()) {
$this->request = $request;
$this->updateServer = $updateServer;
$this->packageUpdateVersion = $packageUpdateVersion;