[zi-cvs] packages/com.zzoss.zic.plugin.config install_process.php,1.2,1.3 package.xml,1.2,1.3

[email protected] Wed, 14 Jan 2004 07:42:47 -0800
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.config
In directory sc8-pr-cvs1:/tmp/cvs-serv24103/com.zzoss.zic.plugin.config

Modified Files:
	install_process.php package.xml 
Log Message:
- introduced build.xml descriptor
- added lower case prefix, so now placeholders are detected with ZI_ and zi_ prefix
- all global vars of the installer ($GLOBALS['ZI']) are also replaced

Index: install_process.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.config/install_process.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** install_process.php	4 Jan 2004 13:26:55 -0000	1.2
--- install_process.php	14 Jan 2004 15:42:45 -0000	1.3
***************
*** 28,48 ****
  	if(!is_array($replace_values)){
  		// compose replace array
! 		$values = $_REQUEST['ZI_VALUES'];
! 		// downward compatibility
! 		//$values['include_path'] = $values['include_path_lib'];
! 		// hack for getting global params as replace
!         $values = $GLOBALS['ZI'];
! 		if(is_array($values) && count($values)){
  			foreach($values as $key => $val){
  				//echo $key.' = '.$val.'<br/>';
  				if(is_string($val)) {
! 					$replace_values['{ZI_'.$key.'}'] = htmlspecialchars($val);
  				}
  			}
  		}
  	}
  	
  	// first we parse config_files.xml
      // has been cut out, please take from old plugin files, when fixing
  	
  	
--- 28,72 ----
  	if(!is_array($replace_values)){
  		// compose replace array
!         $values = array();
!         
!         if(is_array($_REQUEST['ZI_VALUES']) && count($_REQUEST['ZI_VALUES'])){
!             $values = $_REQUEST['ZI_VALUES'];
  			foreach($values as $key => $val){
  				//echo $key.' = '.$val.'<br/>';
  				if(is_string($val)) {
! 					$replace_values['{'.$key.'}'] = htmlspecialchars($val);
  				}
  			}
  		}
+ 		// downward compatibility
+ 		//$values['include_path'] = $values['include_path_lib'];
+ 		// hack for getting global params as replace
+         $values = $GLOBALS['ZI'];
+         
+         foreach($values as $key => $val){
+             //echo $key.' = '.$val.'<br/>';
+             if(is_string($val)) {
+                 $replace_values['{ZI_'.$key.'}'] = $replace_values['{zi_'.$key.'}'] = htmlspecialchars($val);
+             }
+         }
  	}
  	
  	// first we parse config_files.xml
      // has been cut out, please take from old plugin files, when fixing
+     
+     $build_files = array();
+     
+     // check for build XML descriptor
+     $build_xml_file = $GLOBALS['ZI']['package_build_dir'].'build.xml';
+     if(is_readable($build_xml_file)){
+         $GLOBALS['ZI']['plugin_log'] .= "* Found '".$build_xml_file."'"."\n";
+         require_once 'ZZOSS_Config/Config.php';
+         $build = new ZZOSS_Config(array('numeric' => array('file')));
+         $build->setFile($build_xml_file); 
+         $build_xml = $build->query('/build');
+         $build_files = $build_xml['filelist']['file'];
+     } else {
+         $GLOBALS['ZI']['plugin_log'] .= "* Did not find '".$build_xml_file."'"."\n";
+     }
  	
  	
***************
*** 51,68 ****
  	// compose paths to configuration file
  	$config_dist = $GLOBALS['ZI']['package_build_dir'].'config.xml-dist';
- 	
-     $GLOBALS['ZI']['plugin_log'] .= "Check if '".$config_dist."' exists.\n";
  	if(is_readable($config_dist)) {
! 		
! 		require_once 'ZZOSS_File/Replace.php';
! 		$replace = new ZZOSS_FileReplace;
! 		
          System::mkdir(array('-p', $GLOBALS['ZI']['plugin_data_dir']));
          
! 		$config = $GLOBALS['ZI']['plugin_data_dir'].$GLOBALS['ZI']['plugin_params']['name'].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['package_name'].DIRECTORY_SEPARATOR.'config.xml';
! 	  	$replace->file($config_dist);
! 		$replace->replace($replace_values);
! 		$replace->writeout($config);
!         $GLOBALS['ZI']['plugin_log'] .= "* Parsed '".$config_dist."' and moved it to '".$config."'\n";
! 	}
  ?>
\ No newline at end of file
--- 75,117 ----
  	// compose paths to configuration file
  	$config_dist = $GLOBALS['ZI']['package_build_dir'].'config.xml-dist';
  	if(is_readable($config_dist)) {
!         $GLOBALS['ZI']['plugin_log'] .= "* Found '".$config_dist."'.\n";
!         $config_dist_xml['@']['name'] = 'config.xml-dist';
!         $config_dist_xml['@']['save-as'] = 'config.xml';
!         $build_files[] = $config_dist_xml;
! 	} else {
!         $GLOBALS['ZI']['plugin_log'] .= "* Did not find '".$config_dist."'.\n";
!     }
!     
!     // Iterate and process build files.
!     if(count($build_files)){
!         
!         require_once 'ZZOSS_File/Replace.php';
!         $replace = new ZZOSS_FileReplace;
          System::mkdir(array('-p', $GLOBALS['ZI']['plugin_data_dir']));
          
!         foreach($build_files as $build_file){
!             
!             $src_file = ZZOSS_InstallerUtils::fixPath($GLOBALS['ZI']['package_build_dir'].$build_file['@']['name']);
!             
!             // Compose destination path.
!             if(!strlen($build_file['@']['baseinstalldir'])){
!                 $dest_dir = $GLOBALS['ZI']['plugin_data_dir'].$GLOBALS['ZI']['plugin_params']['name'].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['package_name'].DIRECTORY_SEPARATOR;
!             } else {
!                 $dest_dir = $GLOBALS['ZI']['application_baseinstalldir'].$build_file['@']['baseinstalldir'].DIRECTORY_SEPARATOR;
!             }
!             
!             // Compose file name to write out.
!             if(!strlen($build_file['@']['save-as'])){
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['name']);
!             } else {
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['save-as']);
!             }
!             
!             $replace->file($src_file);
!             $replace->replace($replace_values);
!             $replace->writeout($dest_file);
!             $GLOBALS['ZI']['plugin_log'] .= "* Parsed '".$src_file."' and moved it to '".$dest_file."'\n";
!         }
!     }
  ?>
\ No newline at end of file

Index: package.xml
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.config/package.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** package.xml	4 Jan 2004 13:26:55 -0000	1.2
--- package.xml	14 Jan 2004 15:42:45 -0000	1.3
***************
*** 20,24 ****
      </maintainers>
      <release>
!         <version>1.0.1</version>
          <date>{zi_release_date}</date>
          <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
--- 20,24 ----
      </maintainers>
      <release>
!         <version>1.1.0</version>
          <date>{zi_release_date}</date>
          <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
***************
*** 26,29 ****
--- 26,30 ----
          <notes>
  <![CDATA[
+ - introduced build.xml descriptor
  - added lower case prefix, so now placeholders are detected with ZI_ and zi_ prefix
  - all global vars of the installer ($GLOBALS['ZI']) are also replaced




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html