From 20bdbd0c48661574287ed26d88353e1a689eae59 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 12 Jul 2018 19:12:11 +0200 Subject: [PATCH] Use existing `import` method when saving PIP object See #2545 --- .../pip/TXmlGuiPackageInstallationPlugin.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/lib/system/devtools/pip/TXmlGuiPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/devtools/pip/TXmlGuiPackageInstallationPlugin.class.php index 6e0ed9f4e1..eaf339118f 100644 --- a/wcfsetup/install/files/lib/system/devtools/pip/TXmlGuiPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/devtools/pip/TXmlGuiPackageInstallationPlugin.class.php @@ -277,20 +277,18 @@ XML; protected function saveObject(\DOMElement $newElement, \DOMElement $oldElement = null) { $newElementData = $this->getElementData($newElement, true); - if ($oldElement === null) { - call_user_func([$this->className, 'create'], $newElementData); - } - else { + $existingRow = []; + if ($oldElement !== null) { $sqlData = $this->findExistingItem($this->getElementData($oldElement, true)); $statement = WCF::getDB()->prepareStatement($sqlData['sql']); $statement->execute($sqlData['parameters']); - $baseClass = call_user_func([$this->className, 'getBaseClass']); - $itemEditor = new $this->className(new $baseClass(null, $statement->fetchArray())); - $itemEditor->update($newElementData); + $existingRow = $statement->fetchArray(); } + $this->import($existingRow, $newElementData); + $this->postImport(); if (is_subclass_of($this->className, IEditableCachedObject::class)) { -- 2.20.1