Ignore:
Timestamp:
May 16, 2010, 5:57:12 PM (14 years ago)
Author:
patdenice
Message:

Webmaster status is required to launch any upgrade process.
Display "save template directory" fielset only if Piwigo version < 2.1.
Add random parameter in all_version url (to avoid cache server).
Move empty directory to trash is rmdir fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/trunk/include/functions.inc.php

    r6181 r6196  
    11<?php
    22
    3 function autoupdate_deltree($path)
     3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5function autoupdate_deltree($path, $move_to_trash=false)
    46{
    57  if (is_dir($path))
     
    1315        if (is_dir($pathfile))
    1416        {
    15           autoupdate_deltree($pathfile);
     17          autoupdate_deltree($pathfile, $move_to_trash);
    1618        }
    1719        else
     
    2224    }
    2325    closedir($fh);
    24     return @rmdir($path);
     26    if (@rmdir($path))
     27    {
     28      return true;
     29    }
     30    elseif ($move_to_trash)
     31    {
     32      $trash = PHPWG_ROOT_PATH.'_trash';
     33      if (!is_dir($trash))
     34      {
     35        @mkgetdir($trash);
     36      }
     37      return @rename($path, $trash . '/'.md5(uniqid(rand(), true)));
     38    }
     39    else
     40    {
     41      return false;
     42    }
    2543  }
    2644}
     
    6583      elseif (is_dir($path))
    6684      {
    67         autoupdate_deltree($path);
     85        autoupdate_deltree($path, true);
    6886      }
    6987    }
     
    399417}
    400418
     419if (!function_exists('is_webmaster'))
     420{
     421  function is_webmaster($user_status = '')
     422  {
     423    return is_autorize_status(ACCESS_WEBMASTER, $user_status);
     424  }
     425}
     426
    401427define('AU_DEFAULT_INDEX', file_get_contents(AUTOUPDATE_PATH.'index.php'));
    402428?>
Note: See TracChangeset for help on using the changeset viewer.