3 namespace wcf\acp\page
;
5 use wcf\data\package\installation\queue\PackageInstallationQueue
;
6 use wcf\page\AbstractPage
;
7 use wcf\system\exception\IllegalLinkException
;
8 use wcf\system\package\PackageInstallationDispatcher
;
9 use wcf\system\package\validation\PackageValidationManager
;
13 * Shows a confirmation page prior to start installing.
15 * @author Alexander Ebert
16 * @copyright 2001-2019 WoltLab GmbH
17 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
19 class PackageInstallationConfirmPage
extends AbstractPage
24 public $activeMenuItem = 'wcf.acp.menu.link.package.install';
27 * package installation dispatcher object
28 * @var PackageInstallationDispatcher
30 public $packageInstallationDispatcher;
33 * package installation queue object
34 * @var PackageInstallationQueue
45 * package validation result
48 public $validationPassed = false;
51 * true if the package to be installed was uploaded via the import style
55 public $installingImportedStyle = false;
60 public function readParameters()
62 parent
::readParameters();
64 if (isset($_REQUEST['queueID'])) {
65 $this->queueID
= \
intval($_REQUEST['queueID']);
67 $this->queue
= new PackageInstallationQueue($this->queueID
);
68 if (!$this->queue
->queueID ||
$this->queue
->done
) {
69 throw new IllegalLinkException();
72 if ($this->queue
->action
== 'install') {
73 WCF
::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']);
75 WCF
::getSession()->checkPermissions(['admin.configuration.package.canUpdatePackage']);
78 $this->installingImportedStyle
= WCF
::getSession()->getVar('stylePackageImportLocation') !== null;
79 if ($this->installingImportedStyle
) {
80 WCF
::getSession()->unregister('stylePackageImportLocation');
87 public function readData()
91 $this->packageInstallationDispatcher
= new PackageInstallationDispatcher($this->queue
);
93 // validate the package and all its requirements
94 $this->validationPassed
= PackageValidationManager
::getInstance()->validate($this->queue
->archive
, true);
100 public function assignVariables()
102 parent
::assignVariables();
104 WCF
::getTPL()->assign([
105 'archive' => $this->packageInstallationDispatcher
->getArchive(),
106 'packageValidationArchives' => PackageValidationManager
::getInstance()->getPackageValidationArchiveList(),
107 'queue' => $this->queue
,
108 'validationPassed' => $this->validationPassed
,
109 'installingImportedStyle' => $this->installingImportedStyle
,