[zi-cvs] packages/com.zzoss.installer.lib ConfigInput.php,1.1,1.2 Registry.php,1.12,1.13 Widget.php,1.3,1.4

[email protected] Fri, 05 Mar 2004 06:25:56 -0800
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.installer.lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8129/com.zzoss.installer.lib

Modified Files:
	ConfigInput.php Registry.php Widget.php 
Log Message:
new plugin architecture in installer

Index: ConfigInput.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.installer.lib/ConfigInput.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConfigInput.php	22 Dec 2003 17:14:04 -0000	1.1
--- ConfigInput.php	5 Mar 2004 14:25:23 -0000	1.2
***************
*** 48,52 ****
  	}
  	
! 	function startHandler($xp, $element, $attribs)
  	{
  		//echo $element;
--- 48,52 ----
  	}
  	
! 	function startHandler($xp, $element, $attribs = array())
  	{
  		//echo $element;
***************
*** 61,70 ****
  			}
  			// initialise widget
! 			$options = array(
! 								'validation'	=> $attribs['validation'],
! 								'help'			=> $attribs['help'],
!                                 'info'			=> $attribs['info'],
! 								'list'			=> $attribs['list']
! 							);
  
  			echo $this->widget->add(
--- 61,65 ----
  			}
  			// initialise widget
! 			$options = $attribs;
  
  			echo $this->widget->add(

Index: Registry.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.installer.lib/Registry.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Registry.php	12 Feb 2004 10:36:40 -0000	1.12
--- Registry.php	5 Mar 2004 14:25:23 -0000	1.13
***************
*** 51,54 ****
--- 51,62 ----
      var $no_application         = true;
      var $application_path;
+     var $packages_specified     = array();
+     var $package_type           = 'package';
+     var $log                    = '';
+     
+     /**
+     * Those packages that have been specified in the application XML.
+     */
+     var $packages_specified = array();
      
      function ZZOSS_InstallerRegistry($dir = NULL)
***************
*** 86,89 ****
--- 94,104 ----
      }
      
+     function getLog()
+     {
+         $log = $this->log;
+         $this->log = '';
+         return $log;
+     }
+     
      function setDistribution($distribution)
      {
***************
*** 342,346 ****
          }
          $application = $this->getApplicationById($id);
! 		$config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('package')));
  		$config->setFile($application['install']['path'].'application.xml');
  		ZZOSS_InstallerUtils::serializeToFile(
--- 357,361 ----
          }
          $application = $this->getApplicationById($id);
! 		$config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('package', 'plugin')));
  		$config->setFile($application['install']['path'].'application.xml');
  		ZZOSS_InstallerUtils::serializeToFile(
***************
*** 427,431 ****
                  ZZOSS_Debug::log('ZZOSS_Registry', 'Returning '.var_export($applications[$this->application], true), __FILE__, __LINE__, __FUNCTION__, __CLASS__);
              }
!             return  $applications[$this->application];
          //}
          return false;
--- 442,448 ----
                  ZZOSS_Debug::log('ZZOSS_Registry', 'Returning '.var_export($applications[$this->application], true), __FILE__, __LINE__, __FUNCTION__, __CLASS__);
              }
!             if(isset($applications[$this->application])){
!                 return  $applications[$this->application];
!             }
          //}
          return false;
***************
*** 520,523 ****
--- 537,551 ----
      }
      
+     function mkDirsApplication($app_path)
+     {
+         System::mkdir(array('-p',$app_path));
+         System::mkdir(array('-p',$app_path.'installer'));
+         System::mkdir(array('-p',$app_path.'downloads'));
+         System::mkdir(array('-p',$app_path.'packages'));
+         System::mkdir(array('-p',$app_path.'packages_installed'));
+         System::mkdir(array('-p',$app_path.'cache'));
+         System::mkdir(array('-p',$app_path.'plugins'));
+     }
+     
      function getApplicationById($id, $distribution = NULL)
      {
***************
*** 897,901 ****
  	}
      
!     function registerPackages($application = NULL, $distribution = NULL)
      {
          if(!is_null($distribution)){
--- 925,934 ----
  	}
      
!     function setPackageType($type)
!     {
!         $this->package_type = $type;
!     }
!     
!     function registerPackages($src = 'downloads', $application = NULL, $distribution = NULL)
      {
          if(!is_null($distribution)){
***************
*** 906,909 ****
--- 939,954 ----
          }
          
+         $src_pkgs = $this->application_path.$src.DIRECTORY_SEPARATOR;
+         
+         // Refresh package registry only if something changed in source since
+         // we last registerd the packages
+         if($this->isRegPackages()){
+             if(!
+                 (filemtime($src_pkgs.'.') > $this->getPackagesMtime())
+                 ){
+                 return true;
+             }
+         }
+         
          if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
              ZZOSS_Debug::log('ZZOSS_Registry', 'Start registering packages.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
***************
*** 915,921 ****
              }
              // extract patches to download folder
!             $src = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'patches.tgz';
!             $dest = $this->application_path.'downloads'.DIRECTORY_SEPARATOR;
!             ZZOSS_Package::extractPatches($src, $dest);
          }
          
--- 960,966 ----
              }
              // extract patches to download folder
!             $src_patches = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'patches.tgz';
!             $dest_patches = $this->application_path.'downloads'.DIRECTORY_SEPARATOR;
!             ZZOSS_Package::extractPatches($src_patches, $dest_patches);
          }
          
***************
*** 923,927 ****
              ZZOSS_Debug::log('ZZOSS_Registry', 'Extracting packages.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
          }
!         ZZOSS_Package::extractPackages($this->application_path.'downloads'.DIRECTORY_SEPARATOR,$this->application_path.'packages'.DIRECTORY_SEPARATOR);
          
          $this->refreshPackages();
--- 968,975 ----
              ZZOSS_Debug::log('ZZOSS_Registry', 'Extracting packages.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
          }
!         
!         $dest_pkgs = $this->application_path.$this->package_type.'s'.DIRECTORY_SEPARATOR;
!         
!         ZZOSS_Package::extractPackages($src_pkgs, $dest_pkgs, $this->getApplicationPackages());
          
          $this->refreshPackages();
***************
*** 989,993 ****
              $this->setApplication($application);
          }
!         return file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages.reg');
      }
      
--- 1037,1042 ----
              $this->setApplication($application);
          }
!         $packages_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_packages.reg';
!         return file_exists($packages_reg);
      }
      
***************
*** 1000,1004 ****
              $this->setApplication($application);
          }
!         return file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_resolve.reg');
      }
      
--- 1049,1053 ----
              $this->setApplication($application);
          }
!         return file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_resolve.reg');
      }
      
***************
*** 1011,1015 ****
              $this->setApplication($application);
          }
!         return file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages.lock');
      }
      
--- 1060,1064 ----
              $this->setApplication($application);
          }
!         return file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s.lock');
      }
      
***************
*** 1024,1032 ****
          $application = $this->getApplicationById($id);
          // set package rebuild flag
!         $fp = fopen($application["install"]["path"]."installer".DIRECTORY_SEPARATOR."packages.lock","w");
          fputs($fp,'dummy');
          fclose($fp);
      }
      
      function getPackages($application = NULL, $distribution = NULL)
      {
--- 1073,1098 ----
          $application = $this->getApplicationById($id);
          // set package rebuild flag
!         $fp = fopen($application["install"]["path"]."installer".DIRECTORY_SEPARATOR.$this->package_type."s.lock","w");
          fputs($fp,'dummy');
          fclose($fp);
      }
      
+     function getPackagesMtime($application = NULL, $distribution = NULL)
+     {
+         if(!is_null($distribution)){
+             $this->setDistribution($distribution);
+         }
+         if(!is_null($application)){
+             $this->setApplication($application);
+         }
+         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_packages.reg';
+         
+         if(!file_exists($file)){
+             return false;
+         }
+         
+         return filemtime($file);
+     }
+     
      function getPackages($application = NULL, $distribution = NULL)
      {
***************
*** 1037,1041 ****
              $this->setApplication($application);
          }
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages.reg';
          return ZZOSS_InstallerUtils::unserializeFromFile($file);
      }
--- 1103,1107 ----
              $this->setApplication($application);
          }
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_packages.reg';
          return ZZOSS_InstallerUtils::unserializeFromFile($file);
      }
***************
*** 1049,1053 ****
              $this->setApplication($application);
          }
!         return $this->packages_resolve = ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_resolve.reg');
      }
      
--- 1115,1120 ----
              $this->setApplication($application);
          }
!         $file_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_resolve.reg';
!         return ZZOSS_InstallerUtils::unserializeFromFile($file_reg);
      }
      
***************
*** 1060,1064 ****
              $this->setApplication($application);
          }
!         $versions = ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_versions.reg');
          return $versions[$package];
      }
--- 1127,1131 ----
              $this->setApplication($application);
          }
!         $versions = ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_versions.reg');
          return $versions[$package];
      }
***************
*** 1072,1081 ****
              $this->setApplication($application);
          }
!         return ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_versions.reg');
      }
      
      function unlockPackages()
      {
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages.lock';
          if(file_exists($file)){
              @unlink($file);
--- 1139,1148 ----
              $this->setApplication($application);
          }
!         return ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_versions.reg');
      }
      
      function unlockPackages()
      {
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s.lock';
          if(file_exists($file)){
              @unlink($file);
***************
*** 1083,1086 ****
--- 1150,1205 ----
      }
      
+     function installPackage($name)
+     {
+         $pkg_src = $this->application_path.$this->package_type.'s'.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR;
+         $pkg_installed = $this->application_path.$this->package_type.'s_installed'.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR;
+ 
+         if(!is_dir($pkg_src)){
+             return PEAR::raiseError('Internal Error: Unknow '.$this->package_type.' source path. Seems like the '.$this->package_type.' registry has not been refreshed properly.');
+         }
+         // Post-processing
+         System::mkDir(array('-p', $pkg_installed));
+         $this->log .= '* Created directory '.$pkg_installed."\n";
+         copy(
+             $pkg_src.'package.xml', 
+             $pkg_installed.'package.xml'
+             );
+         $this->log .= '* Copied '.$pkg_src.'package.xml to '.$pkg_installed.'package.xml'."\n";
+         // remove the extracted package
+         // TODO: Do we really have to remove this dir?
+         //System::rm(array('-rf',$pkg_src));
+         //$this->log .= '* Removed extracted '.$this->package_type.' ('.$pkg_src.')'."\n";
+     }
+     
+     function removePackage($name, $keep_src = true)
+     {
+         $pkg_src = $this->application_path.$this->package_type.'s'.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR;
+         $pkg_installed = $this->application_path.$this->package_type.'s_installed'.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR;
+         
+         if(is_dir($pkg_installed)){
+             System::rm(array('-rf',$pkg_installed));
+             $this->log .= '* Removed installed '.$this->package_type.' "'.$name.'" registry directory ('.$pkg_installed.')'."\n";
+         } else {
+             $this->log .= '* '.$this->package_type.' "'.$name.'" is not installed'."\n";
+         }
+         // We remove the src and archive as well if the package has not been specified in application XML
+         if(!$keep_src){
+             if(is_dir($pkg_src)){
+                 System::rm(array('-rf',$pkg_src));
+                 $this->log .= '* Removed '.$this->package_type.' "'.$name.'" src directory ('.$pkg_src.')'."\n";
+             }
+             $pkg_archive = $this->application_path.'downloads'.DIRECTORY_SEPARATOR.$name.'.tgz';
+             if(file_exists($pkg_archive)){
+                 $this->log .= '* Removed '.$this->package_type.' "'.$name.'" archive ('.$pkg_archive.')'."\n";
+                 unlink($pkg_archive);
+             }
+         }
+     }
+     
+     function setPackagesSpecified($specified)
+     {
+         $this->packages_specified = $specified;
+     }
+     
      // following function refreshes packages array and
      // updates serialized disk dump
***************
*** 1107,1120 ****
          }
          
-         $packages_application = array();
-         
-         $application_data = $this->getApplication();
-         
-         if(is_array($application_data["release"]["packages"]["package"])) {
-             foreach($application_data["release"]["packages"]["package"] as $key => $val) {
-                 $packages_application[$val["@"]["name"].'-'.$val["@"]["version"]] = $val;
-             }
-         }
-         
          $packages = array();
          $packages_resolve = array();
--- 1226,1229 ----
***************
*** 1122,1126 ****
          $count = 0;
          $package_sources = array();
!         $package_sources[] = $this->application_path.'packages'.DIRECTORY_SEPARATOR;
          
          foreach($package_sources as $sourcedir) {
--- 1231,1235 ----
          $count = 0;
          $package_sources = array();
!         $package_sources[] = $this->application_path.$this->package_type.'s'.DIRECTORY_SEPARATOR;
          
          foreach($package_sources as $sourcedir) {
***************
*** 1130,1144 ****
                      if($entry != '.' && $entry != '..'){
                          $dir = $sourcedir.$entry.DIRECTORY_SEPARATOR;
!                         $file = $dir.'package.xml';
                          
                          if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
                              ZZOSS_Debug::log('ZZOSS_Registry', '$entry = '.$entry, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                              ZZOSS_Debug::log('ZZOSS_Registry', '$dir = '.$dir, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
!                             ZZOSS_Debug::log('ZZOSS_Registry', '$file = '.$file, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                          }
!                         if(file_exists($file)) {
                              unset($package_config);
                              $package_config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('dep','file', 'build', 'maintainer')));
!                             $package_config->setFile($file); 
                              $package_config->setCacheDir($this->application_path.'cache'.DIRECTORY_SEPARATOR);
                              $package_config->writeCacheUnique();
--- 1239,1253 ----
                      if($entry != '.' && $entry != '..'){
                          $dir = $sourcedir.$entry.DIRECTORY_SEPARATOR;
!                         $package_xml = $dir.'package.xml';
                          
                          if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
                              ZZOSS_Debug::log('ZZOSS_Registry', '$entry = '.$entry, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                              ZZOSS_Debug::log('ZZOSS_Registry', '$dir = '.$dir, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
!                             ZZOSS_Debug::log('ZZOSS_Registry', '$file = '.$package_xml, __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                          }
!                         if(file_exists($package_xml)) {
                              unset($package_config);
                              $package_config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('dep','file', 'build', 'maintainer')));
!                             $package_config->setFile($package_xml); 
                              $package_config->setCacheDir($this->application_path.'cache'.DIRECTORY_SEPARATOR);
                              $package_config->writeCacheUnique();
***************
*** 1149,1153 ****
                              $xml["id"] = $count;
                              $key = $xml["name"].'-'.$xml['release']['version'];
!                             if(isset($packages_application[$key]['@']['use']) && $packages_application[$key]['@']['use'] == 'required') {
                                  $xml["install"]["required"] = true;
                              } else {
--- 1258,1262 ----
                              $xml["id"] = $count;
                              $key = $xml["name"].'-'.$xml['release']['version'];
!                             if(isset($this->packages_specified[$key]['@']['use']) && $this->packages_specified[$key]['@']['use'] == 'required') {
                                  $xml["install"]["required"] = true;
                              } else {
***************
*** 1155,1180 ****
                              }
                              // only show packages defined in application.xml
!                             if(isset($packages_application[$key])){
!                                 // already got this module ?
!                                 /*if(isset($packages[$key])) {
!                                     // only overwrite when module is newer
!                                     if(ZZOSS_Package::compareRelease($packages[$key]["release"]["version"], $xml["release"]["version"])) {
!                                         if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
!                                             ZZOSS_Debug::log('ZZOSS_Registry', 'Overwriting existing local package "'.$key.'" with newer one.', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
!                                         }
!                                         $packages[$key] = $xml;
!                                         $packages_resolve[$count] = $key;
!                                         $count++;
!                                     }
!                                 } else {*/
!                                 if(!isset($packages[$key])) {
!                                     if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
!                                         ZZOSS_Debug::log('ZZOSS_Registry', 'Register local package "'.$key.'"', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
!                                     }
!                                     $packages[$key] = $xml;
!                                     $packages_resolve[$count] = $key;
!                                     $packages_versions[$xml['name']][$xml['release']['version']] = array('installed' => false);
!                                     $count++;
                                  }
                              }
                          }
--- 1264,1281 ----
                              }
                              // only show packages defined in application.xml
!                             if(!isset($this->packages_specified[$key])){
!                                 $xml['_specified'] = false;
!                             } else {
!                                 $xml['_specified'] = true;
!                             }
!                             // already got this module ?
!                             if(!isset($packages[$key])) {
!                                 if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
!                                     ZZOSS_Debug::log('ZZOSS_Registry', 'Register local package "'.$key.'"', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
                                  }
+                                 $packages[$key] = $xml;
+                                 $packages_resolve[$count] = $key;
+                                 $packages_versions[$xml['name']][$xml['release']['version']] = array('installed' => false);
+                                 $count++;
                              }
                          }
***************
*** 1197,1204 ****
                      $key = $remote_package["name"].'-'.$remote_package['release']['version'];
                      // only show packages defined in application.xml
!                     if(isset($packages_application[$key])){
                          $remote_package["id"] = $count;
                          $remote_package["install"]["type"] = 'remote';
!                         if(isset($packages_application[$key]['@']['use']) && $packages_application[$key]['@']['use'] == 'required') {
                              $remote_package["install"]["required"] = true;
                          } else {
--- 1298,1305 ----
                      $key = $remote_package["name"].'-'.$remote_package['release']['version'];
                      // only show packages defined in application.xml
!                     if(isset($this->packages_specified[$key])){
                          $remote_package["id"] = $count;
                          $remote_package["install"]["type"] = 'remote';
!                         if(isset($this->packages_specified[$key]['@']['use']) && $this->packages_specified[$key]['@']['use'] == 'required') {
                              $remote_package["install"]["required"] = true;
                          } else {
***************
*** 1231,1238 ****
  
          // now check which of the modules are already installed
!         if($dp = @opendir($this->application_path.'packages_installed')) {
              while (false !== ($entry = readdir($dp))) {
                  if($entry != '.' && $entry != '..'){
!                     $dir = $this->application_path.'packages_installed'.DIRECTORY_SEPARATOR.$entry.DIRECTORY_SEPARATOR;
                      $file = $dir.'package.xml';
                      if(file_exists($file)) {
--- 1332,1342 ----
  
          // now check which of the modules are already installed
!         if(
!             is_dir($this->application_path.$this->package_type.'s_installed') &&
!             $dp = @opendir($this->application_path.$this->package_type.'s_installed')
!             ) {
              while (false !== ($entry = readdir($dp))) {
                  if($entry != '.' && $entry != '..'){
!                     $dir = $this->application_path.$this->package_type.'s_installed'.DIRECTORY_SEPARATOR.$entry.DIRECTORY_SEPARATOR;
                      $file = $dir.'package.xml';
                      if(file_exists($file)) {
***************
*** 1266,1269 ****
--- 1370,1377 ----
              $this->setPackagesResolve($packages_resolve);
              $this->setPackagesVersions($packages_versions);
+         } else {
+             $this->unsetPackages();
+             $this->unsetPackagesResolve();
+             $this->unsetPackagesVersions();
          }
          
***************
*** 1274,1290 ****
      function setPackages($packages)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages.reg', $packages );
      }
      
      function setPackagesResolve($packages_resolve)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_resolve.reg', $packages_resolve );
      }
      
      function setPackagesVersions($packages)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.'packages_versions.reg', $packages );
      }
      
      function setPackagesActions($packages, $application = NULL, $distribution = NULL)
      {
--- 1382,1422 ----
      function setPackages($packages)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_packages.reg', $packages );
      }
      
+     function unsetPackages()
+     {
+         $packages_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_packages.reg';
+         if(file_exists($packages_reg)){
+             unlink($packages_reg);
+         }
+     }
+ 
      function setPackagesResolve($packages_resolve)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_resolve.reg', $packages_resolve );
      }
      
+     function unsetPackagesResolve()
+     {
+         $packages_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_resolve.reg';
+         if(file_exists($packages_reg)){
+             unlink($packages_reg);
+         }
+     }
+ 
      function setPackagesVersions($packages)
      {
!         ZZOSS_InstallerUtils::serializeToFile( $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_versions.reg', $packages );
      }
      
+     function unsetPackagesVersions()
+     {
+         $packages_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_versions.reg';
+         if(file_exists($packages_reg)){
+             unlink($packages_reg);
+         }
+     }
+ 
      function setPackagesActions($packages, $application = NULL, $distribution = NULL)
      {
***************
*** 1296,1300 ****
          }
          
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages.reg';
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
      }
--- 1428,1432 ----
          }
          
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_actions.reg';
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
      }
***************
*** 1321,1325 ****
          echo '</pre>';
          */
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages.reg';
          @unlink($file);
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
--- 1453,1457 ----
          echo '</pre>';
          */
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_actions.reg';
          @unlink($file);
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
***************
*** 1335,1339 ****
          }
  	  	// load package selection
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
--- 1467,1471 ----
          }
  	  	// load package selection
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_actions.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
***************
*** 1348,1352 ****
          }
          
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_deps.reg';
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
      }
--- 1480,1484 ----
          }
          
!         $file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_deps.reg';
  	    ZZOSS_InstallerUtils::serializeToFile( $file, $packages );
      }
***************
*** 1361,1365 ****
          }
  	  	// load package selection
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_deps.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
--- 1493,1497 ----
          }
  	  	// load package selection
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_deps.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
***************
*** 1402,1406 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_queue.reg';
          if(file_exists($file)){
              return @unlink($file);
--- 1534,1538 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_queue.reg';
          if(file_exists($file)){
              return @unlink($file);
***************
*** 1413,1417 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_queue.reg';
          $queue_old = ZZOSS_InstallerUtils::unserializeFromFile($file);
          if(is_array($queue_old) && count($queue_old)){
--- 1545,1549 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_queue.reg';
          $queue_old = ZZOSS_InstallerUtils::unserializeFromFile($file);
          if(is_array($queue_old) && count($queue_old)){
***************
*** 1427,1431 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_queue.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
--- 1559,1563 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_queue.reg';
  		return ZZOSS_InstallerUtils::unserializeFromFile( $file );
  	}
***************
*** 1434,1438 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_remote.reg';
          if(file_exists($file)){
              return @unlink($file);
--- 1566,1570 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_remote.reg';
          if(file_exists($file)){
              return @unlink($file);
***************
*** 1445,1449 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_remote.reg';
  		ZZOSS_InstallerUtils::serializeToFile( $file, $pkgs );
  	}
--- 1577,1581 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_remote.reg';
  		ZZOSS_InstallerUtils::serializeToFile( $file, $pkgs );
  	}
***************
*** 1452,1456 ****
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'installation_packages_remote.reg';
          return ZZOSS_InstallerUtils::unserializeFromFile($file);
  	}
--- 1584,1588 ----
  	{
  		// save process queue
! 		$file = $this->application_path.'installer'.DIRECTORY_SEPARATOR.$this->package_type.'s_remote.reg';
          return ZZOSS_InstallerUtils::unserializeFromFile($file);
  	}
***************
*** 1461,1467 ****
          $packages_application = array();
          $application = $this->getApplication();
!         if(is_array($application["release"]["packages"]["package"])) {
!             foreach($application["release"]["packages"]["package"] as $package) {
!                 $packages_application[$package["@"]["name"]] = $package;
              }
          }
--- 1593,1599 ----
          $packages_application = array();
          $application = $this->getApplication();
!         if(is_array($application["release"][$this->package_type."s"][$this->package_type])) {
!             foreach($application["release"][$this->package_type."s"][$this->package_type] as $package) {
!                 $packages_application[$package["@"]["name"].'-'.$package["@"]["version"]] = $package;
              }
          }
***************
*** 1486,1494 ****
      }
      
!     function setPlugins($installs, $removes = NULL)
      {
-         // get previously registered plugins
-         $plugins_old = ZZOSS_InstallerUtils::unserializeFromFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'plugins.reg');
-         
          // cope with removed plugins
          if(is_array($plugins_old) && count($plugins_old)){
--- 1618,1623 ----
      }
      
!     function composePlugins($installs, $removes = NULL, $plugins_old = NULL)
      {
          // cope with removed plugins
          if(is_array($plugins_old) && count($plugins_old)){
***************
*** 1536,1540 ****
          }
          
!         if(is_array($installs['_undefined'])){
              $undefs = $installs['_undefined'];
              foreach($undefs as $undefs_type => $plugins){
--- 1665,1669 ----
          }
          
!         if(isset($installs['_undefined']) && is_array($installs['_undefined']) && count($installs['_undefined'])){
              $undefs = $installs['_undefined'];
              foreach($undefs as $undefs_type => $plugins){
***************
*** 1568,1578 ****
          }
          
!         if(is_array($installs)){
              $plugins = $installs + $plugins_old;
          }
          
          ZZOSS_InstallerUtils::serializeToFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'plugins.reg', $plugins );
      }
      
      function unlockPlugins()
      {
--- 1697,1722 ----
          }
          
!         if(is_array($installs) && count($installs)){
              $plugins = $installs + $plugins_old;
          }
          
+         return $plugins;
+     }
+     
+     function setPlugins($plugins)
+     {
          ZZOSS_InstallerUtils::serializeToFile($this->application_path.'installer'.DIRECTORY_SEPARATOR.'plugins.reg', $plugins );
      }
      
+     function unsetPlugins()
+     {
+         $plugins_reg = $this->application_path.'installer'.DIRECTORY_SEPARATOR.'plugins.reg';
+         if(file_exists($plugins_reg)){
+             return unlink($plugins_reg);
+         }
+         
+         return false;
+     }
+     
      function unlockPlugins()
      {




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click