source:
extensions/BatchDownloader/maintain.inc.php
@
18358
Last change on this file since 18358 was 17656, checked in by , 12 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[16379] | 1 | <?php |
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); | |
3 | ||
[17656] | 4 | include_once(PHPWG_PLUGINS_PATH . 'BatchDownloader/include/install.inc.php'); |
[16379] | 5 | |
6 | function plugin_install() | |
7 | { | |
[17656] | 8 | batch_download_install(); |
[16379] | 9 | |
[17656] | 10 | define('batch_download_installed', true); |
[16379] | 11 | } |
12 | ||
13 | function plugin_activate() | |
14 | { | |
[17656] | 15 | if (!defined('batch_download_installed')) |
[16379] | 16 | { |
[17656] | 17 | batch_download_install(); |
[16379] | 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 | ||
[17656] | 32 | |
33 | if (!function_exists('rrmdir')) | |
[16379] | 34 | { |
[17656] | 35 | function rrmdir($dir) |
[16379] | 36 | { |
[17656] | 37 | if (!is_dir($dir)) |
[16379] | 38 | { |
[17656] | 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 !== '..') | |
[16379] | 48 | { |
[17656] | 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 | } | |
[16379] | 58 | } |
59 | } | |
[17656] | 60 | |
61 | return $return && @rmdir($dir); | |
[16379] | 62 | } |
[17656] | 63 | } |
[16379] | 64 | |
65 | ?> |
Note: See TracBrowser
for help on using the repository browser.