protected function parse($manifestFile) { $this->manifestFile = $manifestFile; if (!file_exists($manifestFile)) { throw new Exception('Manifest file not found'); } /* @var $dom Zend_Dom_Query */ $dom = new Zend_Dom_Query(@file_get_contents($manifestFile)); $this->m_label = $dom->queryXPath('/vs-manifest/metadata/label')->current()->nodeValue; $this->m_description = $dom->queryXPath('/vs-manifest/metadata/description')->current()->nodeValue; $this->m_file = $dom->queryXPath('/vs-manifest/metadata/file')->current()->nodeValue; $this->m_class = $dom->queryXPath('/vs-manifest/metadata/class')->current()->nodeValue; $this->m_version = $dom->queryXPath('/vs-manifest/metadata/version')->current()->nodeValue; $this->m_key = $dom->queryXPath('/vs-manifest/metadata/key')->current()->nodeValue; $this->m_c_from = $dom->queryXPath('/vs-manifest/metadata/compatibility/from')->current()->nodeValue; try { $this->m_c_to = $dom->queryXPath('/vs-manifest/metadata/compatibility/to')->current()->nodeValue; } catch (Exception $e) { $this->m_c_to = null; } // if there is no TO, it isn't a problem $filesXPath = $dom->queryXPath('/vs-manifest/files//file'); while ($filesXPath->valid()) { $node = $filesXPath->current(); $properties = array(); for ($i = 0; $i < $node->attributes->length; $i++) { $properties[$node->attributes->item($i)->nodeName] = $node->attributes->item($i)->nodeValue; } $filename = $node->nodeValue; $parentStack = array(); $parent = $node->parentNode; while ($parent != null && !($parent->nodeName == 'files' && $parent->parentNode->nodeName == 'vs-manifest')) { // we are at top $parentStack[] = $parent->nodeName; $parent = $parent->parentNode; } $path = implode('/', array_reverse($parentStack, false)); if ($properties) { X_Debug::i("Properties for {{$path}/{$filename}}: " . print_r($properties, true)); } $this->files[] = new X_Egg_File("{$path}/{$filename}", $this->basePath, $this->destinationPath, $properties); $filesXPath->next(); } try { $this->installSql = @$dom->queryXPath('/vs-manifest/database/install')->current()->nodeValue; } catch (Exception $e) { $this->installSql = null; } // if there is no TO, it isn't a problem try { $this->uninstallSql = @$dom->queryXPath('/vs-manifest/database/uninstall')->current()->nodeValue; } catch (Exception $e) { $this->uninstallSql = null; } // if there is no TO, it isn't a problem // new fragment of manifest about acl $aclClassesXPath = $dom->queryXPath('/vs-manifest/acl/classes/class'); while ($aclClassesXPath->valid()) { $node = $aclClassesXPath->current(); $properties = array(); for ($i = 0; $i < $node->attributes->length; $i++) { $properties[$node->attributes->item($i)->nodeName] = $node->attributes->item($i)->nodeValue; } $classname = $node->nodeValue; $this->acl_classes[] = new X_Egg_AclClass($classname, $properties); $aclClassesXPath->next(); } // new fragment of manifest about acl $aclResourcesXPath = $dom->queryXPath('/vs-manifest/acl/resources/resource'); while ($aclResourcesXPath->valid()) { $node = $aclResourcesXPath->current(); $properties = array(); for ($i = 0; $i < $node->attributes->length; $i++) { $properties[$node->attributes->item($i)->nodeName] = $node->attributes->item($i)->nodeValue; } $key = $node->nodeValue; $this->acl_resources[] = new X_Egg_AclResource($key, $properties); $aclResourcesXPath->next(); } }