Ignore:
Timestamp:
Aug 1, 2012, 9:03:17 PM (12 years ago)
Author:
rvelices
Message:

merge-r17295 from branch 2.4 feature 2708: in admin, display allowed custom derivatives and ability to delete them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r17210 r17302  
    15701570    return false;
    15711571  }
    1572  
     1572
    15731573  // let's first break links with all albums but their "storage album"
    15741574  $query = '
     
    15801580;';
    15811581  pwg_query($query);
    1582    
     1582
    15831583  if (is_array($categories) and count($categories) > 0)
    15841584  {
     
    22772277function clear_derivative_cache($types='all')
    22782278{
    2279   $pattern='#.*-';
    2280   if ($types == 'all')
     2279  if ($types === 'all')
    22812280  {
    22822281    $types = ImageStdParams::get_all_types();
     
    22882287  }
    22892288
     2289  for ($i=0; $i<count($types); $i++)
     2290  {
     2291    $type = $types[$i];
     2292    if ($type == IMG_CUSTOM)
     2293    {
     2294      $type = derivative_to_url($type).'[a-zA-Z0-9]+';
     2295    }
     2296    elseif (in_array($type, ImageStdParams::get_all_types()))
     2297    {
     2298      $type = derivative_to_url($type);
     2299    }
     2300    else
     2301    {//assume a custom type
     2302      $type = derivative_to_url(IMG_CUSTOM).'_'.$type;
     2303    }
     2304    $types[$i] = $type;
     2305  }
     2306
     2307  $pattern='#.*-';
    22902308  if (count($types)>1)
    22912309  {
    2292     $type_urls = array();
    2293     foreach($types as $dtype)
    2294     {
    2295       $type_urls[] = derivative_to_url($dtype);
    2296     }
    2297     $pattern .= '(' . implode('|',$type_urls) . ')';
     2310    $pattern .= '(' . implode('|',$types) . ')';
    22982311  }
    22992312  else
    23002313  {
    2301     $pattern .= derivative_to_url($types[0]);
    2302   }
    2303 
    2304   $pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#';
     2314    $pattern .= $types[0];
     2315  }
     2316  $pattern.='\.[a-zA-Z0-9]{3,4}$#';
     2317
    23052318  if ($contents = @opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR))
    23062319  {
Note: See TracChangeset for help on using the changeset viewer.