[zi-cvs] packages/com.zzoss.zic.plugin.filerole role_php.php,1.3,1.4
Christian Zonsius <[email protected]> Mon, 22 Mar 2004 18:57:00 +0000
| Newsgroups | gmane.comp.php.zzoss.installer.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.filerole
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27818
Modified Files:
role_php.php
Log Message:
os-independant path correction
Index: role_php.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.filerole/role_php.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** role_php.php 22 Mar 2004 08:25:26 -0000 1.3
--- role_php.php 22 Mar 2004 18:56:58 -0000 1.4
***************
*** 1,82 ****
! <?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 © 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
! @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
! */
!
! echo '['.$GLOBALS['ZI']['package_action'].' '.$GLOBALS['ZI']['package_name'].'-'.$GLOBALS['ZI']['package_version'].']'."\n";
!
! if(
! isset($GLOBALS['ZI']['file_role']) &&
! !isset($fileroles_dirs[$GLOBALS['ZI']['file_role']]) &&
! $GLOBALS['ZI']['file_role'] == 'doc' ||
! $GLOBALS['ZI']['file_role'] == 'data' ||
! $GLOBALS['ZI']['file_role'] == 'test' ||
! $GLOBALS['ZI']['file_role'] == 'script'
! ){
! // grab the destination directories for the various roles
! $config_file = $GLOBALS['ZI']['application_data_dir'].'data'.DIRECTORY_SEPARATOR.'plugin'.DIRECTORY_SEPARATOR.'com.zzoss.zic.plugin.filerole'.DIRECTORY_SEPARATOR.'config.xml';
! require_once 'ZZOSS_Config/Config.php';
! $config = new ZZOSS_Config;
! $config->setFile($config_file);
! $GLOBALS['ZI']['plugin_log'] .=
! "Reading filerole destination directories from '$config_file'"."\n";
! $fileroles_dirs = $config->query('/application');
! $GLOBALS['ZI']['plugin_log'] .=
! "Extracted data from '$config_file'"."\n";
! } else {
! $fileroles_dirs = array(
! $GLOBALS['ZI']['file_role'] => $GLOBALS['ZI']['package_baseinstalldir']
! );
! }
! $file_dest = $fileroles_dirs[$GLOBALS['ZI']['file_role']].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['file_baseinstalldir'].$GLOBALS['ZI']['file_name_dest'];
!
! switch($GLOBALS['ZI']['package_action']){
! case 'remove':
! unlink($file_dest);
! $GLOBALS['ZI']['plugin_log'] .= 'deleted '.$file_dest;
! break;
! case 'update':
! case 'install':
! if(isset($GLOBALS['ZI']['file_role']) && $GLOBALS['ZI']['file_role'] == 'build'){
! break;
! } else {
! if(!is_dir(dirname($file_dest))){
! System::mkDir(array("-p",dirname($file_dest)));
! $GLOBALS['ZI']['plugin_log'] .= 'Created directory '.dirname($file_dest)."\n";
! }
! //ZZOSS_InstallerUtils::mkdir($pathinfo["dirname"]);
! //$log .= 'src: '.$src. 'dest: '.$dest."\n";
! //echo 'src: '.$src. 'dest: '.$dest."\n<br>";
! if(!copy($GLOBALS['ZI']['file_src'],$file_dest)) {
! $GLOBALS['ZI']['plugin_log'] .=
! 'Cannot copy '.$GLOBALS['ZI']['file_src']."\n".
! ' to '.$file_dest."\n";
! } else {
! $GLOBALS['ZI']['plugin_log'] .=
! 'Copied '.$GLOBALS['ZI']['file_src']."\n".
! ' to '.$file_dest."\n";
! }
! }
! break;
! }
?>
\ No newline at end of file
--- 1,91 ----
! <?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 © 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
! @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
! */
!
! // hack since there is no real plugin base class yet ;)
! íf(!function_exists('ZZOSS_fixPath')) {
! function ZZOSS_fixPath($path) {
! $path = str_replace('\\', DIRECTORY_SEPARATOR, $path);
! $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
! return $path;
! }
! }
!
! echo '['.$GLOBALS['ZI']['package_action'].' '.$GLOBALS['ZI']['package_name'].'-'.$GLOBALS['ZI']['package_version'].']'."\n";
!
! if(
! isset($GLOBALS['ZI']['file_role']) &&
! !isset($fileroles_dirs[$GLOBALS['ZI']['file_role']]) &&
! $GLOBALS['ZI']['file_role'] == 'doc' ||
! $GLOBALS['ZI']['file_role'] == 'data' ||
! $GLOBALS['ZI']['file_role'] == 'test' ||
! $GLOBALS['ZI']['file_role'] == 'script'
! ){
! // grab the destination directories for the various roles
! $config_file = $GLOBALS['ZI']['application_data_dir'].'data'.DIRECTORY_SEPARATOR.'plugin'.DIRECTORY_SEPARATOR.'com.zzoss.zic.plugin.filerole'.DIRECTORY_SEPARATOR.'config.xml';
! require_once 'ZZOSS_Config/Config.php';
! $config = new ZZOSS_Config;
! $config->setFile($config_file);
! $GLOBALS['ZI']['plugin_log'] .=
! "Reading filerole destination directories from '$config_file'"."\n";
! $fileroles_dirs = $config->query('/application');
! $GLOBALS['ZI']['plugin_log'] .=
! "Extracted data from '$config_file'"."\n";
! } else {
! $fileroles_dirs = array(
! $GLOBALS['ZI']['file_role'] => $GLOBALS['ZI']['package_baseinstalldir']
! );
! }
! $file_dest = ZZOSS_fixPath($fileroles_dirs[$GLOBALS['ZI']['file_role']]).DIRECTORY_SEPARATOR.ZZOSS_fixPath($GLOBALS['ZI']['file_baseinstalldir']).$GLOBALS['ZI']['file_name_dest'];
!
! switch($GLOBALS['ZI']['package_action']){
! case 'remove':
! unlink($file_dest);
! $GLOBALS['ZI']['plugin_log'] .= 'deleted '.$file_dest;
! break;
! case 'update':
! case 'install':
! if(isset($GLOBALS['ZI']['file_role']) && $GLOBALS['ZI']['file_role'] == 'build'){
! break;
! } else {
! if(!is_dir(dirname($file_dest))){
! System::mkDir(array("-p",dirname($file_dest)));
! $GLOBALS['ZI']['plugin_log'] .= 'Created directory '.dirname($file_dest)."\n";
! }
! //ZZOSS_InstallerUtils::mkdir($pathinfo["dirname"]);
! //$log .= 'src: '.$src. 'dest: '.$dest."\n";
! //echo 'src: '.$src. 'dest: '.$dest."\n<br>";
! if(!copy($GLOBALS['ZI']['file_src'],$file_dest)) {
! $GLOBALS['ZI']['plugin_log'] .=
! 'Cannot copy '.$GLOBALS['ZI']['file_src']."\n".
! ' to '.$file_dest."\n";
! } else {
! $GLOBALS['ZI']['plugin_log'] .=
! 'Copied '.$GLOBALS['ZI']['file_src']."\n".
! ' to '.$file_dest."\n";
! }
! }
! break;
! }
?>
\ 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