aboutsummaryrefslogtreecommitdiffstats
path: root/admin/batch_manager_global.php
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-17 19:08:06 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-17 19:08:06 +0000
commitf7bc47d1f6858ee880950522e32e99a0df31aecf (patch)
treeefd2325572dd57e9e277aab83dc569bce996250e /admin/batch_manager_global.php
parentb58846ff7baa1e0dc32c7257605e88f13bb43c03 (diff)
feature:2259
Add "Regenerate Websize Photos" action. git-svn-id: http://piwigo.org/svn/trunk@10454 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/batch_manager_global.php38
1 files changed, 30 insertions, 8 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 065fa318f..5b61bc9e8 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -43,6 +43,12 @@ foreach ($upload_form_config as $param_shortname => $param)
$form_values[$param_shortname] = $conf[$param_name];
}
+// User cache must not be regenerated during simultaneous ajax requests
+if (!isset($user['need_update']) or !$user['need_update'])
+{
+ getuserdata($user['id'], true);
+}
+
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
@@ -409,12 +415,27 @@ SELECT id, path
array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateSuccess']));
if ($_POST['regenerateError'] != '0')
- array_push($page['warnings'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateError']));
+ array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError']));
+
+ $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality');
+ }
+
+ if ('regenerateWebsize' == $action)
+ {
+ if ($_POST['regenerateSuccess'] != '0')
+ array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess']));
+
+ if ($_POST['regenerateError'] != '0')
+ array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError']));
+
+ $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality');
+ }
+ if (!empty($update_fields))
+ {
// Update configuration
- $fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality');
$updates = array();
- foreach ($fields as $field)
+ foreach ($update_fields as $field)
{
$value = null;
if (!empty($_POST[$field]))
@@ -450,11 +471,6 @@ SELECT id, path
$updates
);
}
- function regenerateThumbnails_prefilter($content, $smarty)
- {
- return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content);
- }
- $template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter');
$template->delete_compiled_templates();
}
@@ -783,6 +799,12 @@ $template->assign(
)
);
+function regenerateThumbnails_prefilter($content, $smarty)
+{
+ return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content);
+}
+$template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter');
+
trigger_action('loc_end_element_set_global');
//----------------------------------------------------------- sending html code