Changeset 29761
- Timestamp:
- Sep 23, 2014, 3:16:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/virtualize/admin.php
r17679 r29761 46 46 path AS oldpath, 47 47 date_available, 48 representative_ext, 48 49 id 49 50 FROM '.IMAGES_TABLE.' … … 59 60 60 61 $upload_dir = './upload/'.$year.'/'.$month.'/'.$day; 61 if (!is_dir($upload_dir)) 62 { 63 umask(0000); 64 $recursive = true; 65 if (!@mkdir($upload_dir, 0777, $recursive)) 66 { 67 echo 'error during "'.$upload_dir.'" directory creation'; 68 exit(); 69 } 70 } 71 secure_directory($upload_dir); 62 mkgetdir($upload_dir); 72 63 64 $newfilename_wo_ext = $year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8); 65 73 66 $extension = get_extension($row['oldpath']); 74 $newfilename = $ year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8).'.jpg';67 $newfilename = $newfilename_wo_ext.'.'.$extension; 75 68 76 69 $newpath = $upload_dir.'/'.$newfilename; 77 70 78 $query = ' 71 if (rename($row['oldpath'], $newpath)) 72 { 73 if (!empty($row['representative_ext'])) 74 { 75 $rep_dir = $upload_dir.'/pwg_representative'; 76 mkgetdir($rep_dir); 77 78 $rep_oldpath = original_to_representative($row['oldpath'], $row['representative_ext']); 79 rename($rep_oldpath, $rep_dir.'/'.$newfilename_wo_ext.'.'.$row['representative_ext']); 80 } 81 82 $query = ' 79 83 UPDATE '.IMAGES_TABLE.' 80 84 SET path = \''.$newpath.'\', … … 82 86 WHERE id = '.$row['id'].' 83 87 ;'; 84 pwg_query($query);88 pwg_query($query); 85 89 86 rename($row['oldpath'], $newpath); 87 delete_element_derivatives(array('path' => $row['oldpath'])); 90 delete_element_derivatives( 91 array( 92 'path' => $row['oldpath'], 93 'representative_ext' => $row['representative_ext'], 94 ) 95 ); 96 } 88 97 } 89 98
Note: See TracChangeset
for help on using the changeset viewer.