fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14996]


From: nelson . guerra
Subject: [Fmsystem-commits] [14996]
Date: Wed, 11 May 2016 00:24:45 +0000 (UTC)

Revision: 14996
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14996
Author:   nelson224
Date:     2016-05-11 00:24:45 +0000 (Wed, 11 May 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php

Modified: 
branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php     
2016-05-11 00:24:33 UTC (rev 14995)
+++ branches/dev-syncromind-2/property/inc/class.sogeneric_document.inc.php     
2016-05-11 00:24:45 UTC (rev 14996)
@@ -32,6 +32,9 @@
 
                function __construct()
                {
+                       $this->vfs = CreateObject('phpgwapi.vfs');
+                       $this->vfs->fakebase = '/property';
+                       
                        $this->db = & $GLOBALS['phpgw']->db;
                        $this->join = & $this->db->join;
                        $this->left_join = & $this->db->left_join;
@@ -236,4 +239,55 @@
                        
                }
                
+               public function delete( $file_id )
+               {
+                       $file_info = $this->vfs->get_info($file_id);
+                       $file = 
"{$file_info['directory']}/{$file_info['name']}";
+
+                       if ($file)
+                       {
+                               $this->db->transaction_begin();
+                               
+                               $this->db->query("DELETE FROM 
phpgw_vfs_file_relation WHERE file_id = {$file_id}", __LINE__, __FILE__);
+                               $this->db->query("DELETE FROM 
phpgw_vfs_filedata WHERE file_id = {$file_id}", __LINE__, __FILE__);
+                                                               
+                               $receipt = $this->delete_file($file);
+                               
+                               if (!isset($receipt['error']))
+                               {
+                                       $this->db->transaction_commit();
+                               }
+                       }
+                       
+                       return $receipt;
+               }
+               
+               function delete_file( $file )
+               {
+                       $receipt = array();
+                       if ($this->vfs->file_exists(array(
+                                       'string' => $file,
+                                       'relatives' => array(RELATIVE_NONE)
+                               )))
+                       {
+                               $this->vfs->override_acl = 1;
+
+                               if (!$this->vfs->rm(array(
+                                               'string' => $file,
+                                               'relatives' => array(
+                                                       RELATIVE_NONE
+                                               )
+                                       )))
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('failed to delete file') . ' :' . $file);
+                               }
+                               else
+                               {
+                                       $receipt['message'][] = array('msg' => 
lang('file deleted') . ' :' . $file);
+                               }
+                               $this->vfs->override_acl = 0;
+                       }
+                       return $receipt;
+               }
+               
        }
\ No newline at end of file




reply via email to

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