[zi-cvs] packages/com.zzoss.installer.lib Registry.php,1.34,1.35

Sandro Zic <[email protected]> Mon, 17 May 2004 09:54:52 +0000
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-serv8039

Modified Files:
	Registry.php 
Log Message:
- sophisticated delete options in development mode: keep installed files and keep application XML descriptor in registry
- make sure that update of app, esp. installer, works also if distribution version has changed

Index: Registry.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.installer.lib/Registry.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** Registry.php	6 May 2004 12:23:58 -0000	1.34
--- Registry.php	17 May 2004 09:54:50 -0000	1.35
***************
*** 173,177 ****
  
          // parse distribution.xml file from all available distributions
!         if($dp = @opendir($this->dir_distributions)) {
              while (false !== ($entry = readdir($dp))) {
                  $dir = $this->dir_distributions.$entry;
--- 173,177 ----
  
          // parse distribution.xml file from all available distributions
!         if(is_dir($this->dir_distributions) && $dp = opendir($this->dir_distributions)) {
              while (false !== ($entry = readdir($dp))) {
                  $dir = $this->dir_distributions.$entry;
***************
*** 268,287 ****
          if(!is_null($distribution)){
              $this->setDistribution($distribution);
          }
! 
          if(!$distributions = $this->getDistributions()){
              return false;
          }
! 
          if(!is_null($distribution) && isset($distributions[$distribution])) {
              //$this->saveDistributionCurrent($distribution);
              return  $distributions[$distribution];
          }
! 
          if($distribution = ZZOSS_InstallerUtils::unserializeFromFile($this->reg_current_distribution)) {
              //$this->saveDistributionCurrent($distribution);
              return $distributions[$distribution];
          }
! 
          if(is_array($distributions)) {
              $first = false;
--- 268,289 ----
          if(!is_null($distribution)){
              $this->setDistribution($distribution);
+         } else if(!is_null($this->distribution)){
+             $distribution = $this->distribution;
          }
!         
          if(!$distributions = $this->getDistributions()){
              return false;
          }
!         
          if(!is_null($distribution) && isset($distributions[$distribution])) {
              //$this->saveDistributionCurrent($distribution);
              return  $distributions[$distribution];
          }
!         /*
          if($distribution = ZZOSS_InstallerUtils::unserializeFromFile($this->reg_current_distribution)) {
              //$this->saveDistributionCurrent($distribution);
              return $distributions[$distribution];
          }
!         */
          if(is_array($distributions)) {
              $first = false;
***************
*** 479,483 ****
          }
          // parse application.xml file from all available applications
!         if($dp = @opendir($this->distribution_path.'applications')) {
              if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
                  ZZOSS_Debug::log('ZZOSS_Registry', 'Scanning directory '.$this->distribution_path.'applications', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
--- 481,485 ----
          }
          // parse application.xml file from all available applications
!         if(is_dir($this->distribution_path.'applications') && $dp = opendir($this->distribution_path.'applications')) {
              if(ZZOSS_INSTALLER_REGISTRY_DEBUG){
                  ZZOSS_Debug::log('ZZOSS_Registry', 'Scanning directory '.$this->distribution_path.'applications', __FILE__, __LINE__, __FUNCTION__, __CLASS__);
***************
*** 948,951 ****
--- 950,1009 ----
          }
      }
+     
+     function resetApp($application = NULL, $distribution = NULL)
+     {
+         if(!is_null($distribution)){
+             $this->setDistribution($distribution);
+         }
+         if(!is_null($application)){
+             $this->setApplication($application);
+         }
+         
+         if(is_dir($this->application_path)){
+             $rm_dirs = array(
+                         'downloads',
+                         'data',
+                         'packages',
+                         'packages_installed',
+                         'plugins',
+                         'plugins_installed',
+                         'plugins_re',
+                         'update',
+                         'cache'
+                         );
+             foreach($rm_dirs as $rm_dir){
+                 if(is_dir($this->application_path.$rm_dir)){
+                     System::rm(array('-rf', $this->application_path.$rm_dir));
+                 }
+             }
+             
+             $rm_files = array(
+                             'application_hidden.reg',
+                             'application_installed.reg',
+                             'packages.log',
+                             'packages.reg',
+                             'packages_actions.reg',
+                             'packages_packages.reg',
+                             'packages_queue.reg',
+                             'packages_resolve.reg',
+                             'packages_versions.reg',
+                             'plugins.reg',
+                             'plugins_actions.reg',
+                             'plugins_packages.reg',
+                             'plugins_queue.reg',
+                             'plugins_resolve.reg',
+                             'plugins_versions.reg',
+                             'procedures.reg'
+                             );
+             foreach($rm_files as $rm_file){
+                 if(file_exists($this->application_path.'installer'.DIRECTORY_SEPARATOR.$rm_file)){
+                     unlink($this->application_path.'installer'.DIRECTORY_SEPARATOR.$rm_file);
+                 }
+             }
+             
+             // make sure that applications registry gets refreshed
+             touch($this->application_path.'application.xml');
+         }
+     }
  
      function setApplicationProfile($profile, $application = NULL, $distribution = NULL)
***************
*** 979,983 ****
          $this->package_type = $type;
      }
! 
      function registerPackages($src = 'downloads', $application = NULL, $distribution = NULL)
      {
--- 1037,1041 ----
          $this->package_type = $type;
      }
!     
      function registerPackages($src = 'downloads', $application = NULL, $distribution = NULL)
      {
***************
*** 1049,1053 ****
          // get the modified time of the package registry file
          $pkgs_reg_mtime = $this->getPkgsRegMtime();
! 
          // have things changed in the source directory where all the package archives reside?
          //echo filemtime($pkgs_src_dir.'.').' (downloads/) > '.$pkgs_reg_mtime.'('.$this->package_type.'_packages.reg)<br/>';
--- 1107,1115 ----
          // get the modified time of the package registry file
          $pkgs_reg_mtime = $this->getPkgsRegMtime();
!         
!         if(!is_dir($pkgs_src_dir.'.')){
!             return true;
!         }
!         
          // have things changed in the source directory where all the package archives reside?
          //echo filemtime($pkgs_src_dir.'.').' (downloads/) > '.$pkgs_reg_mtime.'('.$this->package_type.'_packages.reg)<br/>';
***************
*** 1368,1372 ****
          foreach($package_sources as $sourcedir) {
              // parse package.xml file from all available packages
!             if($dp = @opendir($sourcedir)) {
                  while (false !== ($entry = readdir($dp))) {
                      if($entry != '.' && $entry != '..'){
--- 1430,1434 ----
          foreach($package_sources as $sourcedir) {
              // parse package.xml file from all available packages
!             if(is_dir($sourcedir) && $dp = opendir($sourcedir)) {
                  while (false !== ($entry = readdir($dp))) {
                      if($entry != '.' && $entry != '..'){
***************
*** 1446,1450 ****
          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))) {
--- 1508,1512 ----
          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))) {



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click