Esempio n. 1
0
 /**
  * Remove empty files
  */
 public function removeAdminhtmlFiles()
 {
     $output = array('removed' => array(), 'not_removed' => array());
     /** @var $dom DOMDocument **/
     foreach ($this->_adminhtmlDomList as $file => $dom) {
         $xpath = new DOMXpath($dom);
         $nodeList = $xpath->query('/config/acl');
         if ($nodeList->length == 0) {
             continue;
         }
         $acl = $nodeList->item(0);
         $countNodes = $acl->childNodes->length - 1;
         for ($i = $countNodes; $i >= 0; $i--) {
             $node = $acl->childNodes->item($i);
             if (in_array($node->nodeName, $this->getNodeToRemove())) {
                 $acl->removeChild($node);
             }
         }
         if ($this->isNodeEmpty($acl)) {
             if (false == $this->_isPreviewMode) {
                 $this->_fileManager->remove($file);
             }
             $output['removed'][] = $file;
         } else {
             $output['not_removed'][] = $file;
         }
     }
     $output['artifacts']['AclXPathToAclId.log'] = json_encode($this->_aclResourceMaps);
     return $output;
 }