From de8d852eb8e5eb19f7ddf5e53de340c621b4f287 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 3 Aug 2022 14:55:55 +0200 Subject: [PATCH] Use `->prepare()` in SQL queries with static table names in PIPs --- ...LOptionPackageInstallationPlugin.class.php | 6 +-- ...emplatePackageInstallationPlugin.class.php | 4 +- .../BBCodePackageInstallationPlugin.class.php | 6 +-- .../BoxPackageInstallationPlugin.class.php | 42 +++++++++---------- ...dActionPackageInstallationPlugin.class.php | 10 ++--- ...atabasePackageInstallationPlugin.class.php | 4 +- .../FilePackageInstallationPlugin.class.php | 8 ++-- ...anguagePackageInstallationPlugin.class.php | 28 ++++++------- ...enuItemPackageInstallationPlugin.class.php | 24 +++++------ .../MenuPackageInstallationPlugin.class.php | 28 ++++++------- ...ectTypePackageInstallationPlugin.class.php | 8 ++-- .../PagePackageInstallationPlugin.class.php | 8 ++-- .../SQLPackageInstallationPlugin.class.php | 6 +-- .../ScriptPackageInstallationPlugin.class.php | 4 +- ...emplatePackageInstallationPlugin.class.php | 6 +-- ...pOptionPackageInstallationPlugin.class.php | 8 ++-- ...onEventPackageInstallationPlugin.class.php | 12 +++--- ...rOptionPackageInstallationPlugin.class.php | 4 +- 18 files changed, 108 insertions(+), 108 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php index 5274c3b72c..888ee9846b 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php @@ -316,14 +316,14 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati { if (!isset($this->optionTypeIDs[$optionType])) { $sql = "SELECT objectTypeID - FROM wcf" . WCF_N . "_object_type + FROM wcf1_object_type WHERE objectType = ? AND definitionID IN ( SELECT definitionID - FROM wcf" . WCF_N . "_object_type_definition + FROM wcf1_object_type_definition WHERE definitionName = 'com.woltlab.wcf.acl' )"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$optionType]); $objectTypeID = $statement->fetchSingleColumn(); if ($objectTypeID === false) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php index 0cc8285fa8..0d0b691b84 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php @@ -63,9 +63,9 @@ class ACPTemplatePackageInstallationPlugin extends AbstractPackageInstallationPl { // fetch ACP templates from log $sql = "SELECT templateName, application - FROM wcf" . WCF_N . "_acp_template + FROM wcf1_acp_template WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); $templates = []; diff --git a/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php index aa101c86a7..52fcc5f8c8 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php @@ -208,9 +208,9 @@ class BBCodePackageInstallationPlugin extends AbstractXMLPackageInstallationPlug $condition->add('bbcodeID IN (?)', [\array_keys($this->attributes)]); // clear attributes - $sql = "DELETE FROM wcf" . WCF_N . "_bbcode_attribute - " . $condition; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "DELETE FROM wcf1_bbcode_attribute + {$condition}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($condition->getParameters()); if (!empty($this->attributes)) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index 6f49be64c4..cf9e81167e 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -98,10 +98,10 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin */ protected function handleDelete(array $items) { - $sql = "DELETE FROM wcf" . WCF_N . "_box + $sql = "DELETE FROM wcf1_box WHERE identifier = ? AND packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($items as $item) { @@ -213,12 +213,12 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin } $sql = "SELECT objectTypeID - FROM wcf" . WCF_N . "_object_type object_type - LEFT JOIN wcf" . WCF_N . "_object_type_definition object_type_definition + FROM wcf1_object_type object_type + LEFT JOIN wcf1_object_type_definition object_type_definition ON object_type_definition.definitionID = object_type.definitionID WHERE objectType = ? AND definitionName = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$data['elements']['objectType'], 'com.woltlab.wcf.boxController']); $objectTypeID = $statement->fetchSingleColumn(); if (!$objectTypeID) { @@ -326,9 +326,9 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin protected function getItemOrder($position) { $sql = "SELECT MAX(showOrder) AS showOrder - FROM wcf" . WCF_N . "_box + FROM wcf1_box WHERE position = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$position]); $row = $statement->fetchSingleRow(); @@ -377,15 +377,15 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin { if (!empty($this->content)) { $sql = "SELECT COUNT(*) AS count - FROM wcf" . WCF_N . "_box_content + FROM wcf1_box_content WHERE boxID = ? AND languageID IS NULL"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); - $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_box_content + $sql = "INSERT IGNORE INTO wcf1_box_content (boxID, languageID, title, content) VALUES (?, ?, ?, ?)"; - $insertStatement = WCF::getDB()->prepareStatement($sql); + $insertStatement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($this->content as $boxID => $contentData) { @@ -449,22 +449,22 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $conditions->add("packageID = ?", [$this->installation->getPackageID()]); $sql = "SELECT * - FROM wcf" . WCF_N . "_box - " . $conditions; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_box + {$conditions}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditions->getParameters()); /** @var Box[] $boxes */ $boxes = $statement->fetchObjects(Box::class, 'identifier'); // save visibility exceptions - $sql = "DELETE FROM wcf" . WCF_N . "_box_to_page + $sql = "DELETE FROM wcf1_box_to_page WHERE boxID = ?"; - $deleteStatement = WCF::getDB()->prepareStatement($sql); - $sql = "INSERT IGNORE wcf" . WCF_N . "_box_to_page + $deleteStatement = WCF::getDB()->prepare($sql); + $sql = "INSERT IGNORE wcf1_box_to_page (boxID, pageID, visible) VALUES (?, ?, ?)"; - $insertStatement = WCF::getDB()->prepareStatement($sql); + $insertStatement = WCF::getDB()->prepare($sql); foreach ($this->visibilityExceptions as $boxIdentifier => $pages) { // delete old visibility exceptions $deleteStatement->execute([$boxes[$boxIdentifier]->boxID]); @@ -473,9 +473,9 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('identifier IN (?)', [$pages]); $sql = "SELECT pageID - FROM wcf" . WCF_N . "_page - " . $conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_page + {$conditionBuilder}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditionBuilder->getParameters()); $pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php index d33987b45b..fe9bcc3ff5 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php @@ -154,17 +154,17 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall $conditionBuilder->add('actionID IN (?)', [\array_keys($this->pages)]); // clear pages - $sql = "DELETE FROM wcf" . WCF_N . "_clipboard_page - " . $conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "DELETE FROM wcf1_clipboard_page + {$conditionBuilder}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditionBuilder->getParameters()); if (!empty($this->pages)) { // insert pages - $sql = "INSERT INTO wcf" . WCF_N . "_clipboard_page + $sql = "INSERT INTO wcf1_clipboard_page (pageClassName, packageID, actionID) VALUES (?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); foreach ($this->pages as $actionID => $pages) { foreach ($pages as $pageClassName) { $statement->execute([ diff --git a/wcfsetup/install/files/lib/system/package/plugin/DatabasePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/DatabasePackageInstallationPlugin.class.php index 30cdaf0a01..583f36ed0e 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/DatabasePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/DatabasePackageInstallationPlugin.class.php @@ -48,10 +48,10 @@ class DatabasePackageInstallationPlugin extends AbstractPackageInstallationPlugi $this->updateDatabase($scriptPath); if (@\unlink($scriptPath)) { - $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_file_log + $sql = "DELETE FROM wcf1_package_installation_file_log WHERE packageID = ? AND filename = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $this->installation->getPackageID(), $this->instruction['value'], diff --git a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php index e15d102cd0..41acab566f 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php @@ -68,10 +68,10 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin im Package::writeConfigFile($this->installation->getPackageID()); // log files - $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_file_log + $sql = "INSERT INTO wcf1_package_installation_file_log (packageID, filename, application, sha256, lastUpdated) VALUES (?, ?, ?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); foreach ([ PackageInstallationDispatcher::CONFIG_FILE, 'config.inc.php', @@ -102,9 +102,9 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin im { // fetch files from log $sql = "SELECT filename, application - FROM wcf" . WCF_N . "_package_installation_file_log + FROM wcf1_package_installation_file_log WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); $files = $statement->fetchMap('application', 'filename', false); diff --git a/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php index 9a959cbbc3..af67264e33 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php @@ -109,9 +109,9 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl // get installed languages $sql = "SELECT * - FROM wcf" . WCF_N . "_language + FROM wcf1_language ORDER BY isDefault DESC"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute(); $installedLanguages = $statement->fetchAll(\PDO::FETCH_ASSOC); @@ -186,9 +186,9 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl // Get all items and their categories // which where installed from this package. $sql = "SELECT languageItemID, languageCategoryID, languageID - FROM wcf" . WCF_N . "_language_item + FROM wcf1_language_item WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); $itemIDs = []; $categoryIDs = []; @@ -255,13 +255,13 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl $sql = "SELECT COUNT(item.languageItemID) AS count, language_category.languageCategoryID, language_category.languageCategory - FROM wcf" . WCF_N . "_language_category language_category - LEFT JOIN wcf" . WCF_N . "_language_item item + FROM wcf1_language_category language_category + LEFT JOIN wcf1_language_item item ON item.languageCategoryID = language_category.languageCategoryID - " . $conditions . " + {$conditions} GROUP BY language_category.languageCategoryID ASC, language_category.languageCategory ASC"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditions->getParameters()); $categoriesToDelete = []; while ($row = $statement->fetchArray()) { @@ -272,9 +272,9 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl // Delete categories from DB. if (!empty($categoriesToDelete)) { - $sql = "DELETE FROM wcf" . WCF_N . "_language_category + $sql = "DELETE FROM wcf1_language_category WHERE languageCategory = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); foreach ($categoriesToDelete as $category) { $statement->execute([$category]); @@ -706,10 +706,10 @@ XML; $existingRow = []; if ($oldElement !== null) { $sql = "SELECT * - FROM wcf" . WCF_N . "_language_item + FROM wcf1_language_item WHERE languageItem = ? AND languageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $oldElement->getAttribute('name'), // use new element as old element has no access to parent element anymore @@ -881,10 +881,10 @@ XML; */ protected function deleteObject(\DOMElement $element) { - $sql = "DELETE FROM wcf" . WCF_N . "_language_item + $sql = "DELETE FROM wcf1_language_item WHERE languageItem = ? AND packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $element->getAttribute('name'), $this->installation->getPackageID(), diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php index a4bb9c1070..9e0d3e95af 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php @@ -57,14 +57,14 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl */ protected function handleDelete(array $items) { - $sql = "DELETE FROM wcf" . WCF_N . "_menu_item + $sql = "DELETE FROM wcf1_menu_item WHERE identifier = ? AND packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); - $sql = "DELETE FROM wcf" . WCF_N . "_language_item + $sql = "DELETE FROM wcf1_language_item WHERE languageItem = ?"; - $languageItemStatement = WCF::getDB()->prepareStatement($sql); + $languageItemStatement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($items as $item) { @@ -126,9 +126,9 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl } $sql = "SELECT * - FROM wcf" . WCF_N . "_menu_item + FROM wcf1_menu_item WHERE identifier = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$data['elements']['parent']]); /** @var MenuItem|null $parent */ @@ -192,9 +192,9 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl protected function getMenuID($identifier) { $sql = "SELECT menuID - FROM wcf" . WCF_N . "_menu + FROM wcf1_menu WHERE identifier = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$identifier]); return $statement->fetchSingleColumn(); @@ -210,9 +210,9 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl protected function getPageID($identifier) { $sql = "SELECT pageID - FROM wcf" . WCF_N . "_page + FROM wcf1_page WHERE identifier = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$identifier]); return $statement->fetchSingleColumn(); @@ -263,9 +263,9 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl protected function getItemOrder($menuID, $parentItemID = null) { $sql = "SELECT MAX(showOrder) AS showOrder - FROM wcf" . WCF_N . "_menu_item + FROM wcf1_menu_item WHERE " . ($parentItemID === null ? 'menuID' : 'parentItemID') . " = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([ $parentItemID === null ? $menuID : $parentItemID, ]); diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index e99d8cd23c..e972fe4c18 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -72,14 +72,14 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin */ protected function handleDelete(array $items) { - $sql = "DELETE FROM wcf" . WCF_N . "_menu + $sql = "DELETE FROM wcf1_menu WHERE identifier = ? AND packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); - $sql = "DELETE FROM wcf" . WCF_N . "_language_item + $sql = "DELETE FROM wcf1_language_item WHERE languageItem = ?"; - $languageItemStatement = WCF::getDB()->prepareStatement($sql); + $languageItemStatement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($items as $item) { @@ -247,9 +247,9 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $conditions->add("packageID = ?", [$this->installation->getPackageID()]); $sql = "SELECT * - FROM wcf" . WCF_N . "_box - " . $conditions; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_box + {$conditions}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditions->getParameters()); /** @var Box[] $boxes */ @@ -266,13 +266,13 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin } // handle visibility exceptions - $sql = "DELETE FROM wcf" . WCF_N . "_box_to_page + $sql = "DELETE FROM wcf1_box_to_page WHERE boxID = ?"; - $deleteStatement = WCF::getDB()->prepareStatement($sql); - $sql = "INSERT IGNORE wcf" . WCF_N . "_box_to_page + $deleteStatement = WCF::getDB()->prepare($sql); + $sql = "INSERT IGNORE wcf1_box_to_page (boxID, pageID, visible) VALUES (?, ?, ?)"; - $insertStatement = WCF::getDB()->prepareStatement($sql); + $insertStatement = WCF::getDB()->prepare($sql); foreach ($this->boxData as $identifier => $data) { // connect box with menu if (isset($menus[$identifier])) { @@ -302,9 +302,9 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('identifier IN (?)', [$this->visibilityExceptions[$identifier]]); $sql = "SELECT pageID - FROM wcf" . WCF_N . "_page - " . $conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_page + {$conditionBuilder}"; + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditionBuilder->getParameters()); $pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php index c56ad92d5f..bb8bb58b17 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php @@ -97,9 +97,9 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation { // get object type id $sql = "SELECT definitionID - FROM wcf" . WCF_N . "_object_type_definition + FROM wcf1_object_type_definition WHERE definitionName = ?"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$definitionName]); $row = $statement->fetchArray(); if (empty($row['definitionID'])) { @@ -551,9 +551,9 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation } $sql = "SELECT optionType - FROM wcf" . WCF_N . "_user_group_option + FROM wcf1_user_group_option WHERE optionName = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([\reset($value)]); if ($statement->fetchSingleColumn() !== 'BBCodeSelect') { $formField->addValidationError( diff --git a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php index c4a4eb4127..d6745916cb 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php @@ -358,15 +358,15 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin { if (!empty($this->content)) { $sql = "SELECT COUNT(*) AS count - FROM wcf" . WCF_N . "_page_content + FROM wcf1_page_content WHERE pageID = ? AND languageID IS NULL"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); - $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_page_content + $sql = "INSERT IGNORE INTO wcf1_page_content (pageID, languageID, title, content, metaDescription, customURL) VALUES (?, ?, ?, ?, ?, ?)"; - $insertStatement = WCF::getDB()->prepareStatement($sql); + $insertStatement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($this->content as $pageID => $contentData) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php index 35941e9d4e..d1899ade35 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php @@ -83,18 +83,18 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin public function uninstall() { // get logged sql tables/columns - $sql = "SELECT wcf" . WCF_N . "_package_installation_sql_log.*, + $sql = "SELECT wcf1_package_installation_sql_log.*, CASE WHEN sqlIndex <> '' THEN 1 ELSE 0 END AS isIndex, CASE WHEN sqlColumn <> '' THEN 1 ELSE 0 END AS isColumn, CASE WHEN SUBSTRING(sqlIndex, -3) = '_fk' THEN 1 ELSE 0 END AS isForeignKey - FROM wcf" . WCF_N . "_package_installation_sql_log + FROM wcf1_package_installation_sql_log WHERE packageID = ? ORDER BY isIndex DESC, isForeignKey DESC, sqlIndex, isColumn DESC, sqlColumn"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); $entries = $statement->fetchAll(\PDO::FETCH_ASSOC); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php index 3eb5302b30..b815082338 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php @@ -61,10 +61,10 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin // delete script if (!($result instanceof FormDocument) && @\unlink($path . $this->instruction['value'])) { // delete file log entry - $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_file_log + $sql = "DELETE FROM wcf1_package_installation_file_log WHERE packageID = ? AND filename = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $this->installation->getPackageID(), $this->instruction['value'], diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php index d3d0b63bc4..707224514c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php @@ -63,11 +63,11 @@ class TemplatePackageInstallationPlugin extends AbstractPackageInstallationPlugi // fetch templates from log $sql = "SELECT template.templateName, template.application, template_group.templateGroupFolderName - FROM wcf" . WCF_N . "_template template - LEFT JOIN wcf" . WCF_N . "_template_group template_group + FROM wcf1_template template + LEFT JOIN wcf1_template_group template_group ON template_group.templateGroupID = template.templateGroupID WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); $templates = []; diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php index 9543b33c2a..7deda6578d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php @@ -151,10 +151,10 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst // check if the option exist already and was installed by this package $sql = "SELECT optionID - FROM wcf" . WCF_N . "_user_group_option + FROM wcf1_user_group_option WHERE optionName = ? AND packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $optionName, $this->installation->getPackageID(), @@ -240,8 +240,8 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst ]; $sql = "SELECT groupID, groupType - FROM wcf" . WCF_N . "_user_group"; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_user_group"; + $statement = WCF::getDB()->prepare($sql); $statement->execute(); while ($row = $statement->fetchArray()) { $group = new UserGroup(null, $row); diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php index 9e29576464..11a86d9a66 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php @@ -122,11 +122,11 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI return; } - $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_notification_event_to_user + $sql = "INSERT IGNORE INTO wcf1_user_notification_event_to_user (userID, eventID, mailNotificationType) SELECT userID, ?, ? - FROM wcf" . WCF_N . "_user"; - $statement = WCF::getDB()->prepareStatement($sql); + FROM wcf1_user"; + $statement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($this->presetEventIDs as $eventID => $mailNotificationType) { $statement->execute([$eventID, $mailNotificationType]); @@ -165,14 +165,14 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI { // get object type id $sql = "SELECT object_type.objectTypeID - FROM wcf" . WCF_N . "_object_type object_type + FROM wcf1_object_type object_type WHERE object_type.objectType = ? AND object_type.definitionID IN ( SELECT definitionID - FROM wcf" . WCF_N . "_object_type_definition + FROM wcf1_object_type_definition WHERE definitionName = 'com.woltlab.wcf.notification.objectType' )"; - $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement = WCF::getDB()->prepare($sql, 1); $statement->execute([$objectType]); $row = $statement->fetchArray(); if (empty($row['objectTypeID'])) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 9f3e3efe12..1eddc70c9c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -239,9 +239,9 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat { // get optionsIDs from package $sql = "SELECT optionID - FROM wcf" . WCF_N . "_user_option + FROM wcf1_user_option WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([$this->installation->getPackageID()]); while ($row = $statement->fetchArray()) { WCF::getDB()->getEditor()->dropColumn( -- 2.20.1