phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.app_registry.inc.php,1.7,1.8


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.app_registry.inc.php,1.7,1.8
Date: Sun, 24 Feb 2002 16:01:01 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv17407/phpgwapi/inc

Modified Files:
        class.app_registry.inc.php 
Log Message:
Will now download the requested app.  Still need to add the setup/install 
process to it.

Index: class.app_registry.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.app_registry.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.app_registry.inc.php  23 Feb 2002 14:39:24 -0000      1.7
--- class.app_registry.inc.php  24 Feb 2002 21:00:59 -0000      1.8
***************
*** 43,46 ****
--- 43,55 ----
                var $soap_functions = array();
  
+               var $install_file = True;
+ //            var $install_file = False;
+ 
+               var $write_file = True;
+ //            var $write_file = False;
+ 
+ //            var $debug = True;
+               var $debug = False;
+ 
                var $db;
                var $is;
***************
*** 216,258 ****
                }
  
!               function request_packaged_app($app_id)
                {
!                       if(is_object($this->is))
                        {
!                               $application = 
$this->is->send('system.package_app',$app_id,$this->is->server['server_url']);
! // comment from here down to stop the actual install
! /*
!                               // This is where I need to install the 
application
!                               $sep = filesystem_separator();
!                               @reset($application);
!                               list($appid,$app_info) = each($application);
!                               $app_name = $app_info['name'];
  
!                               $basedir = PHPGW_SERVER_ROOT.$sep.$app_name;
!                               @mkdir($basedir);
  
!                               while($application && 
list($filename,$file_content) = each($application))
                                {
!                                       $long_filename = 
$basedir.$sep.$filename;
!                                       // This will be dangerous to do
!                                       $directory = dirname($long_filename);
!                                       if(!is_dir($directory))
                                        {
!                                               $long_dir = $long_filename;
!                                               $pos_slash = pos(' 
'.$long_dir,$sep)
!                                               while($pos_slash)
!                                               {
!                                                       $short_dir = 
substr($long_dir,0,$pos_slash - 1);
!                                                       $long_dir = 
str_replace($short_dir.$sep,'',$long_dir);
!                                                       @mkdir($short_dir,770);
!                                                       $pos_slash = pos(' 
'.$long_dir,$sep)
!                                               }
                                        }
-                                       $fp=fopen($long_filename,'wb');
-                                       
fwrite($fp,base64_decode($file_content));
-                                       fclose($fp);
                                }
- */
- // Comment above to stop the actual install
                                @reset($application);
                                return $application;
--- 225,332 ----
                }
  
!               function create_file($basedir,$sep,$filename,$file_content)
                {
!                       // This will be dangerous to do
!                       $directory = dirname($filename);
!                       if($this->debug)
                        {
!                               echo 'Checking filename: 
'.$filename.'<br>'."\n".'Directory part: '.$directory.'<br>'."\n";
!                       }
!                       $ind_dir = explode('/',$directory);
!                       $long_dir = '';
!                       $new_base = $basedir;
!                       for($i=0;$i<count($ind_dir);$i++)
!                       {
!                               @chdir($new_base);
!                               if($this->debug)
!                               {
!                                       echo 'Changing directory to 
:'.$new_base.'<br>'."\n";
!                               }
!                               $long_dir .= ($long_dir?$sep:'').$ind_dir[$i];
!                               if(!is_dir($ind_dir[$i]))
!                               {
!                                       @mkdir($ind_dir[$i],0770);
!                                       if($this->debug)
!                                       {
!                                               echo 'Creating Directory: 
'.$ind_dir[$i].'<br>'."\n";
!                                       }
!                                       clearstatcache();
!                               }
!                               $new_base .= $sep.$ind_dir[$i];
!                       }
!                       if($this->write_file)
!                       {
!                               @chdir($basedir);
!                               $fp=fopen($basedir.$sep.$filename,'wb');
!                               fwrite($fp,base64_decode($file_content));
!                               fclose($fp);
!                               if($this->debug)
!                               {
!                                       echo 'Creating file: 
'.$basedir.$sep.$filename.'<br>'."\n";
!                               }
!                       }
!                       if($this->debug)
!                       {
!                               echo '<br>'."\n";
!                       }
!               }
  
!               function delete_dir($directory,$sep)
!               {
!                       $d = dir($directory);
!                       $dir_path = Array();
!                       while($entry = $d->read())
!                       {
!                               $new_filename = $directory.$sep.$entry;
!                               if(is_file($new_filename))
!                               {
!                                       unlink($new_filename);
!                               }
!                               elseif(is_dir($new_filename))
!                               {
!                                       if($entry != '.' && $entry != '..')
!                                       {
!                                               $dir_path[] = $new_filename;
!                                       }
!                               }
!                       }
!                       $d->close();
!                       @reset($dir_path);
!                       while($dir_path && list($dummy,$dir) = each($dir_path))
!                       {
!                               $this->delete_dir($dir,$sep);
!                       }
!                       rmdir($directory);
!               }
  
!               function request_packaged_app($app_id)
!               {
!                       if(is_object($this->is))
!                       {
!                               $application = 
$this->is->send('system.package_app',$app_id,$this->is->server['server_url'],False);
!                               
!                               if(is_array($application) && 
$this->install_file)
                                {
!                                       // This is where I need to install the 
application
!                                       $sep = filesystem_separator();
!                                       @reset($application);
!                                       list($appid,$app_info) = 
each($application);
!                                       $app_name = $app_info['name'];
! 
!                                       $basedir = 
PHPGW_SERVER_ROOT.$sep.$app_name;
! 
!                                       $this->delete_dir($basedir,$sep);
!                                       
!                                       @mkdir($basedir,0770);
!                                       if($this->debug)
!                                       {
!                                               echo 'Creating Directory: 
'.$basedir.'<br>'."\n";
!                                       }
! 
!                                       while(list($filename,$file_content) = 
each($application))
                                        {
!                                               
$this->create_file($basedir,$sep,$filename,$file_content);
                                        }
                                }
                                @reset($application);
                                return $application;
***************
*** 409,415 ****
                        $this->db->next_record();
                        $app_name = $this->db->f('app_name');
!                       $this->dir_file[$this->db->f('app_id')] = 
CreateObject('phpgwapi.xmlrpcval',
                                Array(
!                                       'id'      => 
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_id'),'int'),
                                        'name'    => 
CreateObject('phpgwapi.xmlrpcval',$app_name,'string'),
                                        'title'   => 
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_title'),'string'),
--- 483,490 ----
                        $this->db->next_record();
                        $app_name = $this->db->f('app_name');
!                       $app_id = $this->db->f('app_id');
!                       $this->dir_file[$app_id] = 
CreateObject('phpgwapi.xmlrpcval',
                                Array(
!                                       'id'      => 
CreateObject('phpgwapi.xmlrpcval',$app_id,'int'),
                                        'name'    => 
CreateObject('phpgwapi.xmlrpcval',$app_name,'string'),
                                        'title'   => 
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_title'),'string'),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]