Permalink
Browse files

Merge remote branch 'origin/master' into rubric

Conflicts:
	lib/db/upgrade.php
  • Loading branch information...
2 parents 72e48ad + 38e9a1c commit 18dd4a69d0886587a52b633e6724a8b7c27effba @mudrd8mz mudrd8mz committed Oct 27, 2011
Showing with 7,459 additions and 27,422 deletions.
  1. +26 −2 admin/cli/install.php
  2. +20 −0 admin/cli/install_database.php
  3. +9 −4 admin/cli/upgrade.php
  4. +99 −127 admin/environment.php
  5. +59 −160 admin/index.php
  6. +1 −8 admin/plugins.php
  7. +638 −11 admin/renderer.php
  8. +0 −3 admin/settings/security.php
  9. +4 −6 blocks/online_users/block_online_users.php
  10. +10 −3 blocks/quiz_results/backup/moodle2/restore_quiz_results_block_task.class.php
  11. +41 −1 blocks/quiz_results/block_quiz_results.php
  12. +4 −1 blocks/quiz_results/edit_form.php
  13. +4 −3 blocks/quiz_results/lang/en/block_quiz_results.php
  14. +1 −1 blocks/quiz_results/styles.css
  15. +16 −1 blocks/quiz_results/version.php
  16. +68 −1 course/externallib.php
  17. +34 −47 course/lib.php
  18. +6 −6 enrol/database/lib.php
  19. +423 −122 enrol/externallib.php
  20. +11 −2 enrol/manual/db/services.php
  21. +45 −5 enrol/manual/externallib.php
  22. +1 −1 enrol/manual/locallib.php
  23. +1 −1 enrol/manual/version.php
  24. +7 −0 enrol/meta/db/events.php
  25. +103 −7 enrol/meta/locallib.php
  26. +1 −1 enrol/meta/version.php
  27. +1 −0 enrol/upgrade.txt
  28. +78 −1 files/externallib.php
  29. +225 −15 group/externallib.php
  30. +31 −0 install/lang/wo/langconfig.php
  31. +1 −0 install/stringnames.txt
  32. +1 −2 lang/en/admin.php
  33. +2 −1 lang/en/install.php
  34. +1 −0 lang/en/moodle.php
  35. +4 −0 lang/en/plugin.php
  36. +1 −1 lang/en/question.php
  37. +3 −2 lang/en/webservice.php
  38. +285 −272 lib/accesslib.php
  39. +0 −196 lib/base32.php
  40. +350 −218 lib/cronlib.php
  41. +0 −89 lib/csshover.htc
  42. +6 −1 lib/datalib.php
  43. +1 −1 lib/db/events.php
  44. +244 −38 lib/db/services.php
  45. +6 −8 lib/db/upgrade.php
  46. +22 −0 lib/dml/simpletest/testdml.php
  47. +10 −3 lib/enrollib.php
  48. +7 −190 lib/environmentlib.php
  49. +1 −1 lib/filestorage/stored_file.php
  50. +2 −1 lib/installlib.php
  51. +0 −712 lib/kses.php
  52. +0 −256 lib/md5.js
  53. +1 −1 lib/messagelib.php
  54. +0 −123 lib/moodlelib.php
  55. +0 −74 lib/odbc.php
  56. +0 −1,491 lib/overlib/overlib.js
  57. +0 −333 lib/overlib/overlib_anchor.js
  58. +0 −89 lib/overlib/overlib_centerpopup.js
  59. +0 −105 lib/overlib/overlib_crossframe.js
  60. +0 −182 lib/overlib/overlib_cssstyle.js
  61. +0 −177 lib/overlib/overlib_debug.js
  62. +0 −123 lib/overlib/overlib_exclusive.js
  63. +0 −175 lib/overlib/overlib_followscroll.js
  64. +0 −135 lib/overlib/overlib_hideform.js
  65. +0 −101 lib/overlib/overlib_setonoff.js
  66. +0 −270 lib/overlib/overlib_shadow.js
  67. +0 −290 lib/pear/Console/Getopt.php
  68. +0 −5 lib/pear/Console/README
  69. +0 −1,654 lib/pear/PHP/CodeSniffer.php
  70. +0 −474 lib/pear/PHP/CodeSniffer/CLI.php
  71. +0 −327 lib/pear/PHP/CodeSniffer/CommentParser/AbstractDocElement.php
  72. +0 −586 lib/pear/PHP/CodeSniffer/CommentParser/AbstractParser.php
  73. +0 −300 lib/pear/PHP/CodeSniffer/CommentParser/ClassCommentParser.php
  74. +0 −240 lib/pear/PHP/CodeSniffer/CommentParser/CommentElement.php
  75. +0 −105 lib/pear/PHP/CodeSniffer/CommentParser/DocElement.php
  76. +0 −196 lib/pear/PHP/CodeSniffer/CommentParser/FunctionCommentParser.php
  77. +0 −86 lib/pear/PHP/CodeSniffer/CommentParser/MemberCommentParser.php
  78. +0 −168 lib/pear/PHP/CodeSniffer/CommentParser/PairElement.php
  79. +0 −326 lib/pear/PHP/CodeSniffer/CommentParser/ParameterElement.php
  80. +0 −72 lib/pear/PHP/CodeSniffer/CommentParser/ParserException.php
  81. +0 −161 lib/pear/PHP/CodeSniffer/CommentParser/SingleElement.php
  82. +0 −191 lib/pear/PHP/CodeSniffer/DocGenerators/Generator.php
  83. +0 −291 lib/pear/PHP/CodeSniffer/DocGenerators/HTML.php
  84. +0 −266 lib/pear/PHP/CodeSniffer/DocGenerators/Text.php
  85. +0 −36 lib/pear/PHP/CodeSniffer/Exception.php
  86. +0 −2,000 lib/pear/PHP/CodeSniffer/File.php
  87. +0 −116 lib/pear/PHP/CodeSniffer/MoodleCLI.php
  88. +0 −94 lib/pear/PHP/CodeSniffer/Sniff.php
  89. +0 −779 lib/pear/PHP/CodeSniffer/Standards/AbstractPatternSniff.php
  90. +0 −213 lib/pear/PHP/CodeSniffer/Standards/AbstractScopeSniff.php
  91. +0 −217 lib/pear/PHP/CodeSniffer/Standards/AbstractVariableSniff.php
  92. +0 −73 lib/pear/PHP/CodeSniffer/Standards/CodingStandard.php
  93. +0 −36 lib/pear/PHP/CodeSniffer/Standards/IncorrectPatternException.php
  94. +0 −54 lib/pear/PHP/CodeSniffer/Standards/Moodle/MoodleCodingStandard.php
  95. +0 −94 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Classes/ClassDeclarationSniff.php
  96. +0 −128 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/EmptyStatementSniff.php
  97. +0 −98 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php
  98. +0 −112 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/ForLoopWithTestFunctionCallSniff.php
  99. +0 −146 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php
  100. +0 −101 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php
  101. +0 −95 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php
  102. +0 −143 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
  103. +0 −185 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php
  104. +0 −231 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Commenting/ClassCommentSniff.php
  105. +0 −805 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Commenting/FileCommentSniff.php
  106. +0 −467 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Commenting/FunctionCommentSniff.php
  107. +0 −65 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Commenting/InlineCommentSniff.php
  108. +0 −63 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/ControlStructures/ControlSignatureSniff.php
  109. +0 −61 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/ControlStructures/ElseIfDeclarationSniff.php
  110. +0 −112 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/ControlStructures/InlineControlStructureSniff.php
  111. +0 −63 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/ClosingPHPTagSniff.php
  112. +0 −129 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/IncludingFileSniff.php
  113. +0 −85 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/LineEndingsSniff.php
  114. +0 −132 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/LineLengthSniff.php
  115. +0 −70 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Formatting/SpaceAfterCastSniff.php
  116. +0 −139 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php
  117. +0 −122 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Functions/FunctionCallSignatureSniff.php
  118. +0 −52 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Functions/FunctionDeclarationSniff.php
  119. +0 −68 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Functions/LowercaseFunctionKeywordsSniff.php
  120. +0 −109 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Functions/ValidDefaultValueSniff.php
  121. +0 −147 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php
  122. +0 −70 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/NamingConventions/ValidClassNameSniff.php
  123. +0 −193 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php
  124. +0 −132 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php
  125. +0 −83 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/PHP/DisallowShortOpenTagSniff.php
  126. +0 −74 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/PHP/LowerCaseConstantSniff.php
  127. +0 −137 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/PHP/LowercasePHPFunctionsSniff.php
  128. +0 −103 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Strings/DoubleQuoteUsageSniff.php
  129. +0 −79 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Strings/EchoedStringsSniff.php
  130. +0 −79 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/WhiteSpace/ControlStructureBlankLineSniff.php
  131. +0 −78 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/WhiteSpace/DisallowTabIndentSniff.php
  132. +0 −119 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/WhiteSpace/MemberVarSpacingSniff.php
  133. +0 −121 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/WhiteSpace/ScopeClosingBraceSniff.php
  134. +0 −303 lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/WhiteSpace/ScopeIndentSniff.php
  135. +0 −718 lib/pear/PHP/CodeSniffer/Tokenizers/JS.php
  136. +0 −398 lib/pear/PHP/CodeSniffer/Tokenizers/PHP.php
  137. +0 −389 lib/pear/PHP/CodeSniffer/Tokens.php
  138. +0 −87 lib/pear/PHP/MoodleCodeSniffer.php
  139. +0 −32 lib/pear/PHP/runsniffer
  140. +0 −5 lib/pear/README.txt
  141. +0 −12 lib/pear/README_MOODLE.txt
  142. +313 −177 lib/pluginlib.php
  143. +0 −477 lib/profilerlib.php
  144. +12 −14 lib/questionlib.php
  145. +5 −10 lib/resourcelib.php
  146. +41 −46 lib/setup.php
  147. +84 −34 lib/setuplib.php
  148. +0 −5 lib/simpletest/testpurifier.php
  149. +0 −5 lib/simpletest/testweblib.php
  150. +0 −784 lib/swfobject/swfobject.js
  151. +2 −44 lib/thirdpartylibs.xml
  152. +944 −806 lib/typo3/class.t3lib_cs.php
  153. +2,462 −1,942 lib/typo3/class.t3lib_div.php
  154. +6 −2 lib/typo3/readme_moodle.txt
  155. +0 −12 lib/upgradelib.php
  156. +11 −160 lib/weblib.php
  157. +87 −48 login/token.php
  158. +44 −5 message/externallib.php
  159. +2 −0 message/lib.php
  160. +6 −1 mod/assignment/renderer.php
  161. +1 −1 mod/feedback/backup/moodle2/restore_feedback_activity_task.class.php
  162. +1 −1 mod/lesson/locallib.php
  163. +42 −42 mod/lesson/pagetypes/matching.php
  164. +29 −1 mod/quiz/processattempt.php
  165. +5 −3 mod/quiz/report/statistics/statistics_table.php
  166. +1 −1 mod/quiz/review.php
  167. +1 −1 mod/resource/lib.php
  168. +11 −11 mod/scorm/userreport.php
  169. +1 −0 mod/url/lang/en/url.php
  170. +6 −0 mod/url/view.php
  171. +42 −1 notes/externallib.php
  172. +14 −11 question/engine/datalib.php
  173. +1 −0 question/engine/lib.php
  174. +1 −0 question/export.php
  175. +44 −30 question/preview.php
  176. +5 −1 question/type/multichoice/edit_multichoice_form.php
  177. +1 −0 question/type/multichoice/lang/en/qtype_multichoice.php
  178. +5 −1 question/type/questiontypebase.php
  179. +2 −2 rss/renderer.php
  180. +5 −0 theme/base/style/admin.css
  181. +182 −174 user/externallib.php
  182. +2 −2 version.php
  183. +25 −20 webservice/amf/testclient/index.php
  184. +53 −5 webservice/externallib.php
  185. +1 −1 webservice/lib.php
  186. +44 −40 webservice/rest/locallib.php
View
@@ -20,7 +20,6 @@
*
* This script is not intended for beginners!
* Potential problems:
- * - environment check is not present yet
* - su to apache account or sudo before execution
* - not compatible with Windows platform
*
@@ -91,7 +90,11 @@
echo "\n\n";
}
- cli_error(get_string('clialreadyinstalled', 'install'));
+ if ($DB->get_manager()->table_exists('config')) {
+ cli_error(get_string('clialreadyinstalled', 'install'));
+ } else {
+ cli_error(get_string('clialreadyconfigured', 'install'));
+ }
}
$olddir = getcwd();
@@ -647,6 +650,27 @@
$CFG->lang = $installlang;
$SESSION->lang = $CFG->lang;
+require("$CFG->dirroot/version.php");
+
+// Test environment first.
+require_once($CFG->libdir . '/environmentlib.php');
+list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
+if (!$envstatus) {
+ $errors = environment_get_errors($environment_results);
+ cli_heading(get_string('environment', 'admin'));
+ foreach ($errors as $error) {
+ list($info, $report) = $error;
+ echo "!! $info !!\n$report\n\n";
+ }
+ exit(1);
+}
+
+// Test plugin dependencies.
+require_once($CFG->libdir . '/pluginlib.php');
+if (!plugin_manager::instance()->all_plugins_ok($version)) {
+ cli_error(get_string('pluginschecktodo', 'admin'));
+}
+
install_cli_database($options, $interactive);
echo get_string('cliinstallfinished', 'install')."\n";
@@ -144,6 +144,26 @@
$CFG->early_install_lang = false;
get_string_manager(true);
+require("$CFG->dirroot/version.php");
+
+// Test environment first.
+require_once($CFG->libdir . '/environmentlib.php');
+list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
+if (!$envstatus) {
+ $errors = environment_get_errors($environment_results);
+ cli_heading(get_string('environment', 'admin'));
+ foreach ($errors as $error) {
+ list($info, $report) = $error;
+ echo "!! $info !!\n$report\n\n";
+ }
+ exit(1);
+}
+
+// Test plugin dependencies.
+require_once($CFG->libdir . '/pluginlib.php');
+if (!plugin_manager::instance()->all_plugins_ok($version)) {
+ cli_error(get_string('pluginschecktodo', 'admin'));
+}
install_cli_database($options, true);
View
@@ -20,7 +20,6 @@
*
* This script is not intended for beginners!
* Potential problems:
- * - environment check is not present yet
* - su to apache account or sudo before execution
* - not compatible with Windows platform
*
@@ -37,7 +36,7 @@
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/environmentlib.php');
-
+require_once($CFG->libdir.'/pluginlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(
@@ -93,8 +92,9 @@
$oldversion = "$CFG->release ($CFG->version)";
$newversion = "$release ($version)";
-// test environment first
-if (!check_moodle_environment(normalize_version($release), $environment_results, false, ENV_SELECT_RELEASE)) {
+// Test environment first.
+list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
+if (!$envstatus) {
$errors = environment_get_errors($environment_results);
cli_heading(get_string('environment', 'admin'));
foreach ($errors as $error) {
@@ -104,6 +104,11 @@
exit(1);
}
+// Test plugin dependencies.
+if (!plugin_manager::instance()->all_plugins_ok($version)) {
+ cli_error(get_string('pluginschecktodo', 'admin'));
+}
+
if ($interactive) {
$a = new stdClass();
$a->oldversion = $oldversion;
View
@@ -1,137 +1,109 @@
<?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/>.
+
+/**
+ * This file is the admin frontend to execute all the checks available
+ * in the environment.xml file. It includes database, php and
+ * php_extensions. Also, it's possible to update the xml file
+ * from moodle.org be able to check more and more versions.
+ *
+ * @package core
+ * @subpackage admin
+ * @copyright 2006 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+require_once('../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->libdir.'/environmentlib.php');
+require_once($CFG->libdir.'/componentlib.class.php');
+
+// Parameters
+$action = optional_param('action', '', PARAM_ACTION);
+$version = optional_param('version', '', PARAM_FILE); //
+
+$extraurlparams = array();
+if ($version) {
+ $extraurlparams['version'] = $version;
+}
+admin_externalpage_setup('environment', '', $extraurlparams);
+
+// Handle the 'updatecomponent' action
+if ($action == 'updatecomponent' && confirm_sesskey()) {
+ // Create component installer and execute it
+ if ($cd = new component_installer('http://download.moodle.org',
+ 'environment',
+ 'environment.zip')) {
+ $status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
+ switch ($status) {
+ case COMPONENT_ERROR:
+ if ($cd->get_error() == 'remotedownloaderror') {
+ $a = new stdClass();
+ $a->url = 'http://download.moodle.org/environment/environment.zip';
+ $a->dest = $CFG->dataroot . '/';
+ print_error($cd->get_error(), 'error', $PAGE->url, $a);
+ die();
+
+ } else {
+ print_error($cd->get_error(), 'error', $PAGE->url);
+ die();
+ }
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-// This file is the admin frontend to execute all the checks available
-// in the environment.xml file. It includes database, php and
-// php_extensions. Also, it's possible to update the xml file
-// from moodle.org be able to check more and more versions.
-
- require_once('../config.php');
- require_once($CFG->libdir.'/adminlib.php');
- require_once($CFG->libdir.'/environmentlib.php');
- require_once($CFG->libdir.'/componentlib.class.php');
-
- admin_externalpage_setup('environment');
-
-/// Parameters
- $action = optional_param('action', '', PARAM_ACTION);
- $version = optional_param('version', '', PARAM_FILE); //
-
-
-/// Get some strings
- $stradmin = get_string('administration');
- $stradminhelpenvironment = get_string("adminhelpenvironment");
- $strenvironment = get_string('environment', 'admin');
- $strerror = get_string('error');
- $strmoodleversion = get_string('moodleversion');
- $strupdate = get_string('updatecomponent', 'admin');
- $strupwards = get_string('upwards', 'admin');
- $strmisc = get_string('miscellaneous');
-
-/// Print the header stuff
- echo $OUTPUT->header();
-
-/// Print the component download link
- echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.sesskey().'">'.$strupdate.'</a></div>';
-
- echo $OUTPUT->heading($strenvironment);
+ case COMPONENT_UPTODATE:
+ redirect($PAGE->url, get_string($cd->get_error(), 'error'));
+ die;
-/// Handle the 'updatecomponent' action
- if ($action == 'updatecomponent' && confirm_sesskey()) {
- /// Create component installer and execute it
- if ($cd = new component_installer('http://download.moodle.org',
- 'environment',
- 'environment.zip')) {
- $status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
- switch ($status) {
- case COMPONENT_ERROR:
- if ($cd->get_error() == 'remotedownloaderror') {
- $a = new stdClass();
- $a->url = 'http://download.moodle.org/environment/environment.zip';
- $a->dest= $CFG->dataroot.'/';
- echo $OUTPUT->box(get_string($cd->get_error(), 'error', $a), 'errorbox');
- } else {
- echo $OUTPUT->box(get_string($cd->get_error(), 'error'), 'errorbox');
- }
- break;
- case COMPONENT_UPTODATE:
- echo $OUTPUT->box(get_string($cd->get_error(), 'error'));
- break;
- case COMPONENT_INSTALLED:
- echo $OUTPUT->box(get_string('componentinstalled', 'admin'));
- break;
- }
+ case COMPONENT_INSTALLED:
+ redirect($PAGE->url, get_string('componentinstalled', 'admin'));
+ die;
}
}
-
-/// Start of main box
- echo $OUTPUT->box_start();
-
- echo "<div style=\"text-align:center\">".$stradminhelpenvironment."</div><br />";
-
-/// Get current Moodle version
- $current_version = $CFG->release;
-
-/// Calculate list of versions
- $versions = array();
- if ($contents = load_environment_xml()) {
- if ($env_versions = get_list_of_environment_versions($contents)) {
- /// Set the current version at the beginning
- $env_version = normalize_version($current_version); //We need this later (for the upwards)
- $versions[$env_version] = $current_version;
- /// If no version has been previously selected, default to $current_version
- if (empty($version)) {
- $version = $env_version;
- }
- ///Iterate over each version, adding bigger than current
- foreach ($env_versions as $env_version) {
- if (version_compare(normalize_version($current_version), $env_version, '<')) {
- $versions[$env_version] = $env_version;
- }
+}
+
+// Get current Moodle version
+$current_version = $CFG->release;
+
+// Calculate list of versions
+$versions = array();
+if ($contents = load_environment_xml()) {
+ if ($env_versions = get_list_of_environment_versions($contents)) {
+ // Set the current version at the beginning
+ $env_version = normalize_version($current_version); //We need this later (for the upwards)
+ $versions[$env_version] = $current_version;
+ // If no version has been previously selected, default to $current_version
+ if (empty($version)) {
+ $version = $env_version;
+ }
+ //Iterate over each version, adding bigger than current
+ foreach ($env_versions as $env_version) {
+ if (version_compare(normalize_version($current_version), $env_version, '<')) {
+ $versions[$env_version] = $env_version;
}
- /// Add 'upwards' to the last element
- $versions[$env_version] = $env_version.' '.$strupwards;
- } else {
- $versions = array('error' => $strerror);
}
+ // Add 'upwards' to the last element
+ $versions[$env_version] = $env_version.' '.get_string('upwards', 'admin');
+ } else {
+ $versions = array('error' => get_string('error'));
}
+}
-/// Print form and popup menu
- echo '<div style="text-align:center"> ';
- $select = new single_select(new moodle_url('/admin/environment.php'), 'version', $versions, $version, null);
- $select->label = $strmoodleversion;
- echo $OUTPUT->render($select);
- echo '</div>';
-
-/// End of main box
- echo $OUTPUT->box_end();
-
-/// Gather and show results
- $status = check_moodle_environment($version, $environment_results);
-
-/// Print footer
- echo $OUTPUT->footer();
+// Get the results of the environment check.
+list($envstatus, $environment_results) = check_moodle_environment($version);
+// Display the page.
+$output = $PAGE->get_renderer('core', 'admin');
+echo $output->environment_check_page($versions, $version, $envstatus, $environment_results);
Oops, something went wrong.

0 comments on commit 18dd4a6

Please sign in to comment.