Skip to content

Commit

Permalink
MDL-20636 Merge remote-tracking branch 'moodle/master' into upgrade
Browse files Browse the repository at this point in the history
Conflicts:
	lib/filestorage/file_storage.php
	mod/quiz/attemptlib.php
	mod/quiz/lib.php
	mod/quiz/mod_form.php
	mod/quiz/report/overview/overview_table.php
	mod/quiz/report/overview/report.php
	mod/quiz/report/responses/report.php
	mod/quiz/report/responses/responses_table.php
	mod/quiz/report/statistics/db/install.xml
	mod/quiz/report/statistics/qstats.php
	mod/quiz/report/statistics/report.php
	mod/quiz/report/statistics/statistics_question_table.php
	mod/quiz/report/statistics/statistics_table.php
	mod/quiz/report/statistics/version.php
	mod/quiz/review.php
	mod/quiz/reviewquestion.php
	mod/quiz/startattempt.php
	mod/quiz/styles.css
	mod/quiz/view.php
	question/type/essay/questiontype.php
	question/type/match/backup/moodle2/backup_qtype_match_plugin.class.php
	question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php
	question/type/numerical/display.html
	question/type/numerical/questiontype.php
	question/type/questiontype.php
	question/type/random/questiontype.php
	question/type/shortanswer/questiontype.php
	theme/base/style/question.css
  • Loading branch information
timhunt committed May 11, 2011
2 parents fca599a + de58499 commit a2ac234
Show file tree
Hide file tree
Showing 1,225 changed files with 22,756 additions and 8,521 deletions.
6 changes: 5 additions & 1 deletion admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@

$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
if (file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
$blocksettings = admin_get_root()->locate('blocksetting' . $block->name);

if ($blocksettings instanceof admin_externalpage) {
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
} else if ($blocksettings instanceof admin_settingpage) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
Expand Down
4 changes: 2 additions & 2 deletions admin/bloglevelupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ function bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid=-1) {
$discussion->course = $forum->course;
$discussion->forum = $forum->id;
$discussion->name = $blogentry->subject;
$discussion->intro = $blogentry->summary;
$discussion->assessed = $forum->assessed;
$discussion->messageformat = $forum->introformat;
$discussion->message = $blogentry->summary;
$discussion->messageformat = $blogentry->summaryformat;
$discussion->messagetrust = 0;
$discussion->attachments = 0;
$discussion->mailnow = false;
Expand Down
60 changes: 38 additions & 22 deletions admin/cli/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
problem encountered.
--agree-license Indicates agreement with software license,
required in non-interactive mode.
--allow-unstable Install even if the version is not marked as stable yet,
required in non-interactive mode.
-h, --help Print out this help
Example:
Expand Down Expand Up @@ -136,9 +138,6 @@
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
$CFG->admin = array_pop($parts);

require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;

//point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
//the problem is that we need specific version of quickforms and hacked excel files :-(
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
Expand All @@ -154,6 +153,9 @@
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');

require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;

//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
Expand Down Expand Up @@ -193,6 +195,7 @@
'adminpass' => '',
'non-interactive' => false,
'agree-license' => false,
'allow-unstable' => false,
'help' => false
),
array(
Expand Down Expand Up @@ -373,25 +376,16 @@
}
}

//download lang pack with optional notification
if ($CFG->lang != 'en') {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
if ($cd->install() == COMPONENT_ERROR) {
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string($cd->get_error(), 'error', $a));
} else {
cli_problem(get_string($cd->get_error(), 'error'));
}
} else {
// install parent lang if defined
if ($parentlang = get_parent_language()) {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
$cd->install();
}
}
// download required lang packs
if ($CFG->lang !== 'en') {
$installer = new lang_installer($CFG->lang);
$results = $installer->run();
foreach ($results as $langcode => $langstatus) {
if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) {
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string('remotedownloaderror', 'error', $a));
}
}
}
Expand All @@ -402,6 +396,28 @@
$CFG->langlocalroot = $CFG->dataroot.'/lang';
get_string_manager(true);

// make sure we are installing stable release or require a confirmation
if (isset($maturity)) {
if (($maturity < MATURITY_STABLE) and !$options['allow-unstable']) {
$maturitylevel = get_string('maturity'.$maturity, 'admin');

if ($interactive) {
cli_separator();
cli_heading(get_string('notice'));
echo get_string('maturitycorewarning', 'admin', $maturitylevel) . PHP_EOL;
echo get_string('morehelp') . ': ' . get_docs_url('admin/versions') . PHP_EOL;
echo get_string('continue') . PHP_EOL;
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
} else {
cli_error(get_string('maturitycorewarning', 'admin'));
}
}
}

// ask for db type - show only drivers available
if ($interactive) {
$options['dbtype'] = strtolower($options['dbtype']);
Expand Down
29 changes: 10 additions & 19 deletions admin/cli/install_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,17 @@
}
$CFG->lang = $options['lang'];

//download lang pack with optional notification
if ($CFG->lang != 'en') {
// download required lang packs
if ($CFG->lang !== 'en') {
make_upload_directory('lang');
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
if ($cd->install() == COMPONENT_ERROR) {
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string($cd->get_error(), 'error', $a));
} else {
cli_problem(get_string($cd->get_error(), 'error'));
}
} else {
// install parent lang if defined
if ($parentlang = get_parent_language()) {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
$cd->install();
}
}
$installer = new lang_installer($CFG->lang);
$results = $installer->run();
foreach ($results as $langcode => $langstatus) {
if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) {
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string('remotedownloaderror', 'error', $a));
}
}
}
Expand Down
43 changes: 39 additions & 4 deletions admin/cli/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@


// now get cli options
list($options, $unrecognized) = cli_get_params(array('non-interactive'=>false, 'help'=>false),
array('h'=>'help'));
list($options, $unrecognized) = cli_get_params(
array(
'non-interactive' => false,
'allow-unstable' => false,
'help' => false
),
array(
'h' => 'help'
)
);

$interactive = empty($options['non-interactive']);

Expand All @@ -59,6 +67,8 @@
Options:
--non-interactive No interactive questions or confirmations
--allow-unstable Upgrade even if the version is not marked as stable yet,
required in non-interactive mode.
-h, --help Print out this help
Example:
Expand All @@ -73,17 +83,18 @@
cli_error(get_string('missingconfigversion', 'debug'));
}

require("$CFG->dirroot/version.php"); // defines $version and $release
require("$CFG->dirroot/version.php"); // defines $version, $release and $maturity
$CFG->target_release = $release; // used during installation and upgrades

if ($version < $CFG->version) {
cli_error(get_string('downgradedcore', 'error'));
}

$oldversion = "$CFG->release ($CFG->version)";
$newversion = "$release ($version)";

// test environment first
if (!check_moodle_environment($version, $environment_results, false, ENV_SELECT_RELEASE)) {
if (!check_moodle_environment(normalize_version($release), $environment_results, false, ENV_SELECT_RELEASE)) {
$errors = environment_get_errors($environment_results);
cli_heading(get_string('environment', 'admin'));
foreach ($errors as $error) {
Expand All @@ -93,6 +104,30 @@
exit(1);
}

if ($interactive) {
$a = new stdClass();
$a->oldversion = $oldversion;
$a->newversion = $newversion;
echo cli_heading(get_string('databasechecking', '', $a)) . PHP_EOL;
}

// make sure we are upgrading to a stable release or display a warning
if (isset($maturity)) {
if (($maturity < MATURITY_STABLE) and !$options['allow-unstable']) {
$maturitylevel = get_string('maturity'.$maturity, 'admin');

if ($interactive) {
cli_separator();
cli_heading(get_string('notice'));
echo get_string('maturitycorewarning', 'admin', $maturitylevel) . PHP_EOL;
echo get_string('morehelp') . ': ' . get_docs_url('admin/versions') . PHP_EOL;
cli_separator();
} else {
cli_error(get_string('maturitycorewarning', 'admin', $maturitylevel));
}
}
}

if ($interactive) {
echo html_to_text(get_string('upgradesure', 'admin', $newversion))."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
Expand Down
114 changes: 114 additions & 0 deletions admin/environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,118 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.1" requires="1.9">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="5.0.25">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
</VENDOR>
<VENDOR name="postgres" version="8.3" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="10.2" />
<VENDOR name="sqlite" version="2.0" />
</DATABASE>
<PHP version="5.3.2" level="required">
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_CHECK message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_CHECK message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="optional">
<FEEDBACK>
<ON_CHECK message="gdrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_CHECK message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_CHECK message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="40M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="safe_mode" value="0" level="optional">
<FEEDBACK>
<ON_CHECK message="settingsafemode" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
</MOODLE>
</COMPATIBILITY_MATRIX>
4 changes: 2 additions & 2 deletions admin/generator.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ public function generate_modules($courses) {
.$this->get('number_of_modules')." modules in each section, for each course...");

list($modules_list_sql, $modules_params) =
$DB->get_in_or_equal($this->get('modules_list'), SQL_PARAMS_NAMED, 'param0000', true);
$DB->get_in_or_equal($this->get('modules_list'), SQL_PARAMS_NAMED, 'mod', true);

list($modules_ignored_sql, $ignore_params) =
$DB->get_in_or_equal($this->modules_to_ignore, SQL_PARAMS_NAMED, 'param2000', false);
$DB->get_in_or_equal($this->modules_to_ignore, SQL_PARAMS_NAMED, 'ignore', false);

$wheresql = "name $modules_list_sql AND name $modules_ignored_sql";
$modules = $DB->get_records_select('modules', $wheresql, array_merge($modules_params, $ignore_params));
Expand Down
Loading

0 comments on commit a2ac234

Please sign in to comment.