Ignore:
Timestamp:
12/16/09 16:05:13 (15 years ago)
Author:
amuller
Message:

Ticket #597 - Melhoria do FM, Implementação do arquivamento

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/class.vfs_functions.inc.php

    r1844 r1854  
    2626                        'rename'=>True, 
    2727                        'delete'=>True, 
     28                        'archive'=>True, 
    2829                        'summary' => True 
    2930                ); 
     
    244245                        foreach($this->fileman as $filename) 
    245246                        { 
    246                                 if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename))) 
     247                                if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->rm(array( 
     248                                        'string' => $this->path.'/'.$filename, 
     249                                        'relatives' => array (RELATIVE_NONE) 
     250                                ))) 
    247251                                { 
    248252                                        echo $filename.":"; 
     
    254258                                } 
    255259                        } 
     260                } 
     261                function archive(){ 
     262                        foreach($this->fileman as $filename) 
     263                        { 
     264                                if(!$this->verifyLock($filename,RELATIVE_ALL)) 
     265                                { 
     266                                        echo "locked:".$filename; 
     267                                        return False; 
     268                                } 
     269                                $command .= " ".escapeshellarg($filename); 
     270                        } 
     271                        $zipFileName=$GLOBALS['phpgw_info']['user']['account_lid'].date("Ymd").".zip"; 
     272                        $zipFilePath=ini_get("session.save_path")."/".$zipFileName; 
     273                        $command = $zipFilePath.$command; 
     274 
     275                        if (strlen($this->pswd) > 0){ 
     276                                $command = " -P ".(base64_decode($this->pswd) ^ $this->path)." ".$command; 
     277                        } 
     278 
     279                        exec("cd ".$this->bo->vfs->basedir.$this->path.";".escapeshellcmd("nice -n19 zip -9 ".$command)."; history -c"); 
     280 
     281                        $this->bo->vfs->cp(array( 
     282                                'from'=> $zipFilePath, 
     283                                'to'=> $zipFileName, 
     284                                'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
     285                        )); 
     286                        $this->bo->vfs->set_attributes(array( 
     287                                'string'=> $zipFileName, 
     288                                'relatives'     => array(RELATIVE_ALL), 
     289                                'attributes'=> array( 
     290                                        'mime_type' => "application/zip" 
     291                                ) 
     292                        )); 
     293                        exec("rm -f ".escapeshellcmd(escapeshellarg($zipFilePath))); 
     294                        $this->delete(); 
    256295                } 
    257296                function editComment() 
Note: See TracChangeset for help on using the changeset viewer.