Last change
on this file since 22735 was
19832,
checked in by mistic100, 12 years ago
|
make sure temp folder is created on the right place
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | |
---|
5 | function plugin_install() |
---|
6 | { |
---|
7 | global $conf; |
---|
8 | |
---|
9 | mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR); |
---|
10 | } |
---|
11 | |
---|
12 | function plugin_activate() |
---|
13 | { |
---|
14 | global $conf; |
---|
15 | |
---|
16 | if (!file_exists(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/')) |
---|
17 | { |
---|
18 | mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR); |
---|
19 | } |
---|
20 | } |
---|
21 | |
---|
22 | function plugin_uninstall() |
---|
23 | { |
---|
24 | global $conf; |
---|
25 | |
---|
26 | rrmdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/'); |
---|
27 | } |
---|
28 | |
---|
29 | function rrmdir($dir) |
---|
30 | { |
---|
31 | if (!is_dir($dir)) |
---|
32 | { |
---|
33 | return false; |
---|
34 | } |
---|
35 | $dir = rtrim($dir, '/'); |
---|
36 | $objects = scandir($dir); |
---|
37 | $return = true; |
---|
38 | |
---|
39 | foreach ($objects as $object) |
---|
40 | { |
---|
41 | if ($object !== '.' && $object !== '..') |
---|
42 | { |
---|
43 | $path = $dir.'/'.$object; |
---|
44 | if (filetype($path) == 'dir') |
---|
45 | { |
---|
46 | $return = $return && rrmdir($path); |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | $return = $return && @unlink($path); |
---|
51 | } |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | return $return && @rmdir($dir); |
---|
56 | } |
---|
57 | |
---|
58 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.