* @uses access_api.php * @uses authentication_api.php * @uses config_api.php * @uses form_api.php * @uses gpc_api.php * @uses plugin_api.php * @uses print_api.php */ /** @ignore */ define('PLUGINS_DISABLED', true); /** * MantisBT Core API's */ require_once 'core.php'; require_api('access_api.php'); require_api('authentication_api.php'); require_api('config_api.php'); require_api('form_api.php'); require_api('gpc_api.php'); require_api('plugin_api.php'); require_api('print_api.php'); form_security_validate('manage_plugin_upgrade'); auth_reauthenticate(); access_ensure_global_level(config_get('manage_plugin_threshold')); $f_basename = gpc_get_string('name'); $t_plugin = plugin_register($f_basename, true); if (!is_null($t_plugin)) { $t_status = plugin_upgrade($t_plugin); } form_security_purge('manage_plugin_upgrade'); print_successful_redirect('manage_plugin_page.php');
/** * Install a plugin to the database. * @param MantisPlugin $p_plugin Plugin basename. * @return null */ function plugin_install(MantisPlugin $p_plugin) { if (plugin_is_installed($p_plugin->basename)) { error_parameters($p_plugin->basename); trigger_error(ERROR_PLUGIN_ALREADY_INSTALLED, WARNING); return null; } plugin_push_current($p_plugin->basename); if (!$p_plugin->install()) { plugin_pop_current(); return null; } db_param_push(); $t_query = 'INSERT INTO {plugin} ( basename, enabled ) VALUES ( ' . db_param() . ', ' . db_param() . ' )'; db_query($t_query, array($p_plugin->basename, true)); if (false === plugin_config_get('schema', false)) { plugin_config_set('schema', -1); } plugin_upgrade($p_plugin); plugin_pop_current(); }
/** * Install a plugin to the database. * @param string Plugin basename */ function plugin_install($p_plugin) { access_ensure_global_level(config_get_global('manage_plugin_threshold')); if (plugin_is_installed($p_plugin->basename)) { trigger_error(ERROR_PLUGIN_ALREADY_INSTALLED, WARNING); return null; } plugin_push_current($p_plugin->basename); if (!$p_plugin->install()) { plugin_pop_current($p_plugin->basename); return null; } $t_plugin_table = db_get_table('plugin'); $t_query = "INSERT INTO {$t_plugin_table} ( basename, enabled )\n\t\t\t\tVALUES ( " . db_param() . ", '1' )"; db_query_bound($t_query, array($p_plugin->basename)); if (false === plugin_config_get('schema', false)) { plugin_config_set('schema', -1); } plugin_upgrade($p_plugin); plugin_pop_current(); }
/** * Install a plugin to the database. * @param MantisPlugin $p_plugin Plugin basename. * @return null */ function plugin_install(MantisPlugin $p_plugin) { access_ensure_global_level(config_get_global('manage_plugin_threshold')); if (plugin_is_installed($p_plugin->basename)) { error_parameters($p_plugin->basename); trigger_error(ERROR_PLUGIN_ALREADY_INSTALLED, WARNING); return null; } plugin_push_current($p_plugin->basename); if (!$p_plugin->install()) { plugin_pop_current(); return null; } $t_query = 'INSERT INTO {plugin} ( basename, enabled ) VALUES ( ' . db_param() . ', \'1\' )'; db_query($t_query, array($p_plugin->basename)); if (false === plugin_config_get('schema', false)) { plugin_config_set('schema', -1); } plugin_upgrade($p_plugin); plugin_pop_current(); }