Skip to content

Commit 8eea8e9

Browse files
committed
Minor clean up, fix naming and descriptions
1 parent d3e6d25 commit 8eea8e9

File tree

8 files changed

+36
-49
lines changed

8 files changed

+36
-49
lines changed

wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ protected function stepPrepare(): ResponseInterface
117117

118118
// mark package as tainted if it is an app
119119
if ($package->isApplication) {
120-
(new MarkApplicationAsTainted(ApplicationHandler::getInstance()->getApplicationByID($package->packageID)))();
120+
$application = ApplicationHandler::getInstance()->getApplicationByID($package->packageID);
121+
\assert($application !== null);
122+
123+
(new MarkApplicationAsTainted($application))();
121124
}
122125

123126
$this->installation->nodeBuilder->purgeNodes();

wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace wcf\acp\form;
44

55
use Laminas\Diactoros\Response\RedirectResponse;
6-
use wcf\command\application\RebuildApplicationsCookieDomain;
6+
use wcf\command\application\SynchronizeCookieDomain;
77
use wcf\data\application\Application;
88
use wcf\data\application\ApplicationEditor;
99
use wcf\data\application\ApplicationList;
@@ -333,7 +333,7 @@ public function save()
333333
]);
334334
}
335335

336-
(new RebuildApplicationsCookieDomain())();
336+
(new SynchronizeCookieDomain())();
337337

338338
// reload currently active application to avoid outdated cache data
339339
$application = ApplicationHandler::getInstance()->getActiveApplication();

wcfsetup/install/files/lib/command/application/MarkApplicationAsTainted.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use wcf\system\cache\eager\ApplicationCache;
88

99
/**
10-
* Marking an application as tainted, prevents it from loading.
11-
* This should be called during the uninstallation.
10+
* Marking an application as tainted prevents it from being loaded during its
11+
* uninstallation. This MUST NOT be called outside of an active uninstallation.
1212
*
1313
* @author Olaf Braun
1414
* @copyright 2001-2025 WoltLab GmbH
@@ -17,9 +17,9 @@
1717
*/
1818
final class MarkApplicationAsTainted
1919
{
20-
public function __construct(public readonly Application $application)
21-
{
22-
}
20+
public function __construct(
21+
public readonly Application $application
22+
) {}
2323

2424
public function __invoke(): void
2525
{

wcfsetup/install/files/lib/command/application/RebuildApplicationsCookieDomain.class.php renamed to wcfsetup/install/files/lib/command/application/SynchronizeCookieDomain.class.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,15 @@
1010
use wcf\system\WCF;
1111

1212
/**
13-
* Rebuilds application cookie domains.
13+
* Synchronizes the cookie domain for all installed apps.
1414
*
1515
* @author Olaf Braun
1616
* @copyright 2001-2025 WoltLab GmbH
1717
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
1818
* @since 6.3
1919
*/
20-
final class RebuildApplicationsCookieDomain
20+
final class SynchronizeCookieDomain
2121
{
22-
public function __construct()
23-
{
24-
}
25-
2622
public function __invoke(): void
2723
{
2824
$sql = "UPDATE wcf1_application

wcfsetup/install/files/lib/data/application/ApplicationAction.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace wcf\data\application;
44

55
use wcf\command\application\MarkApplicationAsTainted;
6-
use wcf\command\application\RebuildApplicationsCookieDomain;
6+
use wcf\command\application\SynchronizeCookieDomain;
77
use wcf\data\AbstractDatabaseObjectAction;
88

99
/**
@@ -27,11 +27,11 @@ class ApplicationAction extends AbstractDatabaseObjectAction
2727
*
2828
* @return void
2929
*
30-
* @deprecated 6.3 use `RebuildApplicationsCookieDomain`
30+
* @deprecated 6.3 use `SynchronizeCookieDomain`
3131
*/
3232
public function rebuild()
3333
{
34-
(new RebuildApplicationsCookieDomain())();
34+
(new SynchronizeCookieDomain())();
3535
}
3636

3737
/**

wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace wcf\system\application;
44

5-
use wcf\command\application\RebuildApplicationsCookieDomain;
5+
use wcf\command\application\SynchronizeCookieDomain;
66
use wcf\data\application\Application;
77
use wcf\data\package\Package;
88
use wcf\system\cache\eager\ApplicationCache;
@@ -19,22 +19,18 @@
1919
/**
2020
* Handles multi-application environments.
2121
*
22-
* @author Alexander Ebert
23-
* @copyright 2001-2019 WoltLab GmbH
22+
* @author Alexander Ebert
23+
* @copyright 2001-2019 WoltLab GmbH
2424
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
2525
*/
2626
final class ApplicationHandler extends SingletonFactory
2727
{
28-
/**
29-
* application cache
30-
*/
31-
protected ApplicationCacheData $cache;
28+
private ApplicationCacheData $cache;
3229

3330
/**
34-
* list of page URLs
3531
* @var string[]
3632
*/
37-
protected array $pageURLs = [];
33+
private array $pageURLs = [];
3834

3935
/**
4036
* Initializes cache.
@@ -59,8 +55,6 @@ public function getApplication(string $abbreviation): ?Application
5955
/**
6056
* Returns an application delivered by the package with the given id or `null`
6157
* if no such application exists.
62-
*
63-
* @since 3.0
6458
*/
6559
public function getApplicationByID(int $packageID): ?Application
6660
{
@@ -117,7 +111,7 @@ public function getActiveApplication(): Application
117111
/**
118112
* Returns a list of dependent applications.
119113
*
120-
* @return Application[]
114+
* @return Application[]
121115
*/
122116
public function getDependentApplications(): array
123117
{
@@ -135,11 +129,11 @@ public function getDependentApplications(): array
135129
/**
136130
* Returns a list of all active applications.
137131
*
138-
* @return Application[]
132+
* @return Application[]
139133
*/
140134
public function getApplications(): array
141135
{
142-
return $this->cache->application;
136+
return $this->cache->applications;
143137
}
144138

145139
/**
@@ -153,12 +147,11 @@ public function getAbbreviation(int $packageID): ?string
153147
/**
154148
* Returns the list of application abbreviations.
155149
*
156-
* @return string[]
157-
* @since 3.1
150+
* @return string[]
158151
*/
159152
public function getAbbreviations(): array
160153
{
161-
return \array_keys($this->cache->abbreviation);
154+
return \array_keys($this->cache->abbreviations);
162155
}
163156

164157
/**
@@ -188,7 +181,6 @@ public function isInternalURL(string $url): bool
188181
/**
189182
* Always returns false.
190183
*
191-
* @since 3.1
192184
* @deprecated 5.4
193185
*/
194186
public function isMultiDomainSetup(): bool
@@ -197,12 +189,9 @@ public function isMultiDomainSetup(): bool
197189
}
198190

199191
/**
200-
* @since 5.2
201192
* @deprecated 5.5 - This function is a noop. The 'active' status is determined live.
202193
*/
203-
public function rebuildActiveApplication(): void
204-
{
205-
}
194+
public function rebuildActiveApplication(): void {}
206195

207196
/**
208197
* @since 6.0
@@ -217,7 +206,7 @@ public function getDomainName(): string
217206
*/
218207
public static function rebuild(): void
219208
{
220-
(new RebuildApplicationsCookieDomain())();
209+
(new SynchronizeCookieDomain())();
221210
}
222211

223212
/**
@@ -228,7 +217,6 @@ public static function rebuild(): void
228217
* queries, for example.
229218
*
230219
* @param $skipCache if `true`, no caches will be used and relevant application packages will be read from database directly
231-
* @since 5.2
232220
*/
233221
public static function insertRealDatabaseTableNames(string $string, bool $skipCache = false): string
234222
{
@@ -240,7 +228,7 @@ public static function insertRealDatabaseTableNames(string $string, bool $skipCa
240228
}
241229

242230
if ($skipCache) {
243-
$sql = "SELECT package
231+
$sql = "SELECT package
244232
FROM wcf" . WCF_N . "_package
245233
WHERE isApplication = ?";
246234
$statement = WCF::getDB()->prepareUnmanaged($sql);

wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ protected function rebuild(array $parameters): array
2121
$cache = (new ApplicationCache())->getCache();
2222

2323
return [
24-
'application' => $cache->application,
25-
'abbreviation' => $cache->abbreviation,
24+
'application' => $cache->applications,
25+
'abbreviation' => $cache->abbreviations,
2626
];
2727
}
2828

wcfsetup/install/files/lib/system/cache/eager/data/ApplicationCacheData.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ final class ApplicationCacheData
1414
{
1515
public function __construct(
1616
/** @var array<int, Application> */
17-
public readonly array $application,
17+
public readonly array $applications,
1818
/** @var array<string, int> */
19-
public readonly array $abbreviation,
19+
public readonly array $abbreviations,
2020
) {
2121
}
2222

2323
public function getApplication(int $packageID): ?Application
2424
{
25-
return $this->application[$packageID] ?? null;
25+
return $this->applications[$packageID] ?? null;
2626
}
2727

2828
public function getApplicationByAbbreviation(string $abbreviation): ?Application
2929
{
30-
$packageID = $this->abbreviation[$abbreviation] ?? null;
30+
$packageID = $this->abbreviations[$abbreviation] ?? null;
3131
if ($packageID === null) {
3232
return null;
3333
}
@@ -37,6 +37,6 @@ public function getApplicationByAbbreviation(string $abbreviation): ?Application
3737

3838
public function getAbbreviationByPackageID(int $packageID): ?string
3939
{
40-
return \array_search($packageID, $this->abbreviation) ?: null;
40+
return \array_search($packageID, $this->abbreviations) ?: null;
4141
}
4242
}

0 commit comments

Comments
 (0)