diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 42af7f92635..70e79a6a3e5 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -180,8 +180,15 @@ class EcmFiles extends CommonObject if (empty($this->date_m)) $this->date_m = dol_now(); // If ref not defined - $ref = dol_hash($this->filepath.'/'.$this->filename, 3); - if (! empty($this->ref)) $ref=$this->ref; + $ref = ''; + if (! empty($this->ref)) + { + $ref=$this->ref; + } + else { + include_once DOL_DOCUMENT_ROOT.'/lib/security.lib.php'; + $ref = dol_hash($this->filepath.'/'.$this->filename, 3); + } $maxposition=0; if (empty($this->position)) // Get max used diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 439063015b0..fbec38af136 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4850,8 +4850,6 @@ function migrate_user_photospath() { while ($obj = $db->fetch_object($resql)) { - print '.'; - $fuser->fetch($obj->uid); //echo '
'.$fuser->id.' -> '.$fuser->entity; $entity = (empty($fuser->entity) ? 1 : $fuser->entity); @@ -4863,7 +4861,8 @@ function migrate_user_photospath() if ($dir) { - $origin = $dir .'/'. get_exdir($fuser->id,2,0,0,$fuser,'user'); + //print "Process user id ".$fuser->id."
\n"; + $origin = $dir .'/'. get_exdir($fuser->id,2,0,1,$fuser,'user'); // Use old behaviour to get x/y path $destin = $dir .'/'. $fuser->id; $origin_osencoded=dol_osencode($origin); @@ -4892,8 +4891,10 @@ function migrate_user_photospath() { if ($thumb == '.' || $thumb == '..') continue; + //print $origin.'/'.$file.'/'.$thumb.' -> '.$destin.'/'.$file.'/'.$thumb.'
'."\n"; print '.'; - dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb, 0, 0, 0, 0); + dol_copy($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb, 0, 0); + //var_dump('aaa');exit; } } // dol_delete_dir($origin.'/'.$file); @@ -4903,8 +4904,10 @@ function migrate_user_photospath() { if (! dol_is_file($destin.'/'.$file)) { + //print $origin.'/'.$file.' -> '.$destin.'/'.$file.'
'."\n"; print '.'; - dol_move($origin.'/'.$file, $destin.'/'.$file, 0, 0, 0, 1); + dol_copy($origin.'/'.$file, $destin.'/'.$file, 0, 0); + //var_dump('eee');exit; } } }