From e4c11cab7cd2129c318db554e24663629d46b8b0 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 15 Oct 2018 19:14:10 +0200 Subject: [PATCH] Fix issues in `TMultiXmlGuiPackageInstallationPlugin` See #2545 --- ...tiXmlGuiPackageInstallationPlugin.class.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/lib/system/devtools/pip/TMultiXmlGuiPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/devtools/pip/TMultiXmlGuiPackageInstallationPlugin.class.php index f324e967a3..440c4e253c 100644 --- a/wcfsetup/install/files/lib/system/devtools/pip/TMultiXmlGuiPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/devtools/pip/TMultiXmlGuiPackageInstallationPlugin.class.php @@ -45,9 +45,7 @@ trait TMultiXmlGuiPackageInstallationPlugin { $this->saveObject($newElement); - // TODO: while creating/testing the gui, write into a temporary file - // $xml->write($this->getXmlFileLocation($project)); - $xml->write(substr($xml->getPath(), 0, -4) . '_tmp.xml'); + $xml->write($xml->getPath()); } } @@ -61,7 +59,7 @@ trait TMultiXmlGuiPackageInstallationPlugin { * @return string new identifier */ public function editEntry(IFormDocument $form, $identifier) { - $newEntry = null; + $newElement = null; foreach ($this->getProjectXmls() as $xml) { $document = $xml->getDocument(); @@ -70,20 +68,18 @@ trait TMultiXmlGuiPackageInstallationPlugin { // replace old element $element = $this->getElementByIdentifier($xml, $identifier); - DOMUtil::replaceElement($newElement, $element); + DOMUtil::replaceElement($element, $newElement); - $this->saveObject($newEntry, $element); + $this->saveObject($newElement, $element); - // TODO: while creating/testing the gui, write into a temporary file - // $xml->write($this->getXmlFileLocation($project)); - $xml->write(substr($xml->getPath(), 0, -4) . '_tmp.xml'); + $xml->write($xml->getPath()); } - if ($newEntry === null) { + if ($newElement === null) { throw new \UnexpectedValueException("Have not edited any entry"); } - return $this->getElementIdentifier($newEntry); + return $this->getElementIdentifier($newElement); } /** -- 2.20.1