[zi-cvs] packages/com.zzoss.zic.plugin.config install_process.php,1.6,1.7

Christian Zonsius <[email protected]> Thu, 01 Apr 2004 14:40:47 +0000
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.sourceforge.net:/tmp/cvs-serv29156

Modified Files:
	install_process.php 
Log Message:
source of <file> element in build.xml can now directly entered as content of element

Index: install_process.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.config/install_process.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** install_process.php	26 Mar 2004 10:36:03 -0000	1.6
--- install_process.php	1 Apr 2004 14:40:45 -0000	1.7
***************
*** 1,127 ****
! <?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$
!     @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
!     */
! 	
!     $GLOBALS['ZI']['plugin_log'] .= "Processing config builds.\n";
!     
! 	if(!isset($replace_values)){
! 		// compose replace array
!         $values = array();
!         
!         if(isset($_REQUEST['ZI_VALUES']) && 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);
!             }
!         }
!         
!         $replace_values['{zi_directory_separator}'] = DIRECTORY_SEPARATOR;
! 	}
! 	
! 	// 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";
!     }
! 	
! 	
! 	// second we parse the config.xml-dist and make it config.xml
! 	
! 	// 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;
!         $replace->replace($replace_values);
!         
!         $pkg_data_dir = $GLOBALS['ZI']['plugin_data_dir'].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['package_name'].DIRECTORY_SEPARATOR;
!         $GLOBALS['ZI']['plugin_log'] .= "Creating data dir '$pkg_data_dir'\n";
!         System::mkdir(array('-p', $pkg_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(!isset($build_file['@']['baseinstalldir'])){
!                 if(!isset($GLOBALS['ZI']['plugin_params']['name'])){
!                     $GLOBALS['ZI']['plugin_params']['name'] = '';
!                 }
!                 $dest_dir = $pkg_data_dir.$GLOBALS['ZI']['plugin_params']['name'].DIRECTORY_SEPARATOR;
!             } else {
!                 $dest_dir = $GLOBALS['ZI']['application_baseinstalldir'].$build_file['@']['baseinstalldir'].DIRECTORY_SEPARATOR;
!             }
!             
!             // Compose file name to write out.
!             if(isset($build_file['@']['save-as'])){
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['save-as']);
!             } elseif(isset($build_file['@']['install-as'])){
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['install-as']);
!             } else {
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['name']);
!             }
!             
!             $replace->file($src_file);
!             $replace->writeout($dest_file);
!             $GLOBALS['ZI']['plugin_log'] .= "* Parsed '".$src_file."' and moved it to '".$dest_file."'\n";
!         }
!     }
  ?>
\ No newline at end of file
--- 1,133 ----
! <?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$
!     @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
!     */
! 	
!     $GLOBALS['ZI']['plugin_log'] .= "Processing config builds.\n";
!     
! 	if(!isset($replace_values)){
! 		// compose replace array
!         $values = array();
!         
!         if(isset($_REQUEST['ZI_VALUES']) && 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);
!             }
!         }
!         
!         $replace_values['{zi_directory_separator}'] = DIRECTORY_SEPARATOR;
! 	}
! 	
! 	// 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";
!     }
! 	
! 	
! 	// second we parse the config.xml-dist and make it config.xml
! 	
! 	// 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;
!         $replace->replace($replace_values);
!         
!         $pkg_data_dir = $GLOBALS['ZI']['plugin_data_dir'].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['package_name'].DIRECTORY_SEPARATOR;
!         $GLOBALS['ZI']['plugin_log'] .= "Creating data dir '$pkg_data_dir'\n";
!         System::mkdir(array('-p', $pkg_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(!isset($build_file['@']['baseinstalldir'])){
!                 if(!isset($GLOBALS['ZI']['plugin_params']['name'])){
!                     $GLOBALS['ZI']['plugin_params']['name'] = '';
!                 }
!                 $dest_dir = $pkg_data_dir.$GLOBALS['ZI']['plugin_params']['name'].DIRECTORY_SEPARATOR;
!             } else {
!                 $dest_dir = $GLOBALS['ZI']['application_baseinstalldir'].$build_file['@']['baseinstalldir'].DIRECTORY_SEPARATOR;
!             }
!             
!             // Compose file name to write out.
!             if(isset($build_file['@']['save-as'])){
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['save-as']);
!             } elseif(isset($build_file['@']['install-as'])){
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['install-as']);
!             } else {
!                 $dest_file = ZZOSS_InstallerUtils::fixPath($dest_dir.$build_file['@']['name']);
!             }
!             
!             if(isset($build_file['#'])&&(strlen($build_file['#'])>0)) {
! 				$replace->data($build_file['#']);
! 				// for plugin log
! 				$src_file = '<data from build.xml>';
! 			} else {
! 				$replace->file($src_file);
! 			}
!             $replace->writeout($dest_file);
!             $GLOBALS['ZI']['plugin_log'] .= "* Parsed '".$src_file."' and moved it to '".$dest_file."'\n";
!         }
!     }
  ?>
\ No newline at end of file



-------------------------------------------------------
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