Ignore:
Timestamp:
Mar 20, 2012, 11:32:30 PM (12 years ago)
Author:
patdenice
Message:

Compatible with Piwigo 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GThumb/maintain.inc.php

    r12758 r13652  
    1515function plugin_uninstall()
    1616{
    17   include_once(dirname(__FILE__).'/functions.inc.php');
    18   gtdeltree(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'GThumb');
     17  if (is_dir(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'GThumb'))
     18  {
     19    gtdeltree(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'GThumb');
     20  }
    1921 
    2022  $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="GThumb" LIMIT 1;';
     
    2426function plugin_activate($plugin_id, $version)
    2527{
    26   if (in_array($version, array('2.3.a', '2.3.b')))
     28  if (is_dir(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'GThumb'))
    2729  {
    28     include_once(PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/functions.inc.php');
    2930    gtdeltree(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'GThumb');
    3031  }
    3132}
    3233
     34function gtdeltree($path)
     35{
     36  if (is_dir($path))
     37  {
     38    $fh = opendir($path);
     39    while ($file = readdir($fh))
     40    {
     41      if ($file != '.' and $file != '..')
     42      {
     43        $pathfile = $path . '/' . $file;
     44        if (is_dir($pathfile))
     45        {
     46          gtdeltree($pathfile);
     47        }
     48        else
     49        {
     50          @unlink($pathfile);
     51        }
     52      }
     53    }
     54    closedir($fh);
     55    return @rmdir($path);
     56  }
     57}
     58
    3359?>
Note: See TracChangeset for help on using the changeset viewer.