Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/lib/ZZOSS_Package/Package.php
<?php  
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /**
    @version $Id: Package.php,v 1.12 2004/04/05 09:58:16 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */

require_once 'PEAR.php';
require_once 'Archive/Tar.php';
require_once 'System.php';
require_once 'ZZOSS_Installer/Registry.php';
require_once 'ZZOSS_Config/Config.php';
require_once 'ZZOSS_Debug/Debug.php';
require_once 'ZZOSS_Dir/Dir.php';

/**   
 * This class parses the XML config file and provides the objects of the  
 * XML document.   
 *   
 * Extends PEAR XML_Parser class.   
 *   
 * @version  1   
 * @author   Sandro Zic <hide@address.com>; |    
 */   
   
class ZZOSS_Package extends PEAR {
    
    /**
    * Log information.
    */
    var $log = '';
    
    /**
    * Packages that could not be processed.
    */
    var $pkgs_unprocessed = array();
    
    /**
    * The path to the bundle tgz.
    */
    var $_bundle_tgz = '';
    
    /*
    * Destructor
    */
    function _ZZOSS_Package()
    {
        // clean up temporary bundle tgz
        if ($this->_bundle_tgz != ''){
            @unlink($this->_bundle_tgz);
        }
        $this->_PEAR();
    }
    
    function extractBundles($src, $dest, $backup_dest = NULL)
    {
        if(!is_dir($src)) {
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', 'Is not a directory: '.$src, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            return false;
        } else {
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', 'Extracting bundle from '.$src.' to '.$dest, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            // check directory for tgz files
            if($dp = @opendir($src)) {
                while (false !== ($file = readdir($dp))) {
                        $file = $src.$file;
                        ZZOSS_Package::extractBundle($file, $dest, $backup_dest);
                }
                closedir($dp);
            }
            
            return true;
        }
    }
    
    function mkBundle($dir_src, $distri_xml = null, $app_xml = null)
    {
        // reset previous bundle tgz
        $this->_bundle_tgz = '';
        
        // if distri or app XML are not provided, we
        // asumme they are within the src dir
        if(is_null($distri_xml)){
            $distri_xml = $dir_src.DIRECTORY_SEPARATOR.'distribution.xml';
        }
        if(is_null($app_xml)){
            $app_xml = $dir_src.DIRECTORY_SEPARATOR.'application.xml';
        }
        
        // destination directory is the temp dir of the system
        $dir_dest = System::tmpdir().DIRECTORY_SEPARATOR;
        
        // check whether distribution and app XML exist
        if(!file_exists($distri_xml)){
            return PEAR::raiseError("Distribution XML does not exist at '$distri_xml'");
        }
        if(!file_exists($app_xml)){
            return PEAR::raiseError("Distribution XML does not exist at '$app_xml'");
        }
        
        $config = new ZZOSS_Config;
        $config->setFile($distri_xml);
        $xml = $config->query('/distribution');
        $distri_name = $xml['name'];
        
        $config = new ZZOSS_Config;
        $config->setFile($app_xml);
        $xml = $config->query('/application');
        $app_name = $xml['name'];
        $app_version = $xml['release']['version'];
        
        // clean up memory
        unset($config);
        unset($xml);
        
        //System::mkdir(array('-p', $dir_dest));
        
        // copy the distribution XML descriptor to the bundle directory
        //copy($distri_xml, $dir_src.'distribution.xml');
        // copy the application XML descriptor to the bundle directory
        //copy($app_xml, $dir_src.'application.xml');
        
        // Create the bundle.tgz
        $instant_tgz = $app_name.'-'.$app_version.'.tgz';
        $bundle_tgz = $distri_name.'.'.$app_name.'.bundle-'.$app_version.'.tgz';
        
        if($dp = @opendir($dir_src)) {
            while (false !== ($entry = readdir($dp))) {
                // make sure that we do not include the bundle or the instant bundle
                if($entry != '.' && $entry != '..') {
                    $tar_list[] = $entry;
                }
            }
            closedir($dp);
        }
        
        $cwd = getcwd();
        chdir($dir_src);
        $tar = new Archive_Tar($dir_dest.$bundle_tgz);
        $tar->create($tar_list);
        chdir($cwd);
        // add distribution and app XML to the tgz
        $tar->addModify($distri_xml, '', dirname($distri_xml));
        $tar->addModify($app_xml, '', dirname($app_xml));
        
        // copy bundle to bundles/ directory of installer
        //copy($dir_src.$bundle_tgz, $dir_dest.$bundle_tgz);
        //@unlink($dir_src.$bundle_tgz);
        
        // We use PEAR to clean up the temporary bundle upon shutdown
        // with the destructor.
        // Notice that ZZOSS_Package extends PEAR!
        $this->PEAR();
        
        $this->_bundle_tgz = $dir_dest.$bundle_tgz;
        
        return $this->_bundle_tgz;
    }
    
    function extractBundle($file, $dest, $backup_dest = NULL)
    {
        $parts = pathinfo($file);
        if($parts["extension"] == 'tgz' || $parts["extension"]=='gz') {
            $tmp_src = $dest.'.tmp'.DIRECTORY_SEPARATOR;
            
            System::mkdir(array('-p',$tmp_src));
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', 'Extracting '.$file.' to '.$tmp_src, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            $tar = new Archive_Tar($file);
            //$tar->setErrorHandling(PEAR_ERROR_PRINT);
            if (!$tar->extract($tmp_src)) {
                return PEAR::raiseError("unable to unpack $file");
                if(ZZOSS_PACKAGE_DEBUG){
                    ZZOSS_Debug::log("unable to unpack $file", __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                }
            }
            
            // Try to extract the distribution
            if(!ZZOSS_Package::extractDistribution($tmp_src, $dest)){
                // get the bundle name without extensions by cutting
                // off the extension which could be .tar.gz
                $bundle = str_replace(array('.'.$parts['extension'],'.tar'), '', $parts['basename']);
                if(!ZZOSS_Package::extractDistribution($tmp_src.$bundle.DIRECTORY_SEPARATOR, $dest)){
                    PEAR::raiseError('Cannot extract distribution from bundle "'.$bundle.'".');
                    return false;
                }
            }
            
            if(!is_null($backup_dest)){
                if(!is_dir($backup_dest)){
                    System::mkdir(array('-p', $backup_dest));
                }
                copy($file, $backup_dest.basename($file));
            }
            System::rm(array('-rf', $tmp_src));
        }
    }
    
    function getBundleDescr($bundle_tgz, $extract_dir)
    {
        $parts = pathinfo($bundle_tgz);
        if($parts["extension"] == 'tgz' || $parts["extension"]=='gz') {
            
            $extract_dir = $extract_dir.DIRECTORY_SEPARATOR;
            if(!is_dir($extract_dir)){
                return PEAR::raiseError("Is not a directory: '$extract_dir'.");
            }
            
            System::mkdir(array('-p',$extract_dir));
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', 'Extracting '.$bundle_tgz.' to '.$extract_dir, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            $tar = new Archive_Tar($bundle_tgz);
            $tar->setErrorHandling(PEAR_ERROR_PRINT);
            if (!$tar->extract($extract_dir)) {
                return PEAR::raiseError("unable to unpack $bundle_tgz");
            }
            
            // Get distribution and application XML data.
            $app_xml = $extract_dir.'application.xml';
            $config = new ZZOSS_Config;
            $config->setFile($app_xml);
            $descriptions['application'] = $config->query('/application');
            
            $distri_xml = $extract_dir.'distribution.xml';
            $config = new ZZOSS_Config;
            $config->setFile($distri_xml);
            $descriptions['distribution'] = $config->query('/distribution');
            
            return $descriptions;
        }
        
        return false;
    }
    
    function extractDistribution($src, $dest)
    {
        $distribution_xml_src = $src.'distribution.xml';
        
        if(!file_exists($distribution_xml_src)){
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', 'Does not exist: '.$distribution_xml_src, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            PEAR::raiseError('Distribution XML is not included');
            return false;
        }
        
        if(ZZOSS_PACKAGE_DEBUG){
            ZZOSS_Debug::log('ZZOSS_Package', 'Yes, '.$distribution_xml_src.' exists.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
        }
        
        // register new distribution
        $distribution_config = new ZZOSS_Config(array('numeric' => array('maintainer')));
        $distribution_config->setFile($distribution_xml_src);
        //var_dump($distribution_config);
        $distribution = $distribution_config->query('/distribution');
        $distribution_dir = $dest.'distributions'.DIRECTORY_SEPARATOR.$distribution['name'].'-'.$distribution['release']['version'].DIRECTORY_SEPARATOR;
        System::mkdir(array('-p',$distribution_dir));
        System::mkdir(array('-p',$distribution_dir.'installer'));
        System::mkdir(array('-p',$distribution_dir.'downloads'));
        System::mkdir(array('-p',$distribution_dir.'applications'));
        System::mkdir(array('-p',$distribution_dir.'cache')); 
        copy($distribution_xml_src, $distribution_dir.'distribution.xml');
        // finally set "rebuild distributions" flag
        $fp = fopen($dest."installer".DIRECTORY_SEPARATOR."distributions.lock","w");
        fputs($fp,'dummy');
        fclose($fp);
        
         // Try to extract the application
         if(!ZZOSS_Package::extractApplication($src, $distribution_dir)){
             PEAR::raiseError('Cannot extract Application from "'.$src.'".');
             return false;
        }
        
        return true;
    }
    
    function extractApplication($src, $dest)
    {
        $application_xml_src = $src.'application.xml';
        $packages_xml_src = $src.'packages.xml';
        
        if(!(file_exists($application_xml_src)/* && file_exists($packages_xml_src)*/)) {
            if(ZZOSS_PACKAGE_DEBUG){
                ZZOSS_Debug::log('ZZOSS_Package', '"'.$application_xml_src.'"* does not exist.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
            }
            return false;
        }
        
        if(ZZOSS_PACKAGE_DEBUG){
            ZZOSS_Debug::log('ZZOSS_Package', 'Yes, '.$application_xml_src.' and '.$packages_xml_src.' do exist.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
        }
        // register new application
        $application_config = new ZZOSS_Config();
        $application_config->setFile($application_xml_src);
        $application = $application_config->query('/application');
        $application_dir = $dest.'applications'.DIRECTORY_SEPARATOR.$application["name"].'-'.$application["release"]["version"].DIRECTORY_SEPARATOR;
        ZZOSS_InstallerRegistry::mkDirsApplication($application_dir);
        @copy($application_xml_src, $application_dir.'application.xml');
        
        if(file_exists($packages_xml_src)){
            copy($packages_xml_src, $application_dir.'installer'.DIRECTORY_SEPARATOR.'remote_packages.xml');
        }
        
        // try to copy tgz files
        if($dp = @opendir($src)) {
            while (false !== ($file2 = readdir($dp))) { 
                $parts = pathinfo($file2);
                if($parts["extension"] == 'tgz' || $parts["extension"]=='gz') {
                    $package_src = $src.$file2;
                    $package_dest = $application_dir.'downloads'.DIRECTORY_SEPARATOR.$file2;
                    if(ZZOSS_PACKAGE_DEBUG){
                        ZZOSS_Debug::log('ZZOSS_Package', 'Copying '.$package_src.' to '.$package_dest, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                    }
                    copy($package_src, $package_dest);
                }
            }
            closedir($dp);
        }
        
        // finally set "rebuild application" flag
        $fp = fopen($dest."installer".DIRECTORY_SEPARATOR."applications.lock","w");
        fputs($fp,'dummy');
        fclose($fp);
        
        return true;
    }
    
    function extractPatches($src, $dest)
    {
        $tar = new Archive_Tar($src);
        if (!$tar->extract($dest)) {
            return PEAR::raiseError("unable to unpack $src");
        }
        @unlink($src);
        return true;
    }
    
    function extractPackages($src, $dest, $pkgs_allowed = array())
    {
        if(ZZOSS_PACKAGE_DEBUG){
            ZZOSS_Debug::log('ZZOSS_Package', 'Scanning for packages '.$src, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
        }
        // check source dir and extract all tgz's to modules
        if($dp = @opendir($src)) {
            while (false !== ($file = readdir($dp))) { 
                $parts = pathinfo($file);
                if($parts["extension"] == 'tgz' || $parts["extension"] == 'gz') {
                    $pkg_name = str_replace('.'.$parts['extension'], '', $parts['basename']);
                    $pkgsrc = $src.$file;
                    $pkg_dest_dir = $dest.$pkg_name.DIRECTORY_SEPARATOR;
                    
                    // did we specify the packages we allow to be extracted
                    if(count($pkgs_allowed)){
                        if(!isset($pkgs_allowed[$pkg_name])){
                            continue;
                        }
                    }
                    
                    // check if the tgz has changed since we last extracted it
                    if(ZZOSS_PACKAGE_DEBUG){
                        ZZOSS_Debug::log('ZZOSS_Package', 'Check if \''.$pkg_dest_dir.'\' is older then \''.$pkgsrc.'\'.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                    }
                    if(is_dir($pkg_dest_dir)){
                        if(filemtime($pkgsrc) < ZZOSS_Dir::mtime($pkg_dest_dir.'.')){
                            // the tgz we registered is up-to-date, so continue the loop
                            if(ZZOSS_PACKAGE_DEBUG){
                                ZZOSS_Debug::log('ZZOSS_Package', 'Package \''.$file.'\' is up-to-date.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                            }
                            continue;
                        } else {
                            // remove directory of previously extracted tgz
                            System::rm(array('-rf', $pkg_dest_dir));
                        }
                    }
                    
                    
                    if(ZZOSS_PACKAGE_DEBUG){
                        ZZOSS_Debug::log('ZZOSS_Package', 'Attempting to extract '.$pkgsrc.' to '.$dest, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                    }
                    $tar = new Archive_Tar($pkgsrc);
                    if (!$tar->extract($dest)) {
                        return PEAR::raiseError("unable to unpack $pgksrc");
                        if(ZZOSS_PACKAGE_DEBUG){
                            ZZOSS_Debug::log('ZZOSS_Package', 'Unable to extract '.$pkgsrc.' to '.$dest, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                        }
                    }
                    //@unlink($pkgsrc);
                    $package_xml_src = $dest.'package.xml';
                    if(ZZOSS_PACKAGE_DEBUG){
                        ZZOSS_Debug::log('ZZOSS_Package', 'Detect '.$package_xml_src.' of '.$pkgsrc, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                    }
                    if(file_exists($package_xml_src)) {
                        if(ZZOSS_PACKAGE_DEBUG){
                            ZZOSS_Debug::log('ZZOSS_Package', 'Read '.$package_xml_src.' of '.$pkgsrc, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                        }
                        $package_config = new ZZOSS_Config(array('numeric' => array('dep','file', 'build', 'maintainer')));
                        $package_config->setFile($package_xml_src);
                        $package = $package_config->query('/package');  
                        $package_xml_dest = $dest.$package["name"].'-'.$package["release"]["version"].DIRECTORY_SEPARATOR.'package.xml';
                        // create the pckage directory if it does not exist yet
                        if(!is_dir($package_xml_src)){
                            System::mkdir(array('-p', dirname($package_xml_src)));
                        }
                        copy($package_xml_src, $package_xml_dest);
                        if(ZZOSS_PACKAGE_DEBUG){
                            ZZOSS_Debug::log('ZZOSS_Package', 'Copied '.$package_xml_src.' to '.$package_xml_dest, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                        }
                        unlink($package_xml_src);
                    }
                }
            }
            closedir($dp);
        }
    }
    
    function packageSources($bundle_dir, $packages, $app_settings)
    {
        $has_pkg_source = false;
        $log = array();
        if(!is_dir($bundle_dir)){
            System::mkdir(array('-p', $bundle_dir));
        }
        
        // take care of *nix and Win directory separators
        if(DIRECTORY_SEPARATOR == '/'){
            $wrong_dir_separator = '\\';
        } else {
            $wrong_dir_separator = '/';
        }
        foreach($packages as $pos => $package){
            
            $package_unique = $package['@']['name'].'-'.$package['@']['version'];
            $log[$package_unique] = '';
            
            for($i = 1; $i <= 5; $i++){
                if(isset($app_settings['source_'.$i]) && strlen($app_settings['source_'.$i])){
                    if(isset($packages[$pos])){
                        
                        $has_pkg_source = true;
                        
                        $log[$package_unique] .= '* Scanning '.$app_settings['source_'.$i]."\n";
                        $package_src = ZZOSS_InstallerUtils::fixPath($app_settings['source_'.$i].DIRECTORY_SEPARATOR.$package['@']['name'].DIRECTORY_SEPARATOR);
                        $package_dest = $bundle_dir;
                        $package_tgz = $package_unique.'.tgz';
                        $package_xml = $package_src.'package.xml';
                        
                        if(!file_exists($package_xml)){
                            $package_tgz_path = ZZOSS_InstallerUtils::fixPath($app_settings['source_'.$i].DIRECTORY_SEPARATOR.$package_tgz);
                            // Maybe, a .tgz is already there...
                            if(file_exists($package_tgz_path)){
                                $log[$package_unique] .= '  Found '.$package_tgz.'.'."\n";
                                // check if the tgz has changed since we last registered it
                                if( file_exists($package_dest.$package_tgz) &&
                                    filemtime($package_tgz_path) < filemtime($package_dest.$package_tgz)){
                                    // the tgz we registered is up-to-date, so continue the loop
                                    $log[$package_unique] .= '  Registered package is up-to-date.'."\n";
                                    // remove this package from stack
                                    unset($packages[$pos]);
                                    continue;
                                }
                                copy($package_tgz_path, $package_dest.$package_tgz);
                                // remove this package from stack
                                unset($packages[$pos]);
                                //$log[$package_unique] .= '  Moved '.$package_tgz.' to '.$bundle_dir.' directory.'."\n";
                            } else {
                                $log[$package_unique] .= '  Nothing found'."\n";
                            }
                        } else {
                            $log[$package_unique] .= '  Found package.xml'."\n";
                            
                            // check if the tgz has changed since we last registered it
                            if( file_exists($package_dest.$package_tgz) &&
                                ZZOSS_Dir::mtime($package_src.'.') < filemtime($package_dest.$package_tgz)){
                                // the tgz we registered is up-to-date, so continue the loop
                                $log[$package_unique] .= '  Registered package is up-to-date.'."\n";
                                // remove this package from stack
                                unset($packages[$pos]);
                                continue;
                            }
                            
                            // Get package.xml and parse it to fill placeholder with content.
                            
                            $replace_values['{zi_release_date}'] = date('Y-m-d');
                            $replace_values['{zi_copyright_year}'] = date('Y');
                            
                            include_once 'ZZOSS_File/Replace.php';
                            $replace = new ZZOSS_FileReplace;
                            $replace->file($package_xml);
                            $replace->replace($replace_values);
                            
                            // Create a temporary package.xml
                            
                            // Create the temporary directory where we place it.
                            // But only if the directory does not already exist.
                            if(!isset($pkg_tmpdir) || !strlen($pkg_tmpdir)){
                                if (!($pkg_tmpdir = System::mktemp('-d'))) {
                                    return PEAR::raiseError("Cannot create temporary directory.");
                                }
                            }
                            
                            $package_xml_new = $pkg_tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
                            $replace->writeout($package_xml_new);
                            
                            // Get package.xml parameters.
                            include_once 'ZZOSS_Config/Config.php';
                            $config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('file')));
                            $config->setFile($package_xml_new);
                            $xml = $config->query('/package');
                            
                            if($package_unique == $xml['name'].'-'.$xml['release']['version']){
                                $tar_list = array();
                                
                                // Iterate files.
                                if(
                                    !isset($xml['release']['filelist']['file']) ||
                                    !is_array($xml['release']['filelist']['file'])
                                    ){
                                    $files = array();
                                } else {
                                    $files = $xml['release']['filelist']['file'];
                                }
                                if(count($files)){
                                    foreach($files as $file){
                                        $tar_list[] = str_replace($wrong_dir_separator,DIRECTORY_SEPARATOR,$file['@']['name']);
                                    }
                                }
                                
                                $plugin_files = array();
                                // Process plugin files.
                                if(
                                    isset($xml['release']['plugin']['filelist']['file']) &&
                                    is_array($xml['release']['plugin']['filelist']['file'])){
                                    $plugin_files = $xml['release']['plugin']['filelist']['file'];
                                }
                                if(
                                    isset($xml['release']['plugin']['file']) &&
                                    is_array($xml['release']['plugin']['file'])){
                                    $plugin_files = $xml['release']['plugin']['file'];
                                }
                                
                                if(count($plugin_files)){
                                    // We remember if a plugin file has been defined
                                    // various times, because we need to process it only once.
                                    $plugin_files_processed = array();
                                    foreach($plugin_files as $plugin_file){
                                        if(!in_array($plugin_file['@']['name'], $plugin_files_processed)){
                                            array_push($plugin_files_processed, $plugin_file['@']['name']);
                                            $tar_list[] = $plugin_file['@']['name'];
                                        }
                                    }
                                }
                                
                                $cwd = getcwd();
                                chdir($package_src);
                                $tar = new Archive_Tar($package_dest.$package_tgz);
                                //$tar->setErrorHandling(PEAR_ERROR_PRINT);
                                $tar->createModify($package_xml_new, '', $pkg_tmpdir);
                                //$tar->create('package.xml');
                                $tar->addModify($tar_list, $package_unique);
                                $log[$package_unique] .= '  Created package '.$package_tgz.'.'."\n";
                                chdir($cwd);
                                
                                // delete the temporary package.xml
                                unlink($package_xml_new);
                                
                                //copy($package_tgz, $package_dest.$package_tgz);
                                //@unlink($package_tgz);
                                //chdir($cwd);
                                
                                //$log[$package_unique] .= '  Moved '.$package_tgz.' to '.$bundle_dir.' directory.'."\n";
                                
                                // remove this package from stack
                                unset($packages[$pos]);
                            }
                        }
                    }
                }
            }
        }
        
        if(!$has_pkg_source){
            return false;
        }
        
        $this->pkgs_unprocessed = $packages;
        
        // If a temporary directory has been created for temporary package.xml files,
        // then remove it now.
        
        // is handled by a shutdown function of PEAR::System
        /*if(isset($pkg_tmpdir) && is_dir($pkg_tmpdir)){
            echo "<p>$pkg_tmpdir</p>";
            //System::rm(array('-rf', $pkg_tmpdir));
        }*/
        
        // General info
        $this->log = 'Destination: '.$bundle_dir."\n\n";
        
        // compose log
        foreach($log as $package => $info){
            $this->log .= '['.$package.']'."\n";
            $this->log .= $info;
            $this->log .= "\n";
        }
        
        return true;
    }
    
    function getLog()
    {
        return $this->log;
    }
    
    function hasUnprocessedPkgs()
    {
        return @count($this->pkgs_unprocessed);
    }
    
    function getUnprocessedPkgs()
    {
        return $this->pkgs_unprocessed;
    }
}
?>
Return current item: ZZ/OSS Installer