Fix the replacing of WCF_N in PHP DDL during app installation
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 18 Jan 2022 11:36:04 +0000 (12:36 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 18 Jan 2022 11:45:01 +0000 (12:45 +0100)
During app installation the newly installed app might not yet be stored within
the application cache, thus failing to replace the `1` within the table
structure definition.

Fix this by setting the `skipCache` parameter to `true`. This will increase the
number of database queries, because applications will be checked once for each
defined table and for each defined FOREIGN KEY, but I don't see a simple fix
for this issue that avoids this increase in query count. Specifically we cannot
simply reset the application cache after inserting the application into
wcf1_application.

wcfsetup/install/files/lib/system/database/table/DatabaseTable.class.php
wcfsetup/install/files/lib/system/database/table/index/DatabaseTableForeignKey.class.php

index 77aecdd6a1c7ed39e21c97b545d19a798172d519..d971a70cb0e36b2c9beadba48d2b8c985be21572 100644 (file)
@@ -49,7 +49,7 @@ class DatabaseTable {
         * @param       string          $name   name of the database table
         */
        protected function __construct($name) {
-               $this->name = ApplicationHandler::insertRealDatabaseTableNames($name);
+               $this->name = ApplicationHandler::insertRealDatabaseTableNames($name, true);
        }
        
        /**
index 848719cdb53814ea09c6efa7cd8c134d0785027c..1e8d49f411698ab162c4a05259a0e689340558d5 100644 (file)
@@ -251,7 +251,7 @@ class DatabaseTableForeignKey {
         * @return      $this                                   this foreign key
         */
        public function referencedTable($referencedTable) {
-               $this->referencedTable = ApplicationHandler::insertRealDatabaseTableNames($referencedTable);
+               $this->referencedTable = ApplicationHandler::insertRealDatabaseTableNames($referencedTable, true);
                
                return $this;
        }