aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-08-01 19:03:17 +0000
committerrvelices <rv-github@modusoptimus.com>2012-08-01 19:03:17 +0000
commit92049de0752eca069cb0dbe97ea5d61406ce0a32 (patch)
tree4d47721538ab63c5fe0df510b2dfb839af735fb8 /admin/include/functions.php
parent56a395e3a4bde205e81053c40efc8e028ada5595 (diff)
merge-r17295 from branch 2.4 feature 2708: in admin, display allowed custom derivatives and ability to delete them
git-svn-id: http://piwigo.org/svn/trunk@17302 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php35
1 files changed, 24 insertions, 11 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 30e178553..cb735d70f 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1569,7 +1569,7 @@ function move_images_to_categories($images, $categories)
{
return false;
}
-
+
// let's first break links with all albums but their "storage album"
$query = '
DELETE '.IMAGE_CATEGORY_TABLE.'.*
@@ -1579,7 +1579,7 @@ DELETE '.IMAGE_CATEGORY_TABLE.'.*
AND (storage_category_id IS NULL OR storage_category_id != category_id)
;';
pwg_query($query);
-
+
if (is_array($categories) and count($categories) > 0)
{
associate_images_to_categories($images, $categories);
@@ -2276,8 +2276,7 @@ SELECT
/** delete all derivative files for one or several types */
function clear_derivative_cache($types='all')
{
- $pattern='#.*-';
- if ($types == 'all')
+ if ($types === 'all')
{
$types = ImageStdParams::get_all_types();
$types[] = IMG_CUSTOM;
@@ -2287,21 +2286,35 @@ function clear_derivative_cache($types='all')
$types = array($types);
}
- if (count($types)>1)
+ for ($i=0; $i<count($types); $i++)
{
- $type_urls = array();
- foreach($types as $dtype)
+ $type = $types[$i];
+ if ($type == IMG_CUSTOM)
{
- $type_urls[] = derivative_to_url($dtype);
+ $type = derivative_to_url($type).'[a-zA-Z0-9]+';
}
- $pattern .= '(' . implode('|',$type_urls) . ')';
+ elseif (in_array($type, ImageStdParams::get_all_types()))
+ {
+ $type = derivative_to_url($type);
+ }
+ else
+ {//assume a custom type
+ $type = derivative_to_url(IMG_CUSTOM).'_'.$type;
+ }
+ $types[$i] = $type;
+ }
+
+ $pattern='#.*-';
+ if (count($types)>1)
+ {
+ $pattern .= '(' . implode('|',$types) . ')';
}
else
{
- $pattern .= derivative_to_url($types[0]);
+ $pattern .= $types[0];
}
+ $pattern.='\.[a-zA-Z0-9]{3,4}$#';
- $pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#';
if ($contents = @opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR))
{
while (($node = readdir($contents)) !== false)