Project

General

Profile

« Previous | Next » 

Revision 938

Added by doc almost 16 years ago

added option to invoke module upgrade.php/uninstall.php files from backend (for modules uploaded via FTP)

View differences:

index.php
45 45
}
46 46

  
47 47
// Insert modules which includes a install.php file to install list
48
$module_files = glob(WB_PATH . '/modules/*');
48 49
$template->set_block('main_block', 'install_list_block', 'install_list');
49
$module_files = glob(WB_PATH . '/modules/*');
50
$template->set_block('main_block', 'upgrade_list_block', 'upgrade_list');
51
$template->set_block('main_block', 'uninstall_list_block', 'uninstall_list');
52
$template->set_var(array('INSTALL_VISIBLE' => 'hide', 'UPGRADE_VISIBLE' => 'hide', 'UNINSTALL_VISIBLE' => 'hide'));
53

  
54
$show_block = false;
50 55
foreach ($module_files as $index => $path) {
51
	if (is_dir($path) && file_exists($path . '/install.php')) {
52
		$template->set_var('VALUE', basename($path));
53
		$template->set_var('NAME', basename($path));
54
		$template->parse('install_list', 'install_list_block', true);
56
	if (is_dir($path)) {
57
		if (file_exists($path . '/install.php')) {
58
			$show_block = true;
59
			$template->set_var('INSTALL_VISIBLE', '');
60
			$template->set_var('VALUE', basename($path));
61
			$template->set_var('NAME', basename($path));
62
			$template->parse('install_list', 'install_list_block', true);
63
		}
64

  
65
		if (file_exists($path . '/upgrade.php')) {
66
			$show_block = true;
67
			$template->set_var('UPGRADE_VISIBLE', '');
68
			$template->set_var('VALUE', basename($path));
69
			$template->set_var('NAME', basename($path));
70
			$template->parse('upgrade_list', 'upgrade_list_block', true);
71
		} 
72
		
73
		if (file_exists($path . '/uninstall.php')) {
74
			$show_block = true;
75
			$template->set_var('UNINSTALL_VISIBLE', '');
76
			$template->set_var('VALUE', basename($path));
77
			$template->set_var('NAME', basename($path));
78
			$template->parse('uninstall_list', 'uninstall_list_block', true);
79
		}
80

  
55 81
	} else {
56 82
		unset($module_files[$index]);
57 83
	}
......
67 93
if($admin->get_permission('modules_view') != true) {
68 94
	$template->set_var('DISPLAY_LIST', 'hide');
69 95
}
70
// only show if at least one module folder contains a install.php file and permissions to admin section exists
71
if(count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
96
// only show block if there is something to show
97
if(!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
72 98
	$template->set_var('DISPLAY_MANUAL_INSTALL', 'hide');
73 99
}
74 100

  
......
77 103
								'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'],
78 104
								'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'],
79 105
								'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS'],
80
								'HEADING_MANUAL_MODULE_INSTALLATION' => $HEADING['MANUAL_MODULE_INSTALLATION']
106
								'HEADING_INVOKE_MODULE_FILES' => $HEADING['INVOKE_MODULE_FILES']
81 107
								)
82 108
						);
83 109
// Insert language text and messages
......
94 120
	'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
95 121
	'TEXT_MANUAL_INSTALLATION' => $MESSAGE['ADDON']['MANUAL_INSTALLATION'],
96 122
	'TEXT_MANUAL_INSTALLATION_WARNING' => $MESSAGE['ADDON']['MANUAL_INSTALLATION_WARNING'],
97
	'TEXT_RELOAD' => $TEXT['RELOAD']
123
	'TEXT_EXECUTE' => $TEXT['EXECUTE'],
124
	'TEXT_FILE' => $TEXT['FILE']
98 125
	)
99 126
);
100 127

  

Also available in: Unified diff