fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16148]


From: nelson . guerra
Subject: [Fmsystem-commits] [16148]
Date: Wed, 11 Jan 2017 16:42:54 -0500 (EST)

Revision: 16148
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16148
Author:   nelson224
Date:     2017-01-09 17:09:02 -0500 (Mon, 09 Jan 2017)
Log Message:
-----------


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

Modified: 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
===================================================================
--- 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2017-01-06 14:10:37 UTC (rev 16147)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2017-01-09 22:09:02 UTC (rev 16148)
@@ -106,7 +106,7 @@
                        return $values;                 
                }
                
-               private function _search_file($md5_sum)
+               private function _search_file_in_db($md5_sum)
                {
                        $sql = "SELECT file_id, md5_sum FROM phpgw_vfs "
                                        . " WHERE md5_sum = '{$md5_sum}'"
@@ -126,10 +126,10 @@
                {
                        $md5sum = $file_data['md5sum'];
                        $file_id = array_search($md5sum, 
$this->last_files_added);
-                       if (!$file_id)
+                       /*if (!$file_id)
                        {
                                $file_id = $this->_search_file($md5sum);
-                       }
+                       }*/
                        
                        return $file_id;
                }
@@ -169,13 +169,17 @@
                                        $file_id = 
$this->_search_in_last_files_added($file_data);
                                        if (!$file_id) 
                                        {
-                                               $file_id = 
$this->_save_file($file_data);
+                                               $file_id = 
$this->_search_file_in_db($file_data['md5sum']);
                                                if (!$file_id)
-                                               {                               
                
-                                                       throw new 
Exception("failed to copy file '{$file_data['path_file']}'");
-                                               } 
-                                               unlink($file_data['path_file']);
-                                               $count_new_files++;
+                                               {
+                                                       $file_id = 
$this->_save_file($file_data);
+                                                       if (!$file_id)
+                                                       {                       
                        
+                                                               throw new 
Exception("failed to copy file '{$file_data['path_file']}'");
+                                                       } 
+                                                       
unlink($file_data['path_file']);
+                                                       $count_new_files++;
+                                               }
                                                
                                                $result = 
$this->_save_file_relation($component['id'], $component['location_id'], 
$file_id);
                                                if (!$result)
@@ -182,6 +186,7 @@
                                                {                               
                
                                                        $message['error'][] = 
array('msg' => "failed to save relation. File: '{$file}'");
                                                } else {
+                                                       
$this->last_files_added[$file_id] = $file_data['md5sum'];
                                                        $count_new_relations++;
                                                }
                                        }
@@ -585,12 +590,12 @@
 
                                                $file = $file_data['file'];
                                                
-                                               $file_id = 
$this->_search_in_last_files_added($file_data);
+                                               $id = 
$this->_search_in_last_files_added($file_data);
+                                               $file_id = ($id) ? $id : 
$this->_search_file_in_db($file_data['md5sum']);
                                                if (!$file_id) 
                                                {
                                                        if 
(!is_file($file_data['path_file']))
                                                        {
-                                                               
//$count_files_not_existing++;
                                                                $_file = 
($file_data['path_file']) ? $file_data['path_file'] : 
$file_data['path'].'/'.$file_data['file'];
                                                                
$files_not_existing[$_file] = $_file;
                                                                throw new 
Exception();
@@ -610,6 +615,7 @@
                                                {                               
                
                                                        $message['error'][] = 
array('msg' => "failed to save relation. File: '{$file}'. Component: '{$k}'");
                                                } else {
+                                                       
$this->last_files_added[$file_id] = $file_data['md5sum'];
                                                        $count_new_relations++;
                                                }                               
        
 
@@ -735,7 +741,7 @@
                                return false;
                        }
                        
-                       $this->last_files_added[$file_id] = $md5sum;
+                       //$this->last_files_added[$file_id] = $md5sum;
 
                        $this->db->query("UPDATE phpgw_vfs SET 
md5_sum='{$md5sum}'"
                                . " WHERE file_id='{$file_id}'", __LINE__, 
__FILE__);




reply via email to

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