From: Matthias Schmidt Date: Mon, 15 Oct 2018 17:14:10 +0000 (+0200) Subject: Fix issues in `TMultiXmlGuiPackageInstallationPlugin` X-Git-Tag: 5.2.0_Alpha_1~623 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4c11cab7cd2129c318db554e24663629d46b8b0;p=GitHub%2FWoltLab%2FWCF.git Fix issues in `TMultiXmlGuiPackageInstallationPlugin` See #2545 --- 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); } /**