From: Matthias Schmidt Date: Thu, 12 Jul 2018 17:12:11 +0000 (+0200) Subject: Use existing `import` method when saving PIP object X-Git-Tag: 5.2.0_Alpha_1~702 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=20bdbd0c48661574287ed26d88353e1a689eae59;p=GitHub%2FWoltLab%2FWCF.git Use existing `import` method when saving PIP object See #2545 --- 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)) {