Changeset 6873
- Timestamp:
- Sep 9, 2010, 10:10:50 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/element_set_global.php
r6363 r6873 78 78 } 79 79 80 // filter selection on photos that have no storage_category_id (ie that81 // were added via pLoader)82 80 if (count($collection) > 0) 83 81 { 84 $query = ' 85 SELECT 86 id 87 FROM '.IMAGES_TABLE.' 88 WHERE id IN ('.implode(',', $collection).') 89 AND storage_category_id IS NULL 90 ;'; 91 $deletables = array_from_query($query, 'id'); 92 93 if (count($deletables) > 0) 94 { 95 $physical_deletion = true; 96 delete_elements($deletables, $physical_deletion); 97 82 $deleted_count = delete_elements($collection, true); 83 if ($deleted_count > 0) 84 { 98 85 array_push( 99 86 $page['infos'], … … 102 89 '%d photo was deleted', 103 90 '%d photos were deleted', 104 count($deletables)91 $deleted_count 105 92 ), 106 count($deletables)93 $deleted_count 107 94 ) 108 95 ); … … 322 309 // +-----------------------------------------------------------------------+ 323 310 324 // we can only remove photos that have no storage_category_id, in other 325 // word, it currently (Butterfly) means that the photo was added with 326 // pLoader 311 // we can only remove photos that are not remote 327 312 if (count($page['cat_elements_id']) > 0) 328 313 { … … 332 317 FROM '.IMAGES_TABLE.' 333 318 WHERE id IN ('.implode(',', $page['cat_elements_id']).') 334 AND storage_category_id IS NULL319 AND path NOT LIKE "http%" 335 320 ;'; 336 321 list($counter) = pwg_db_fetch_row(pwg_query($query)); -
trunk/admin/include/functions.php
r6664 r6873 132 132 // - all the links between categories and elements 133 133 // - all the favorites associated to elements 134 // @return number of deleted elements 134 135 function delete_elements($ids, $physical_deletion=false) 135 136 { 136 137 if (count($ids) == 0) 137 138 { 138 return ;139 return 0; 139 140 } 140 141 trigger_action('begin_delete_elements', $ids); … … 143 144 { 144 145 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); 145 146 // we can currently delete physically only photo with no 147 // storage_category_id (added via pLoader) 148 // 149 // we assume that the element is a photo, with no representative 146 $new_ids=array(); 147 150 148 $query = ' 151 149 SELECT … … 153 151 path, 154 152 tn_ext, 155 has_high 153 has_high, 154 representative_ext 156 155 FROM '.IMAGES_TABLE.' 157 156 WHERE id IN ('.implode(',', $ids).') 158 AND storage_category_id IS NULL159 157 ;'; 160 158 $result = pwg_query($query); 161 159 while ($row = pwg_db_fetch_assoc($result)) 162 160 { 163 $file_path = $row['path']; 164 $thumbnail_path = get_thumbnail_path($row); 165 $high_path = null; 166 if (isset($row['has_high']) and get_boolean($row['has_high'])) 161 if (url_is_remote($row['path'])) 162 continue; 163 $files = array(); 164 $files[] = get_element_path($row); 165 if (!empty($row['tn_ext'])) 166 $files[] = get_thumbnail_path($row); 167 if (!empty($row['has_high']) and get_boolean($row['has_high'])) 168 $files[] = get_high_path($row); 169 if (!empty($row['representative_ext'])) 167 170 { 168 $high_path = get_high_path($row); 171 $pi = pathinfo($row['path']); 172 $file_wo_ext = get_filename_wo_extension($pi['basename']); 173 $files[] = PHPWG_ROOT_PATH.$pi['dirname'].'/pwg_representative/'.$file_wo_ext.'.'.$element_info['representative_ext']; 169 174 } 170 175 171 foreach (array($file_path, $thumbnail_path, $high_path) as $path) 176 $ok = true; 177 foreach ($files as $path) 172 178 { 173 if (is set($path) and is_file($path) and !unlink($path))179 if (is_file($path) and !unlink($path)) 174 180 { 175 die('"'.$path.'" cannot be removed'); 181 $ok = false; 182 trigger_error('"'.$path.'" cannot be removed', E_USER_WARNING); 183 break; 176 184 } 177 185 } 186 if ($ok) 187 $new_ids[] += $row['id']; 188 else 189 break; 190 } 191 $ids = $new_ids; 192 if (count($ids)==0) 193 { 194 return 0; 178 195 } 179 196 } … … 250 267 251 268 trigger_action('delete_elements', $ids); 269 return count($ids); 252 270 } 253 271 -
trunk/admin/themes/default/template/element_set_global.tpl
r6587 r6873 86 86 <fieldset> 87 87 <legend>{'Deletions'|@translate}</legend> 88 {if $ENABLE_SYNCHRONIZATION}89 <p style="font-style:italic">{'Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'|@translate}</p>90 {/if}91 88 <p> 92 89 {'target'|@translate} -
trunk/language/en_UK/admin.lang.php
r6698 r6873 607 607 $lang['Quick Local Synchronization'] = "Quick Local Synchronization"; 608 608 $lang['No photo can be deleted'] = "No photo can be deleted"; 609 $lang['Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'] = "Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.";610 609 $lang['Delete selected photos'] = "Delete selected photos"; 611 610 $lang['%d photo was deleted'] = "%d photo deleted"; -
trunk/language/fr_CA/admin.lang.php
r6676 r6873 618 618 $lang['Quick Local Synchronization'] = "Synchronisation rapide"; 619 619 $lang['No photo can be deleted'] = "Aucune photo ne peut être supprimée"; 620 $lang['Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'] = "Note : Cette suppression des photos ne s'applique pas pour les photos ajoutées à l'aide de la synchronisation (méthode classique par chargement FTP). Pour ces photos, supprimez-les de votre serveur et refaites une synchronisation.";621 620 $lang['Delete selected photos'] = "Supprimer les photos sélectionnées"; 622 621 $lang['%d photo was deleted'] = "%d photo a été supprimée"; -
trunk/language/fr_FR/admin.lang.php
r6736 r6873 608 608 $lang['Quick Local Synchronization'] = "Synchronisation Rapide"; 609 609 $lang['No photo can be deleted'] = "Aucune photo ne peut être supprimée"; 610 $lang['Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'] = "Note : Cette suppression des photos ne s'applique pas pour les photos ajoutées à l'aide de la synchronisation (méthode classique par chargement FTP). Pour ces photos, supprimez-les de votre serveur et refaites une synchronisation.";611 610 $lang['Delete selected photos'] = "Supprimer les photos sélectionnées"; 612 611 $lang['%d photo was deleted'] = "%d photo a été supprimée"; -
trunk/language/hu_HU/admin.lang.php
r6676 r6873 602 602 $lang['Quick Local Synchronization'] = 'Helyi szinkronizálás'; 603 603 $lang['No photo can be deleted'] = 'Nincs törölhető kép'; 604 $lang['Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'] = "Megjegyzés: a képek törlése nem vonatkozik a szinkronizálással hozzáadott képekre. A szinkronizálással hozzáadott képeket törölni kell a fájlrendszerből, majd ismételt szinkronizálás szükséges.";605 604 $lang['Delete selected photos'] = 'Kijelölt képek törlése'; 606 605 $lang['%d photo was deleted'] = '%d kép törölve'; -
trunk/language/pl_PL/admin.lang.php
r6676 r6873 753 753 $lang['Who can see this photo?'] = 'Kto może oglądać o zdjęcie?'; 754 754 $lang['Pending Comments'] = 'Oczekujące komentarze'; 755 $lang['Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'] = 'Info: usunięcie zdjęcia nie dotyczy zdjęć dodanych podczas synchroniazacji. Zdjęcia dodanew ten sposób należy usunąć z systemu plików, a następnie wykonać synchronizację.';756 755 $lang['In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting'] = 'W twoim pliku php.ini, parametr upload_max_filesize (%sB) jest większy niż post_max_size (%sB), powinieneś zmienić toe ustawienia'; 757 756 $lang['Exif extension not available, admin should disable exif use'] = 'Rozszerzenie exif jest nie dostępne, administrato powinien usunąć korzystanie z exif';
Note: See TracChangeset
for help on using the changeset viewer.