Fix issues in `TMultiXmlGuiPackageInstallationPlugin`
authorMatthias Schmidt <gravatronics@live.com>
Mon, 15 Oct 2018 17:14:10 +0000 (19:14 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 15 Oct 2018 17:14:10 +0000 (19:14 +0200)
See #2545

wcfsetup/install/files/lib/system/devtools/pip/TMultiXmlGuiPackageInstallationPlugin.class.php

index f324e967a391ee8c0d3ace931416e8045f34a74e..440c4e253cdc203f883489cae71f466b66a92e1e 100644 (file)
@@ -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);
        }
        
        /**