Remove sorting of acl options
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 13:45:46 +0000 (15:45 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 13:45:46 +0000 (15:45 +0200)
See #2545

wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php

index 2db7042848f52ec3859309c7f122355a785a4cd4..d416eef4e8d7d9de6e7fbb3b2093e64b30cf9bbd 100644 (file)
@@ -600,59 +600,8 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati
        protected function sortDocument(\DOMDocument $document) {
                $this->sortImportDelete($document);
                
-               // `<categories>` before `<options>`
-               $compareFunction = function(\DOMElement $element1, \DOMElement $element2) {
-                       if ($element1->nodeName === 'categories') {
-                               return -1;
-                       }
-                       else if ($element2->nodeName === 'categories') {
-                               return 1;
-                       }
-                       
-                       return 0;
-               };
-               
-               $this->sortChildNodes($document->getElementsByTagName('import'), $compareFunction);
-               $this->sortChildNodes($document->getElementsByTagName('delete'), $compareFunction);
-               
-               $compareFunction = function(\DOMElement $element1, \DOMElement $element2) {
-                       $objectType1 = $element1->getElementsByTagName('objecttype')->item(0)->nodeValue;
-                       $objectType2 = $element2->getElementsByTagName('objecttype')->item(0)->nodeValue;
-                       
-                       if ($objectType1 !== $objectType2) {
-                               return strcmp($objectType1, $objectType2);
-                       }
-                       
-                       if ($element1->nodeName === 'option') {
-                               $categoryName1 = $element1->getElementsByTagName('categoryname')->item(0);
-                               $categoryName2 = $element2->getElementsByTagName('categoryname')->item(0);
-                               
-                               if ($categoryName1 !== null) {
-                                       // both categories specified
-                                       if ($categoryName2 !== null) {
-                                               if ($categoryName1->nodeValue !== $categoryName2->nodeValue) {
-                                                       return strcmp($categoryName1->nodeValue, $categoryName2->nodeValue);
-                                               }
-                                       }
-                                       // only first category specified
-                                       else {
-                                               return 1;
-                                       }
-                               }
-                               // only second category specified
-                               else if ($categoryName2 !== null) {
-                                       return -1;
-                               }
-                       }
-                       
-                       return strcmp(
-                               $element1->getAttribute('name'),
-                               $element2->getAttribute('name')
-                       );
-               };
-               
-               $this->sortChildNodes($document->getElementsByTagName('categories'), $compareFunction);
-               $this->sortChildNodes($document->getElementsByTagName('options'), $compareFunction);
+               // do not sort options and categories as their position in the XML
+               // file implies the order in which they are shown in the frontend
        }
        
        /**