In `ApplicationCacheBuilder` and `ApplicationHandler::insertRealDatabaseTableNames...
authorCyperghost <olaf_schmitz_1@t-online.de>
Tue, 22 Oct 2024 07:51:27 +0000 (09:51 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Tue, 22 Oct 2024 07:51:27 +0000 (09:51 +0200)
wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php
wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php

index 46c63a29828b40a69b82b122471b99deaf95cf3b..8a599987bdeef65522375498696aa15a9900bc01 100644 (file)
@@ -6,11 +6,11 @@ use wcf\data\application\Application;
 use wcf\data\application\ApplicationAction;
 use wcf\data\application\ApplicationList;
 use wcf\data\package\Package;
-use wcf\data\package\PackageList;
 use wcf\system\cache\builder\ApplicationCacheBuilder;
 use wcf\system\request\RequestHandler;
 use wcf\system\request\RouteHandler;
 use wcf\system\SingletonFactory;
+use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 use wcf\util\FileUtil;
 use wcf\util\StringUtil;
@@ -263,21 +263,24 @@ final class ApplicationHandler extends SingletonFactory
         }
 
         if ($skipCache) {
-            $packageList = new PackageList();
-            $packageList->getConditionBuilder()->add('package.isApplication = ?', [1]);
-            $packageList->readObjects();
+            $sql = "SELECT package 
+                    FROM   wcf" . WCF_N . "_package
+                    WHERE  isApplication = ?";
+            $statement = WCF::getDB()->prepareUnmanaged($sql);
+            $statement->execute([1]);
+            $packages = $statement->fetchAll(\PDO::FETCH_COLUMN);
 
             $abbreviations = \implode(
                 '|',
-                \array_map(static function (Package $package): string {
-                    return \preg_quote(Package::getAbbreviation($package->package), '~');
-                }, $packageList->getObjects())
+                \array_map(static function (string $package): string {
+                    return \preg_quote(Package::getAbbreviation($package), '~');
+                }, $packages)
             );
             $regex = "~(\\b(?:{$abbreviations}))1_~";
 
             $string = \preg_replace(
                 $regex,
-                '${1}1_',
+                '${1}' . WCF_N . '_',
                 $string
             );
         } else {
@@ -296,7 +299,7 @@ final class ApplicationHandler extends SingletonFactory
 
             $string = \preg_replace(
                 $regex,
-                '${1}1_',
+                '${1}' . WCF_N . '_',
                 $string
             );
         }
index a2fe741eaa5de5438a54df7ea6812ed993d5d8ba..1333b423db0c3aef90bc4b71261264906c3d8b07 100644 (file)
@@ -2,9 +2,9 @@
 
 namespace wcf\system\cache\builder;
 
-use wcf\data\application\ApplicationList;
+use wcf\data\application\Application;
 use wcf\data\package\Package;
-use wcf\data\package\PackageList;
+use wcf\system\WCF;
 
 /**
  * Caches applications.
@@ -26,19 +26,25 @@ class ApplicationCacheBuilder extends AbstractCacheBuilder
         ];
 
         // fetch applications
-        $applicationList = new ApplicationList();
-        $applicationList->readObjects();
+        $sql = "SELECT *
+                FROM   wcf" . WCF_N . "_application";
+        $statement = WCF::getDB()->prepareUnmanaged($sql);
+        $statement->execute();
+        $applications = $statement->fetchObjects(Application::class);
 
-        foreach ($applicationList as $application) {
+        foreach ($applications as $application) {
             $data['application'][$application->packageID] = $application;
         }
 
         // fetch abbreviations
-        $packageList = new PackageList();
-        $packageList->getConditionBuilder()->add('package.isApplication = ?', [1]);
-        $packageList->readObjects();
-        foreach ($packageList as $package) {
-            $data['abbreviation'][Package::getAbbreviation($package->package)] = $package->packageID;
+        $sql = "SELECT packageID, package
+                FROM   wcf" . WCF_N . "_package
+                WHERE  isApplication = ?";
+        $statement = WCF::getDB()->prepareUnmanaged($sql);
+        $statement->execute([1]);
+        $packages = $statement->fetchMap('packageID', 'package');
+        foreach ($packages as $packageID => $package) {
+            $data['abbreviation'][Package::getAbbreviation($package)] = $packageID;
         }
 
         return $data;