source: extensions/pbase2piwigo/maintain.inc.php @ 17225

Last change on this file since 17225 was 17225, checked in by ddtddt, 12 years ago

[extensions] - pbase2piwigo - new extension by mistic - first release

File size: 1.3 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4define(
5  'pbase2piwigo_default_config', 
6  serialize(array(
7    ))
8  );
9
10
11function plugin_install() 
12{
13  global $conf;
14 
15  // conf_update_param('pbase2piwigo', pbase2piwigo_default_config);
16 
17  mkdir($conf['data_location'].'pbase_cache/', 0755);
18}
19
20function plugin_activate()
21{
22  global $conf;
23
24  // if (empty($conf['pbase2piwigo']))
25  // {
26    // conf_update_param('pbase2piwigo', pbase2piwigo_default_config);
27  // }
28 
29  if (!file_exists($conf['data_location'].'pbase_cache/'))
30  {
31    mkdir($conf['data_location'].'pbase_cache/', 0755);
32  }
33}
34
35function plugin_uninstall() 
36{
37  // pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "pbase2piwigo" LIMIT 1;');
38 
39  rrmdir($conf['data_location'].'pbase_cache/');
40}
41
42function rrmdir($dir)
43{
44  if (!is_dir($dir))
45  {
46    return false;
47  }
48  $dir = rtrim($dir, '/');
49  $objects = scandir($dir);
50  $return = true;
51 
52  foreach ($objects as $object)
53  {
54    if ($object !== '.' && $object !== '..')
55    {
56      $path = $dir.'/'.$object;
57      if (filetype($path) == 'dir') 
58      {
59        $return = $return && rrmdir($path); 
60      }
61      else 
62      {
63        $return = $return && @unlink($path);
64      }
65    }
66  }
67 
68  return $return && @rmdir($dir);
69} 
70
71?>
Note: See TracBrowser for help on using the repository browser.