function upgrade_plugins($type, $dir, $return) {
global $CFG, $db;
+/// Let's know if the header has been printed, so the funcion is being called embedded in an outer page
+ $embedded = defined('HEADER_PRINTED');
+
$plugs = get_list_of_plugins($dir);
$updated_plugins = false;
$strpluginsetup = get_string('pluginsetup');
$info->pluginversion = $plugin->version;
$info->currentmoodle = $CFG->version;
$info->requiremoodle = $plugin->requires;
- if (!$updated_plugins) {
+ if (!$updated_plugins && !$embedded) {
print_header($strpluginsetup, $strpluginsetup,
build_navigation(array(array('name' => $strpluginsetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
if ($CFG->$pluginversion == $plugin->version) {
// do nothing
} else if ($CFG->$pluginversion < $plugin->version) {
- if (!$updated_plugins) {
+ if (!$updated_plugins && !$embedded) {
print_header($strpluginsetup, $strpluginsetup,
build_navigation(array(array('name' => $strpluginsetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
upgrade_log_finish();
- if ($updated_plugins) {
+ if ($updated_plugins && !$embedded) {
print_continue($return);
print_footer('none');
die;