Skip to content

Commit

Permalink
MDL-15249 preparation for new cli installer + license header
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed May 25, 2009
1 parent 0c44927 commit 96db14f
Showing 1 changed file with 69 additions and 5 deletions.
74 changes: 69 additions & 5 deletions lib/upgradelib.php
@@ -1,11 +1,27 @@
<?php //$Id$
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* upgradelib.php - Contains functions used during upgrade
* Various upgrade related functions an classes.
*
* @author Martin Dougiamas and many others
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodlecore
* @package moodlecore
* @subpackage upgrade
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

define('UPGRADE_LOG_NORMAL', 0);
Expand Down Expand Up @@ -884,6 +900,54 @@ function print_upgrade_part_end($plugin, $installation) {
print_upgrade_separator();
}

/**
* Silent start upgrade callback - does not output anything
* @param string $plugin
* @param bool $installation true if installation, false menas upgrade
*/
function silent_upgrade_part_start($plugin, $installation) {
if (empty($plugin) or $plugin == 'moodle') {
upgrade_started($installation); // does not store upgrade running flag yet
} else {
upgrade_started();
}
if ($installation) {
if (empty($plugin) or $plugin == 'moodle') {
// no need to log - log table not yet there ;-)
} else {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Starting plugin installation');
}
} else {
if (empty($plugin) or $plugin == 'moodle') {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Starting core upgrade');
} else {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Starting plugin upgrade');
}
}
}

/**
* Silent end upgrade callback - does not output anything
* @param string $plugin
* @param bool $installation true if installation, false menas upgrade
*/
function silent_upgrade_part_end($plugin, $installation) {
upgrade_started();
if ($installation) {
if (empty($plugin) or $plugin == 'moodle') {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Core installed');
} else {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Plugin installed');
}
} else {
if (empty($plugin) or $plugin == 'moodle') {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Core upgraded');
} else {
upgrade_log(UPGRADE_LOG_NORMAL, $plugin, 'Plugin upgraded');
}
}
}

function upgrade_get_javascript() {
global $CFG;
return '<script type="text/javascript" src="'.$CFG->wwwroot.'/lib/scroll_to_page_end.js"></script>';
Expand Down

0 comments on commit 96db14f

Please sign in to comment.