Last change
on this file since 18314 was
17656,
checked in by mistic100, 12 years ago
|
consolidate upgrade process, always use original filenames
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | include_once(PHPWG_PLUGINS_PATH . 'BatchDownloader/include/install.inc.php'); |
---|
5 | |
---|
6 | function plugin_install() |
---|
7 | { |
---|
8 | batch_download_install(); |
---|
9 | |
---|
10 | define('batch_download_installed', true); |
---|
11 | } |
---|
12 | |
---|
13 | function plugin_activate() |
---|
14 | { |
---|
15 | if (!defined('batch_download_installed')) |
---|
16 | { |
---|
17 | batch_download_install(); |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | function plugin_uninstall() |
---|
22 | { |
---|
23 | global $prefixeTable, $conf; |
---|
24 | |
---|
25 | pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = "batch_download" LIMIT 1;'); |
---|
26 | pwg_query('DROP TABLE IF EXISTS `' . $prefixeTable . 'download_sets`;'); |
---|
27 | pwg_query('DROP TABLE IF EXISTS `' . $prefixeTable . 'download_sets_images`;'); |
---|
28 | |
---|
29 | rrmdir($conf['data_location'].'download_archives/'); |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | if (!function_exists('rrmdir')) |
---|
34 | { |
---|
35 | function rrmdir($dir) |
---|
36 | { |
---|
37 | if (!is_dir($dir)) |
---|
38 | { |
---|
39 | return false; |
---|
40 | } |
---|
41 | $dir = rtrim($dir, '/'); |
---|
42 | $objects = scandir($dir); |
---|
43 | $return = true; |
---|
44 | |
---|
45 | foreach ($objects as $object) |
---|
46 | { |
---|
47 | if ($object !== '.' && $object !== '..') |
---|
48 | { |
---|
49 | $path = $dir.'/'.$object; |
---|
50 | if (filetype($path) == 'dir') |
---|
51 | { |
---|
52 | $return = $return && rrmdir($path); |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | $return = $return && @unlink($path); |
---|
57 | } |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | return $return && @rmdir($dir); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.