Commit | Line | Data |
---|---|---|
8059b673 AE |
1 | <?php |
2 | namespace wcf\acp\page; | |
3 | use wcf\data\package\installation\queue\PackageInstallationQueue; | |
4 | use wcf\page\AbstractPage; | |
5 | use wcf\system\exception\IllegalLinkException; | |
25c89d0a | 6 | use wcf\system\package\validation\PackageValidationManager; |
8059b673 AE |
7 | use wcf\system\package\PackageInstallationDispatcher; |
8 | use wcf\system\WCF; | |
9 | use wcf\system\WCFACP; | |
10 | ||
11 | /** | |
12 | * Shows a confirmation page prior to start installing. | |
13 | * | |
14 | * @author Alexander Ebert | |
ca4ba303 | 15 | * @copyright 2001-2014 WoltLab GmbH |
8059b673 AE |
16 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
17 | * @package com.woltlab.wcf | |
18 | * @subpackage acp.page | |
19 | * @category Community Framework | |
20 | */ | |
21 | class PackageInstallationConfirmPage extends AbstractPage { | |
264c6eea | 22 | /** |
0ad90fc3 | 23 | * @see \wcf\page\AbstractPage::$activeMenuItem |
264c6eea MS |
24 | */ |
25 | public $activeMenuItem = 'wcf.acp.menu.link.package.install'; | |
26 | ||
8059b673 AE |
27 | /** |
28 | * package installation dispatcher object | |
0ad90fc3 | 29 | * @var \wcf\system\package\PackageInstallationDispatcher |
8059b673 AE |
30 | */ |
31 | public $packageInstallationDispatcher = null; | |
32 | ||
33 | /** | |
34 | * package installation queue object | |
0ad90fc3 | 35 | * @var \wcf\data\package\installation\queue\PackageInstallationQueue |
8059b673 AE |
36 | */ |
37 | public $queue = null; | |
38 | ||
39 | /** | |
40 | * queue id | |
41 | * @var integer | |
42 | */ | |
43 | public $queueID = 0; | |
44 | ||
45 | /** | |
25c89d0a AE |
46 | * package validation result |
47 | * @var boolean | |
8059b673 | 48 | */ |
25c89d0a | 49 | public $validationPassed = false; |
8059b673 | 50 | |
b168bf95 MS |
51 | /** |
52 | * true if the package to be installed was uploaded via the import style | |
53 | * form | |
54 | * @var boolean | |
55 | */ | |
56 | public $installingImportedStyle = false; | |
57 | ||
8059b673 | 58 | /** |
0ad90fc3 | 59 | * @see \wcf\page\IPage::readParameters() |
8059b673 AE |
60 | */ |
61 | public function readParameters() { | |
62 | parent::readParameters(); | |
63 | ||
64 | if (isset($_REQUEST['queueID'])) $this->queueID = intval($_REQUEST['queueID']); | |
65 | $this->queue = new PackageInstallationQueue($this->queueID); | |
66 | if (!$this->queue->queueID || $this->queue->done) { | |
67 | throw new IllegalLinkException(); | |
68 | } | |
ec45d5e8 AE |
69 | |
70 | if ($this->queue->action == 'install') { | |
71 | WCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage')); | |
72 | } | |
73 | else { | |
74 | WCF::getSession()->checkPermissions(array('admin.system.package.canUpdatePackage')); | |
75 | } | |
b168bf95 MS |
76 | |
77 | $this->installingImportedStyle = WCF::getSession()->getVar('stylePackageImportLocation') !== null; | |
78 | if ($this->installingImportedStyle) { | |
79 | WCF::getSession()->unregister('stylePackageImportLocation'); | |
80 | } | |
8059b673 AE |
81 | } |
82 | ||
83 | /** | |
0ad90fc3 | 84 | * @see \wcf\page\IPage::readData() |
8059b673 AE |
85 | */ |
86 | public function readData() { | |
87 | parent::readData(); | |
88 | ||
89 | $this->packageInstallationDispatcher = new PackageInstallationDispatcher($this->queue); | |
90 | ||
870b0938 | 91 | // validate the package and all it's requirements |
25c89d0a | 92 | $this->validationPassed = PackageValidationManager::getInstance()->validate($this->queue->archive, true); |
8059b673 AE |
93 | } |
94 | ||
95 | /** | |
0ad90fc3 | 96 | * @see \wcf\page\IPage::assignVariables() |
8059b673 AE |
97 | */ |
98 | public function assignVariables() { | |
99 | parent::assignVariables(); | |
100 | ||
101 | WCF::getTPL()->assign(array( | |
102 | 'archive' => $this->packageInstallationDispatcher->getArchive(), | |
870b0938 | 103 | 'packageValidationArchives' => PackageValidationManager::getInstance()->getPackageValidationArchiveList(), |
b168bf95 | 104 | 'queue' => $this->queue, |
25c89d0a | 105 | 'validationPassed' => $this->validationPassed, |
b168bf95 | 106 | 'installingImportedStyle' => $this->installingImportedStyle |
8059b673 AE |
107 | )); |
108 | } | |
109 | ||
110 | /** | |
0ad90fc3 | 111 | * @see \wcf\page\IPage::show() |
8059b673 AE |
112 | */ |
113 | public function show() { | |
8059b673 AE |
114 | // check master password |
115 | WCFACP::checkMasterPassword(); | |
116 | ||
8059b673 AE |
117 | parent::show(); |
118 | } | |
119 | } |