public static function getPackageManifest($installPath)
    {
        if (!array_key_exists($installPath, self::$__manifests))
        {
            self::$__manifests[$installPath] = false;

            $directories = new \RecursiveDirectoryIterator($installPath);
            $iterator    = new \RecursiveIteratorIterator($directories);

            $iterator->setMaxDepth(1);

            $files = new \RegexIterator($iterator, '/.*\.xml$/', \RegexIterator::GET_MATCH);
            $manifests = array();
            foreach($files as $file) {
                $manifests = array_unique(array_merge($manifests, $file));
            }

            if (count($manifests))
            {
                // Sort the results by number of subdirectories (root first, then subdirectories)
                usort($manifests, function ($a, $b) {
                    $partsA = explode(DIRECTORY_SEPARATOR, $a);
                    $partsB = explode(DIRECTORY_SEPARATOR, $b);

                    return count($partsA) - count($partsB);
                });

                foreach ($manifests as $manifest)
                {
                    $xml = simplexml_load_file($manifest);

                    if (!($xml instanceof \SimpleXMLElement)) {
                        continue;
                    }

                    if ($xml->getName() == 'extension') {
                        self::$__manifests[$installPath] = $manifest;
                    }

                    unset($xml);
                }
            }
        }

        return self::$__manifests[$installPath];
    }
public static function getPackageManifest($installPath)
    {
        if (!array_key_exists($installPath, self::$__manifests))
        {
            self::$__manifests[$installPath] = false;

            $directories = new \RecursiveDirectoryIterator($installPath);
            $iterator    = new \RecursiveIteratorIterator($directories);

            $iterator->setMaxDepth(1);

            $files = new \RegexIterator($iterator, '/.*\.xml$/', \RegexIterator::GET_MATCH);
            $manifests = array();
            foreach($files as $file) {
                $manifests = array_unique(array_merge($manifests, $file));
            }

            if (count($manifests))
            {
                // Sort the results by number of subdirectories (root first, then subdirectories)
                usort($manifests, function ($a, $b) {
                    $partsA = explode(DIRECTORY_SEPARATOR, $a);
                    $partsB = explode(DIRECTORY_SEPARATOR, $b);

                    return count($partsA) - count($partsB);
                });

                foreach ($manifests as $manifest)
                {
                    $xml = simplexml_load_file($manifest);

                    if (!($xml instanceof \SimpleXMLElement)) {
                        continue;
                    }

                    if ($xml->getName() == 'extension') {
                        self::$__manifests[$installPath] = $manifest;
                    }

                    unset($xml);
                }
            }
        }

        return self::$__manifests[$installPath];
    }
public static function getPackageManifest ( $ installPath ) { if ( ! array_key_exists ( $ installPath , self :: $ __manifests ) ) { self :: $ __manifests [ $ installPath ] = false ; $ directories = new \ RecursiveDirectoryIterator ( $ installPath ) ; $ iterator = new \ RecursiveIteratorIterator ( $ directories ) ; $ iterator -> setMaxDepth ( 1 ) ; $ files = new \ RegexIterator ( $ iterator , '/.*\.xml$/' , \ RegexIterator :: GET_MATCH ) ; $ manifests = array ( ) ; foreach ( $ files as $ file ) { $ manifests = array_unique ( array_merge ( $ manifests , $ file ) ) ; } if ( count ( $ manifests ) ) { // Sort the results by number of subdirectories (root first, then subdirectories) usort ( $ manifests , function ( $ a , $ b ) { $ partsA = explode ( DIRECTORY_SEPARATOR , $ a ) ; $ partsB = explode ( DIRECTORY_SEPARATOR , $ b ) ; return count ( $ partsA ) - count ( $ partsB ) ; } ) ; foreach ( $ manifests as $ manifest ) { $ xml = simplexml_load_file ( $ manifest ) ; if ( ! ( $ xml instanceof \ SimpleXMLElement ) ) { continue ; } if ( $ xml -> getName ( ) == 'extension' ) { self :: $ __manifests [ $ installPath ] = $ manifest ; } unset ( $ xml ) ; } } } return self :: $ __manifests [ $ installPath ] ; }
Find the XML manifest of the installation package

@param string $installPath Install path of package

@return string Full path to manifest file
Find the XML manifest of the installation package