mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
MDL-17457 removed all statements from main install.xml, some more improvements
This commit is contained in:
parent
117679db37
commit
c20ce8742a
@ -71,7 +71,7 @@
|
||||
|
||||
$version = null;
|
||||
$release = null;
|
||||
include("$CFG->dirroot/version.php"); // defines $version and $release
|
||||
require("$CFG->dirroot/version.php"); // defines $version and $release
|
||||
|
||||
if (!$version or !$release) {
|
||||
print_error('withoutversion', 'debug'); // without version, stop
|
||||
@ -122,12 +122,7 @@
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
|
||||
echo '<form action="index.php"><div>';
|
||||
echo '<input type="hidden" name="agreelicense" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
print_continue('index.php?agreelicense=1&confirmrelease=1');
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
@ -157,7 +152,10 @@
|
||||
|
||||
/// set all core default records and default settings
|
||||
require_once("$CFG->libdir/db/install.php");
|
||||
xmldb_main_install($version);
|
||||
xmldb_main_install();
|
||||
|
||||
/// store version
|
||||
upgrade_main_savepoint(true, $version, false);
|
||||
|
||||
/// Continue with the instalation
|
||||
|
||||
@ -171,7 +169,7 @@
|
||||
message_update_providers();
|
||||
message_update_providers('message');
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// Write default settings unconditionally
|
||||
admin_apply_default_settings(NULL, true);
|
||||
notify($strdatabasesuccess, 'notifysuccess');
|
||||
print_upgrade_separator();
|
||||
|
@ -17,6 +17,36 @@ require_once($CFG->libdir.'/messagelib.php'); // Messagelib functions
|
||||
define('INSECURE_DATAROOT_WARNING', 1);
|
||||
define('INSECURE_DATAROOT_ERROR', 2);
|
||||
|
||||
/**
|
||||
* Insert or update log display entry. Entry may already exist.
|
||||
* $module, $action must be unique
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $action
|
||||
* @param string $mtable
|
||||
* @param string $field
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
function upgrade_log_display_entry($module, $action, $mtable, $field) {
|
||||
global $DB;
|
||||
|
||||
if ($type = $DB->get_record('log_display', array('module'=>$module, 'action'=>$action))) {
|
||||
$type->mtable = $mtable;
|
||||
$type->field = $field;
|
||||
$DB->update_record('log_display', $type);
|
||||
|
||||
} else {
|
||||
$type = new object();
|
||||
$type->module = $module;
|
||||
$type->action = $action;
|
||||
$type->mtable = $mtable;
|
||||
$type->field = $field;
|
||||
|
||||
$DB->insert_record('log_display', $type, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade savepoint, marks end of each upgrade block.
|
||||
* It stores new main version, resets upgrade timeout
|
||||
@ -27,9 +57,10 @@ define('INSECURE_DATAROOT_ERROR', 2);
|
||||
*
|
||||
* @param bool $result false if upgrade step failed, true if completed
|
||||
* @param string or float $version main version
|
||||
* @param bool $allowabort allow user to abort script execution here
|
||||
* @return void
|
||||
*/
|
||||
function upgrade_main_savepoint($result, $version) {
|
||||
function upgrade_main_savepoint($result, $version, $allowabort=true) {
|
||||
global $CFG;
|
||||
|
||||
if ($result) {
|
||||
@ -39,14 +70,14 @@ function upgrade_main_savepoint($result, $version) {
|
||||
}
|
||||
set_config('version', $version);
|
||||
} else {
|
||||
notify ("Upgrade savepoint: Error during main upgrade to version $version");
|
||||
error("Upgrade savepoint: Error during main upgrade to version $version"); // TODO: localise
|
||||
}
|
||||
|
||||
// reset upgrade timeout to default
|
||||
upgrade_set_timeout();
|
||||
|
||||
// this is a safe place to stop upgrades if user aborts page loading
|
||||
if (connection_aborted()) {
|
||||
if ($allowabort and connection_aborted()) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
@ -54,13 +85,15 @@ function upgrade_main_savepoint($result, $version) {
|
||||
/**
|
||||
* Module upgrade savepoint, marks end of module upgrade blocks
|
||||
* It stores module version, resets upgrade timeout
|
||||
* and abort upgrade if usercancels page loading.
|
||||
* and abort upgrade if user cancels page loading.
|
||||
*
|
||||
* @param bool $result false if upgrade step failed, true if completed
|
||||
* @param string or float $version main version
|
||||
* @param string $modname name of module
|
||||
* @param bool $allowabort allow user to abort script execution here
|
||||
* @return void
|
||||
*/
|
||||
function upgrade_mod_savepoint($result, $version, $modname) {
|
||||
function upgrade_mod_savepoint($result, $version, $modname, $allowabort=true) {
|
||||
global $DB;
|
||||
|
||||
if (!$module = $DB->get_record('modules', array('name'=>$modname))) {
|
||||
@ -75,19 +108,30 @@ function upgrade_mod_savepoint($result, $version, $modname) {
|
||||
$module->version = $version;
|
||||
$DB->update_record('modules', $module);
|
||||
} else {
|
||||
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
||||
error("Upgrade savepoint: Error during mod upgrade to version $version"); // TODO: localise
|
||||
}
|
||||
|
||||
// reset upgrade timeout to default
|
||||
upgrade_set_timeout();
|
||||
|
||||
// this is a safe place to stop upgrades if user aborts page loading
|
||||
if (connection_aborted()) {
|
||||
if ($allowabort and connection_aborted()) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
function upgrade_blocks_savepoint($result, $version, $blockname) {
|
||||
/**
|
||||
* Blocks upgrade savepoint, marks end of blocks upgrade blocks
|
||||
* It stores block version, resets upgrade timeout
|
||||
* and abort upgrade if user cancels page loading.
|
||||
*
|
||||
* @param bool $result false if upgrade step failed, true if completed
|
||||
* @param string or float $version main version
|
||||
* @param string $blockname name of block
|
||||
* @param bool $allowabort allow user to abort script execution here
|
||||
* @return void
|
||||
*/
|
||||
function upgrade_blocks_savepoint($result, $version, $blockname, $allowabort=true) {
|
||||
global $DB;
|
||||
|
||||
if (!$block = $DB->get_record('block', array('name'=>$blockname))) {
|
||||
@ -102,19 +146,31 @@ function upgrade_blocks_savepoint($result, $version, $blockname) {
|
||||
$block->version = $version;
|
||||
$DB->update_record('block', $block);
|
||||
} else {
|
||||
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
||||
error("Upgrade savepoint: Error during mod upgrade to version $version"); // TODO: localise
|
||||
}
|
||||
|
||||
// reset upgrade timeout to default
|
||||
upgrade_set_timeout();
|
||||
|
||||
// this is a safe place to stop upgrades if user aborts page loading
|
||||
if (connection_aborted()) {
|
||||
if ($allowabort and connection_aborted()) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
function upgrade_plugin_savepoint($result, $version, $type, $dir) {
|
||||
/**
|
||||
* Plugins upgrade savepoint, marks end of blocks upgrade blocks
|
||||
* It stores plugin version, resets upgrade timeout
|
||||
* and abort upgrade if user cancels page loading.
|
||||
*
|
||||
* @param bool $result false if upgrade step failed, true if completed
|
||||
* @param string or float $version main version
|
||||
* @param string $type name of plugin
|
||||
* @param string $dir location of plugin
|
||||
* @param bool $allowabort allow user to abort script execution here
|
||||
* @return void
|
||||
*/
|
||||
function upgrade_plugin_savepoint($result, $version, $type, $dir, $allowabort=true) {
|
||||
if ($result) {
|
||||
$fullname = $type . '_' . $dir;
|
||||
$installedversion = get_config($fullname, 'version');
|
||||
@ -127,14 +183,14 @@ function upgrade_plugin_savepoint($result, $version, $type, $dir) {
|
||||
}
|
||||
set_config('version', $version, $fullname);
|
||||
} else {
|
||||
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
||||
error("Upgrade savepoint: Error during mod upgrade to version $version"); // TODO: localise
|
||||
}
|
||||
|
||||
// Reset upgrade timeout to default
|
||||
upgrade_set_timeout();
|
||||
|
||||
// This is a safe place to stop upgrades if user aborts page loading
|
||||
if (connection_aborted()) {
|
||||
if ($allowabort and connection_aborted()) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
// This file is executed right after the install.xml
|
||||
//
|
||||
|
||||
function xmldb_main_install($version) {
|
||||
function xmldb_main_install() {
|
||||
global $CFG, $DB, $SITE;
|
||||
|
||||
/// TODO: move all statements from install.xml here
|
||||
@ -91,12 +91,45 @@ function xmldb_main_install($version) {
|
||||
$mnetid = $DB->insert_record('mnet_host', $mnethost);
|
||||
set_config('mnet_localhost_id', $mnetid);
|
||||
|
||||
// Initial insert of mnet applications info
|
||||
$mnet_app = new object();
|
||||
$mnet_app->name = 'moodle';
|
||||
$mnet_app->display_name = 'Moodle';
|
||||
$mnet_app->xmlrpc_server_url = '/mnet/xmlrpc/server.php';
|
||||
$mnet_app->sso_land_url = '/auth/mnet/land.php';
|
||||
$mnet_app->sso_jump_url = '/auth/mnet/land.php';
|
||||
$DB->insert_record('mnet_application', $mnet_app);
|
||||
|
||||
$mnet_app = new object();
|
||||
$mnet_app->name = 'mahara';
|
||||
$mnet_app->display_name = 'Mahara';
|
||||
$mnet_app->xmlrpc_server_url = '/api/xmlrpc/server.php';
|
||||
$mnet_app->sso_land_url = '/auth/xmlrpc/land.php';
|
||||
$mnet_app->sso_jump_url = '/auth/xmlrpc/jump.php';
|
||||
$DB->insert_record('mnet_application', $mnet_app);
|
||||
|
||||
/// insert log entries - replaces statements section in install.xml
|
||||
upgrade_log_display_entry('user', 'view', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('course', 'user report', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('course', 'view', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'update', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'enrol', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'unenrol', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'report log', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'report live', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'report outline', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'report participation', 'course', 'fullname');
|
||||
upgrade_log_display_entry('course', 'report stats', 'course', 'fullname');
|
||||
upgrade_log_display_entry('message', 'write', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('message', 'read', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('message', 'add contact', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('message', 'remove contact', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('message', 'block contact', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('message', 'unblock contact', 'user', 'CONCAT(firstname,\' \',lastname)');
|
||||
upgrade_log_display_entry('group', 'view', 'groups', 'name');
|
||||
|
||||
|
||||
/// Create guest record
|
||||
create_guest_record();
|
||||
|
||||
|
||||
/// everything ready - store main version :-D
|
||||
set_config('version', $version);
|
||||
|
||||
}
|
@ -2122,34 +2122,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
<STATEMENTS>
|
||||
<STATEMENT NAME="insert mnet_application" TYPE="insert" TABLE="mnet_application" COMMENT="Initial insert of records on table mnet_application" NEXT="insert log_display">
|
||||
<SENTENCES>
|
||||
<SENTENCE TEXT="(name, display_name, xmlrpc_server_url, sso_land_url, sso_jump_url) VALUES ('moodle','Moodle','/mnet/xmlrpc/server.php', '/auth/mnet/land.php', '/auth/mnet/jump.php')" />
|
||||
<SENTENCE TEXT="(name, display_name, xmlrpc_server_url, sso_land_url, sso_jump_url) VALUES ('mahara','Mahara','/api/xmlrpc/server.php', '/auth/xmlrpc/land.php', '/auth/xmlrpc/jump.php')" />
|
||||
</SENTENCES>
|
||||
</STATEMENT>
|
||||
<STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display" PREVIOUS="insert mnet_application">
|
||||
<SENTENCES>
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'view', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'update', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'enrol', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'unenrol', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'write', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'read', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('group', 'view', 'groups', 'name')" />
|
||||
</SENTENCES>
|
||||
</STATEMENT>
|
||||
</STATEMENTS>
|
||||
</XMLDB>
|
Loading…
x
Reference in New Issue
Block a user