aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-01-01 21:10:43 +0000
committerrvelices <rv-github@modusoptimus.com>2012-01-01 21:10:43 +0000
commit95a78ca0d3412ffa1d54e13c9caab7bc8b6b0e13 (patch)
treee6fe20dc51fbd1efefbd0d11aa9d0893b470891e /admin/include/functions.php
parentec82ebbdccf9340d9168d8c061e94e52100aa8f1 (diff)
feature 2541 multisize
- admin GUI for choosing derivative parameters + persistence git-svn-id: http://piwigo.org/svn/trunk@12820 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r--admin/include/functions.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 85ee0f4f2..0669c8d6d 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -2054,6 +2054,7 @@ function get_active_menu($menu_page)
return 4;
case 'configuration':
+ case 'derivatives':
case 'extend_for_templates':
case 'menubar':
case 'themes':
@@ -2247,23 +2248,34 @@ SELECT
return array_from_query($query, 'user_id');
}
-function clear_derivative_cache($type='all')
+/** delete all derivative files for one or several types */
+function clear_derivative_cache($types='all')
{
$pattern='#.*-';
- if ($type == 'all')
+ if ($types == 'all')
+ {
+ $types = ImageStdParams::get_all_types();
+ $types[] = IMG_CUSTOM;
+ }
+ elseif (!is_array($types))
+ {
+ $types = array($types);
+ }
+
+ if (count($types)>1)
{
$type_urls = array();
- foreach(ImageStdParams::get_all_types() as $dtype)
+ foreach($types as $dtype)
{
$type_urls[] = derivative_to_url($dtype);
}
- $type_urls[] = derivative_to_url(IMG_CUSTOM);
$pattern .= '(' . implode('|',$type_urls) . ')';
}
else
{
- $pattern .= derivative_to_url($type);
+ $pattern .= derivative_to_url($types[0]);
}
+
$pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#';
if ($contents = opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR))
{
@@ -2320,7 +2332,7 @@ function clear_derivative_cache_rec($path, $pattern)
unlink($path.'/index.htm');
}
clearstatcache();
- rmdir($path);
+ @rmdir($path);
}
return $rmdir;
}