Permalink
Browse files

MDL-20636 Merge remote-tracking branch 'moodle/master' into upgrade

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...
2 parents fca599a + de58499 commit a2ac23495656d62cf4c203be72f3ff2423b2ca8a @timhunt timhunt committed May 11, 2011
Showing with 6,567 additions and 2,521 deletions.
  1. +5 −1 admin/blocks.php
  2. +2 −2 admin/bloglevelupgrade.php
  3. +38 −22 admin/cli/install.php
  4. +10 −19 admin/cli/install_database.php
  5. +39 −4 admin/cli/upgrade.php
  6. +114 −0 admin/environment.xml
  7. +2 −2 admin/generator.php
  8. +62 −24 admin/index.php
  9. +50 −96 admin/langimport.php
  10. +41 −0 admin/plugins.php
  11. 0 admin/process_email.php
  12. +296 −0 admin/renderer.php
  13. +16 −21 admin/replace.php
  14. +3 −3 admin/report/customlang/db/install.xml
  15. +13 −0 admin/report/customlang/db/upgrade.php
  16. +18 −2 admin/report/customlang/index.php
  17. +3 −1 admin/report/customlang/lang/en/report_customlang.php
  18. +23 −2 admin/report/customlang/locallib.php
  19. +4 −0 admin/report/customlang/styles.css
  20. +1 −1 admin/report/customlang/version.php
  21. +1 −1 admin/report/profiling/settings.php
  22. +8 −6 admin/report/spamcleaner/index.php
  23. 0 admin/report/unittest/coveragefile.php
  24. 0 admin/roles/allow.php
  25. 0 admin/roles/assign.php
  26. 0 admin/roles/check.php
  27. 0 admin/roles/define.php
  28. +4 −5 admin/roles/lib.php
  29. +1 −1 admin/roles/manage.php
  30. 0 admin/roles/managetabs.php
  31. 0 admin/roles/override.php
  32. +5 −5 admin/settings/appearance.php
  33. +14 −5 admin/settings/frontpage.php
  34. +1 −1 admin/settings/language.php
  35. +28 −2 admin/settings/plugins.php
  36. +3 −8 admin/settings/security.php
  37. +4 −0 admin/settings/server.php
  38. +2 −1 admin/settings/subsystems.php
  39. +26 −28 admin/settings/users.php
  40. +384 −716 admin/uploaduser.php
  41. +112 −64 admin/uploaduser_form.php
  42. +368 −0 admin/uploaduserlib.php
  43. +1 −1 admin/user.php
  44. 0 admin/user/user_bulk.php
  45. 0 admin/user/user_bulk_confirm.php
  46. 0 admin/user/user_bulk_delete.php
  47. 0 admin/user/user_bulk_display.php
  48. 0 admin/user/user_bulk_download.php
  49. 0 admin/user/user_bulk_message.php
  50. +5 −5 auth/db/auth.php
  51. +0 −15 auth/email/lang/en/auth_email.php
  52. +1 −1 auth/ldap/auth.php
  53. 0 auth/ldap/cli/sync_users.php
  54. +2 −1 auth/ldap/lang/en/auth_ldap.php
  55. +49 −0 auth/manual/db/upgrade.php
  56. +29 −0 auth/manual/version.php
  57. 0 auth/shibboleth/config.html
  58. 0 backup/backupfilesedit.php
  59. 0 backup/cc/cc2moodle.php
  60. 0 backup/cc/entities.class.php
  61. 0 backup/cc/entity.forum.class.php
  62. 0 backup/cc/entity.label.class.php
  63. 0 backup/cc/entity.quiz.class.php
  64. 0 backup/cc/entity.resource.class.php
  65. 0 backup/cc/includes/constants.php
  66. 0 backup/cc/restore_cc.php
  67. 0 backup/cc/schemas/cclibxml2validator.xsd
  68. 0 backup/cc/schemas/config.xml
  69. 0 backup/cc/schemas/domainProfile_0/imsccauth_v1p0.xsd
  70. 0 backup/cc/schemas/domainProfile_0/imsccauth_v1p0_constraintsDocument.scmt
  71. 0 backup/cc/schemas/domainProfile_0/imsccauth_v1p0_localised.xsd
  72. 0 backup/cc/schemas/domainProfile_1/anyElement.xsd
  73. 0 backup/cc/schemas/domainProfile_1/anyElement_localised.xsd
  74. 0 backup/cc/schemas/domainProfile_1/common/anyElement.xsd
  75. 0 backup/cc/schemas/domainProfile_1/common/dataTypes.xsd
  76. 0 backup/cc/schemas/domainProfile_1/common/elementNames.xsd
  77. 0 backup/cc/schemas/domainProfile_1/common/elementTypes.xsd
  78. 0 backup/cc/schemas/domainProfile_1/common/rootElement.xsd
  79. 0 backup/cc/schemas/domainProfile_1/common/vocabTypes.xsd
  80. 0 backup/cc/schemas/domainProfile_1/common/vocabValues.xsd
  81. 0 backup/cc/schemas/domainProfile_1/dataTypes_localised.xsd
  82. 0 backup/cc/schemas/domainProfile_1/elementNames_localised.xsd
  83. 0 backup/cc/schemas/domainProfile_1/elementTypes_localised.xsd
  84. 0 backup/cc/schemas/domainProfile_1/extend/custom.xsd
  85. 0 backup/cc/schemas/domainProfile_1/imscc_m_definition.xsd
  86. 0 backup/cc/schemas/domainProfile_1/lomLoose.xsd
  87. 0 backup/cc/schemas/domainProfile_1/lomLoose_constraintsDocument.scmt
  88. 0 backup/cc/schemas/domainProfile_1/lomLoose_localised.xsd
  89. 0 backup/cc/schemas/domainProfile_1/loose.xsd
  90. 0 backup/cc/schemas/domainProfile_1/rootElement_localised.xsd
  91. 0 backup/cc/schemas/domainProfile_1/unique/loose.xsd
  92. 0 backup/cc/schemas/domainProfile_1/vocab/loose.xsd
  93. 0 backup/cc/schemas/domainProfile_1/vocabTypes_localised.xsd
  94. 0 backup/cc/schemas/domainProfile_1/vocabValues_localised.xsd
  95. 0 backup/cc/schemas/domainProfile_2/anyElement.xsd
  96. 0 backup/cc/schemas/domainProfile_2/anyElement_localised.xsd
  97. 0 backup/cc/schemas/domainProfile_2/common/anyElement.xsd
  98. 0 backup/cc/schemas/domainProfile_2/common/dataTypes.xsd
  99. 0 backup/cc/schemas/domainProfile_2/common/elementNames.xsd
  100. 0 backup/cc/schemas/domainProfile_2/common/elementTypes.xsd
  101. 0 backup/cc/schemas/domainProfile_2/common/rootElement.xsd
  102. 0 backup/cc/schemas/domainProfile_2/common/vocabTypes.xsd
  103. 0 backup/cc/schemas/domainProfile_2/common/vocabValues.xsd
  104. 0 backup/cc/schemas/domainProfile_2/dataTypes_localised.xsd
  105. 0 backup/cc/schemas/domainProfile_2/elementNames_localised.xsd
  106. 0 backup/cc/schemas/domainProfile_2/elementTypes_localised.xsd
  107. 0 backup/cc/schemas/domainProfile_2/extend/custom.xsd
  108. 0 backup/cc/schemas/domainProfile_2/imscc_mR_definition.xsd
  109. 0 backup/cc/schemas/domainProfile_2/lomLoose.xsd
  110. 0 backup/cc/schemas/domainProfile_2/lomLoose_constraintsDocument.scmt
  111. 0 backup/cc/schemas/domainProfile_2/lomLoose_localised.xsd
  112. 0 backup/cc/schemas/domainProfile_2/loose.xsd
  113. 0 backup/cc/schemas/domainProfile_2/rootElement_localised.xsd
  114. 0 backup/cc/schemas/domainProfile_2/unique/loose.xsd
  115. 0 backup/cc/schemas/domainProfile_2/vocab/loose.xsd
  116. 0 backup/cc/schemas/domainProfile_2/vocabTypes_localised.xsd
  117. 0 backup/cc/schemas/domainProfile_2/vocabValues_localised.xsd
  118. 0 backup/cc/schemas/domainProfile_3/imscp_extensionv1p2.xsd
  119. 0 backup/cc/schemas/domainProfile_3/imscp_extensionv1p2_constraintsDocument.scmt
  120. 0 backup/cc/schemas/domainProfile_3/imscp_extensionv1p2_localised.xsd
  121. 0 backup/cc/schemas/domainProfile_4/ims_qtiasiv1p2.xsd
  122. 0 backup/cc/schemas/domainProfile_4/ims_qtiasiv1p2_def_copy.xsd
  123. 0 backup/cc/schemas/domainProfile_4/ims_qtiasiv1p2_localised.xsd
  124. 0 backup/cc/schemas/domainProfile_4/imscc_q_definition.xsd
  125. 0 backup/cc/schemas/domainProfile_4/xml.xsd
  126. 0 backup/cc/schemas/domainProfile_5/imswl_v1p0.xsd
  127. 0 backup/cc/schemas/domainProfile_5/imswl_v1p0_localised.xsd
  128. 0 backup/cc/schemas/domainProfile_6/imsdt_v1p0.xsd
  129. 0 backup/cc/schemas/domainProfile_6/imsdt_v1p0_localised.xsd
  130. 0 backup/cc/schemas/imscc_c1p2maeV0p15_definition.xsd
  131. 0 backup/cc/schemas/imscp_v1p2.xsd
  132. 0 backup/cc/schemas/imscp_v1p2_constraintsDocument.scmt
  133. 0 backup/cc/schemas/imscp_v1p2_localised.xsd
  134. 0 backup/cc/sheets/base.xml
  135. 0 backup/cc/sheets/course_blocks_block.xml
  136. 0 backup/cc/sheets/course_header.xml
  137. 0 backup/cc/sheets/course_modules_mod_forum.xml
  138. 0 backup/cc/sheets/course_modules_mod_label.xml
  139. 0 backup/cc/sheets/course_modules_mod_quiz.xml
  140. 0 backup/cc/sheets/course_modules_mod_quiz_feedback.xml
  141. 0 backup/cc/sheets/course_modules_mod_quiz_question_instance.xml
  142. 0 backup/cc/sheets/course_modules_mod_resource.xml
  143. 0 backup/cc/sheets/course_question_categories.xml
  144. 0 backup/cc/sheets/course_question_categories_question_category.xml
  145. 0 backup/cc/sheets/course_question_categories_question_category_question.xml
  146. 0 backup/cc/sheets/course_question_categories_question_category_question_answer.xml
  147. 0 backup/cc/sheets/course_question_categories_question_category_question_eesay.xml
  148. 0 backup/cc/sheets/course_question_categories_question_category_question_multiple_choice.xml
  149. 0 backup/cc/sheets/course_question_categories_question_category_question_shortanswer.xml
  150. 0 backup/cc/sheets/course_question_categories_question_category_question_true_false.xml
  151. 0 backup/cc/sheets/course_sections_section.xml
  152. 0 backup/cc/sheets/course_sections_section_mods_mod.xml
  153. 0 backup/cc/sheets/info_details_mod.xml
  154. 0 backup/cc/sheets/info_details_mod_instance.xml
  155. +44 −0 backup/moodle2/backup_plagiarism_plugin.class.php
  156. +2 −0 backup/moodle2/backup_plan_builder.class.php
  157. +10 −0 backup/moodle2/backup_stepslib.php
  158. +76 −0 backup/moodle2/backup_theme_plugin.class.php
  159. +46 −0 backup/moodle2/restore_plagiarism_plugin.class.php
  160. +4 −0 backup/moodle2/restore_plan_builder.class.php
  161. +5 −2 backup/moodle2/restore_plugin.class.php
  162. +32 −22 backup/moodle2/restore_stepslib.php
  163. +5 −2 backup/moodle2/restore_subplugin.class.php
  164. +29 −0 backup/moodle2/restore_theme_plugin.class.php
  165. 0 backup/restorefile.php
  166. 0 backup/restorefile_form.php
  167. +39 −0 backup/util/dbops/backup_plan_dbops.class.php
  168. +8 −0 backup/util/helper/restore_inforef_parser_processor.class.php
  169. +8 −0 backup/util/helper/restore_moodlexml_parser_processor.class.php
  170. +8 −0 backup/util/helper/restore_questions_parser_processor.class.php
  171. +8 −0 backup/util/helper/restore_roles_parser_processor.class.php
  172. +8 −0 backup/util/helper/restore_structure_parser_processor.class.php
  173. +8 −0 backup/util/helper/restore_users_parser_processor.class.php
  174. +5 −2 backup/util/plan/restore_structure_step.class.php
  175. +1 −13 backup/util/ui/backup_ui.class.php
  176. +3 −3 backup/util/ui/backup_ui_stage.class.php
  177. +15 −0 backup/util/ui/base_ui.class.php
  178. +15 −7 backup/util/ui/renderer.php
  179. +7 −1 backup/util/ui/restore_ui_components.php
  180. +2 −2 backup/util/ui/restore_ui_stage.class.php
  181. +17 −18 backup/util/xml/parser/processors/grouped_parser_processor.class.php
  182. +42 −0 backup/util/xml/parser/processors/simplified_parser_processor.class.php
  183. 0 backup/util/xml/parser/simpletest/fixtures/test4.xml
  184. +80 −0 backup/util/xml/parser/simpletest/testparser.php
  185. +83 −32 blocks/admin_bookmarks/block_admin_bookmarks.php
  186. +2 −0 blocks/admin_bookmarks/create.php
  187. +2 −0 blocks/admin_bookmarks/delete.php
  188. +26 −23 blocks/blog_menu/block_blog_menu.php
  189. +25 −14 blocks/blog_recent/block_blog_recent.php
  190. +59 −20 blocks/blog_tags/block_blog_tags.php
  191. +3 −3 blocks/blog_tags/edit_form.php
  192. +31 −3 blocks/comments/block_comments.php
  193. +75 −0 blocks/comments/lib.php
  194. +20 −3 blocks/completionstatus/block_completionstatus.php
  195. +16 −11 blocks/completionstatus/details.php
  196. +0 −2 blocks/completionstatus/lang/en/block_completionstatus.php
  197. 0 blocks/html/block_html.php
  198. +21 −0 blocks/html/lib.php
  199. 0 blocks/mentees/block_mentees.php
  200. 0 blocks/mentees/lang/en/block_mentees.php
  201. +7 −3 blocks/messages/styles.css
  202. +1 −0 blocks/navigation/block_navigation.php
  203. +11 −7 blocks/navigation/styles.css
  204. +21 −7 blocks/navigation/yui/navigation/navigation.js
  205. +6 −2 blocks/online_users/styles.css
  206. 0 blocks/private_files/block_private_files.php
  207. +3 −1 blocks/recent_activity/styles.css
  208. 0 blocks/rss_client/lang/en/block_rss_client.php
  209. 0 blocks/section_links/config_instance.html
  210. 0 blocks/section_links/settings.php
  211. +31 −13 blocks/selfcompletion/block_selfcompletion.php
  212. +4 −2 blocks/selfcompletion/lang/en/block_selfcompletion.php
  213. +3 −2 blocks/settings/styles.css
  214. 0 blog/edit.php
  215. +27 −5 blog/index.php
  216. +66 −2 blog/lib.php
  217. +6 −3 blog/locallib.php
  218. 0 blog/preferences.php
  219. 0 blog/rsslib.php
  220. +2 −1 calendar/event.php
  221. +67 −63 calendar/lib.php
  222. +3 −4 comment/comment.js
  223. +64 −56 comment/comment_ajax.php
  224. +18 −14 comment/comment_post.php
  225. +6 −3 comment/index.php
  226. +511 −210 comment/lib.php
  227. +104 −52 comment/locallib.php
  228. +26 −0 config-dist.php
  229. +1 −1 course/edit_form.php
  230. 0 course/format/scorm/config.php
  231. 0 course/format/social/config.php
  232. 0 course/format/topics/config.php
  233. 0 course/format/weeks/config.php
  234. +1 −1 course/format/weeks/lib.php
  235. +45 −60 course/lib.php
  236. +37 −0 course/mod.php
  237. +145 −0 course/modduplicate.php
  238. +5 −5 course/modedit.php
  239. +1 −1 course/pending.php
  240. +4 −4 course/report/completion/index.php
  241. +1 −1 course/report/log/lang/en/coursereport_log.php
  242. +1 −1 course/report/log/lib.php
  243. +1 −1 course/report/participation/index.php
  244. +1 −1 course/request_form.php
  245. 0 course/reset.php
  246. 0 course/simpletest/testcourselib.php
  247. +1 −0 course/user.php
  248. +1 −91 enrol/ajax.php
  249. +4 −4 enrol/authorize/db/access.php
  250. 0 enrol/authorize/enrol_form.php
  251. +50 −50 enrol/authorize/lang/en/enrol_authorize.php
  252. 0 enrol/authorize/version.php
  253. +94 −0 enrol/bulkchange.php
  254. +118 −0 enrol/bulkchange_forms.php
  255. +1 −1 enrol/category/db/access.php
  256. +5 −5 enrol/category/locallib.php
  257. +108 −0 enrol/cohort/ajax.php
  258. +1 −1 enrol/cohort/db/access.php
  259. +57 −10 enrol/cohort/lib.php
  260. +90 −0 enrol/cohort/locallib.php
  261. 0 ...ins/sam/quickcohortenrolment.css → cohort/yui/quickenrolment/assets/skins/sam/quickenrolment.css}
  262. 0 enrol/{yui/quickcohortenrolment → cohort/yui/quickenrolment}/assets/skins/sam/sprite.png
  263. +4 −4 .../{yui/quickcohortenrolment/quickcohortenrolment.js → cohort/yui/quickenrolment/quickenrolment.js}
  264. +69 −0 enrol/externallib.php
  265. +1 −1 enrol/guest/db/access.php
  266. +1 −1 enrol/ldap/db/access.php
  267. +4 −5 enrol/ldap/lang/en/enrol_ldap.php
  268. +1 −1 enrol/ldap/lib.php
  269. +406 −141 enrol/locallib.php
  270. +131 −0 enrol/manual/ajax.php
  271. +45 −0 enrol/manual/bulkchangeforms.php
  272. +5 −5 enrol/manual/db/access.php
  273. +39 −0 enrol/manual/db/services.php
  274. +110 −0 enrol/manual/editenrolment.php
  275. +81 −0 enrol/manual/editenrolment_form.php
  276. +143 −0 enrol/manual/externallib.php
  277. +14 −0 enrol/manual/lang/en/enrol_manual.php
  278. +115 −0 enrol/manual/lib.php
  279. +208 −5 enrol/manual/locallib.php
  280. +96 −0 enrol/manual/unenroluser.php
  281. +1 −1 enrol/manual/version.php
  282. +6 −1 ...s/skins/sam/enrolmentmanager.css → manual/yui/quickenrolment/assets/skins/sam/quickenrolment.css}
  283. 0 enrol/{yui/enrolmentmanager → manual/yui/quickenrolment}/assets/skins/sam/sprite.png
  284. +73 −53 enrol/{yui/enrolmentmanager/enrolmentmanager.js → manual/yui/quickenrolment/quickenrolment.js}
  285. +2 −2 enrol/meta/db/access.php
  286. +1 −1 enrol/meta/lang/en/enrol_meta.php
  287. +4 −4 enrol/meta/locallib.php
  288. +5 −6 enrol/otherusers.php
  289. +4 −4 enrol/paypal/db/access.php
  290. +1 −1 enrol/paypal/lang/en/enrol_paypal.php
  291. +209 −215 enrol/renderer.php
  292. +4 −4 enrol/self/db/access.php
  293. +113 −0 enrol/self/editenrolment.php
  294. +81 −0 enrol/self/editenrolment_form.php
  295. +3 −0 enrol/self/lang/en/enrol_self.php
  296. +27 −3 enrol/self/lib.php
  297. +101 −0 enrol/self/unenroluser.php
  298. +18 −57 enrol/users.php
  299. +1 −67 enrol/users_forms.php
  300. +2 −2 enrol/yui/rolemanager/rolemanager.js
Sorry, we could not display the entire diff because too many files (1,225) changed.
View
6 admin/blocks.php
@@ -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>';
View
4 admin/bloglevelupgrade.php
@@ -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;
View
60 admin/cli/install.php
@@ -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:
@@ -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'));
@@ -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'),
@@ -193,6 +195,7 @@
'adminpass' => '',
'non-interactive' => false,
'agree-license' => false,
+ 'allow-unstable' => false,
'help' => false
),
array(
@@ -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));
}
}
}
@@ -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']);
View
29 admin/cli/install_database.php
@@ -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));
}
}
}
View
43 admin/cli/upgrade.php
@@ -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']);
@@ -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:
@@ -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) {
@@ -94,6 +105,30 @@
}
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');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
View
114 admin/environment.xml
@@ -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>
View
4 admin/generator.php 100755 → 100644
@@ -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));
View
86 admin/index.php
@@ -48,6 +48,7 @@
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
+$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL);
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
// Check some PHP server settings
@@ -86,7 +87,7 @@
$version = null;
$release = null;
-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 or !$release) {
@@ -130,17 +131,29 @@
if (empty($confirmrelease)) {
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
- $PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
- $PAGE->set_heading($strinstallation);
+ $PAGE->set_title($strinstallation);
+ $PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release);
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
echo $OUTPUT->heading("Moodle $release");
+
+ if (isset($maturity)) {
+ // main version.php declares moodle code maturity
+ if ($maturity < MATURITY_STABLE) {
+ $maturitylevel = get_string('maturity'.$maturity, 'admin');
+ echo $OUTPUT->box(
+ $OUTPUT->container(get_string('maturitycorewarning', 'admin', $maturitylevel)) .
+ $OUTPUT->container($OUTPUT->doc_link('admin/versions', get_string('morehelp'))),
+ 'generalbox maturitywarning');
+ }
+ }
+
$releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes');
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink); // extremely ugly validation hack
- echo $OUTPUT->box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide');
+ echo $OUTPUT->box($releasenoteslink, 'generalbox releasenoteslink');
require_once($CFG->libdir.'/environmentlib.php');
- if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
+ if (!check_moodle_environment(normalize_version($release), $environment_results, true, ENV_SELECT_RELEASE)) {
print_upgrade_reload("index.php?agreelicense=1&amp;lang=$CFG->lang");
} else {
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
@@ -181,6 +194,7 @@
}
if ($version > $CFG->version) { // upgrade
+ purge_all_caches();
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
@@ -189,11 +203,20 @@
$strdatabasechecking = get_string('databasechecking', '', $a);
if (empty($confirmupgrade)) {
- $PAGE->navbar->add($strdatabasechecking);
- $PAGE->set_title($strdatabasechecking);
- $PAGE->set_heading($stradministration);
+ $PAGE->set_title($stradministration);
+ $PAGE->set_heading($strdatabasechecking);
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
+ if (isset($maturity)) {
+ // main version.php declares moodle code maturity
+ if ($maturity < MATURITY_STABLE) {
+ $maturitylevel = get_string('maturity'.$maturity, 'admin');
+ echo $OUTPUT->box(
+ $OUTPUT->container(get_string('maturitycorewarning', 'admin', $maturitylevel)) .
+ $OUTPUT->container($OUTPUT->doc_link('admin/versions', get_string('morehelp'))),
+ 'generalbox maturitywarning');
+}
+ }
$continueurl = new moodle_url('index.php', array('confirmupgrade' => 1));
$cancelurl = new moodle_url('index.php');
echo $OUTPUT->confirm(get_string('upgradesure', 'admin', $a->newversion), $continueurl, $cancelurl);
@@ -234,17 +257,19 @@
$PAGE->set_title($strplugincheck);
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
- echo $OUTPUT->header();
- echo $OUTPUT->heading($strplugincheck);
- echo $OUTPUT->box_start('generalbox', 'notice');
- print_string('pluginchecknotice');
- echo $OUTPUT->box_end();
- print_plugin_tables();
+ $output = $PAGE->get_renderer('core', 'admin');
+ $pluginman = plugin_manager::instance();
+
+ echo $output->header();
+ echo $output->box_start('generalbox');
+ echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
+ echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
+ echo $output->box_end();
print_upgrade_reload('index.php?confirmupgrade=1&amp;confirmrelease=1');
$button = new single_button(new moodle_url('index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
$button->class = 'continuebutton';
- echo $OUTPUT->render($button);
- echo $OUTPUT->footer();
+ echo $output->render($button);
+ echo $output->footer();
die();
} else {
@@ -272,17 +297,19 @@
$PAGE->set_title($strplugincheck);
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
- echo $OUTPUT->header();
- echo $OUTPUT->heading($strplugincheck);
- echo $OUTPUT->box_start('generalbox', 'notice');
- print_string('pluginchecknotice');
- echo $OUTPUT->box_end();
- print_plugin_tables();
+ $output = $PAGE->get_renderer('core', 'admin');
+ $pluginman = plugin_manager::instance();
+
+ echo $output->header();
+ echo $output->box_start('generalbox');
+ echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
+ echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
+ echo $output->box_end();
print_upgrade_reload('index.php');
$button = new single_button(new moodle_url('index.php', array('confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
$button->class = 'continuebutton';
- echo $OUTPUT->render($button);
- echo $OUTPUT->footer();
+ echo $output->render($button);
+ echo $output->footer();
die();
}
}
@@ -381,6 +408,17 @@
admin_externalpage_setup('adminnotifications');
echo $OUTPUT->header();
+// Unstable code warning
+if (isset($maturity)) {
+ if ($maturity < MATURITY_STABLE) {
+ $maturitylevel = get_string('maturity'.$maturity, 'admin');
+ echo $OUTPUT->box(
+ get_string('maturitycoreinfo', 'admin', $maturitylevel) . ' ' .
+ $OUTPUT->doc_link('admin/versions', get_string('morehelp')),
+ 'generalbox adminwarning maturityinfo');
+ }
+}
+
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
echo $OUTPUT->box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
View
146 admin/langimport.php 100755 → 100644
@@ -18,7 +18,7 @@
/**
* Fetches language packages from download.moodle.org server
*
- * Language packages are available at http://download.moodle.org/langpack/2.0/
+ * Language packages are available at http://download.moodle.org/langpack/
* in ZIP format together with a file languages.md5 containing their hashes
* and meta info.
* Locally, language packs are saved into $CFG->dataroot/lang/
@@ -33,8 +33,6 @@
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
-$thisversion = '2.0'; // TODO this information should be taken from version.php or similar source
-
admin_externalpage_setup('langimport');
if (!empty($CFG->skiplangupgrade)) {
@@ -53,11 +51,6 @@
define('DELETION_OF_SELECTED_LANG', 4);
define('UPDATE_ALL_LANG', 5);
-//reset and diagnose lang cache permissions
-remove_dir($CFG->dataroot.'/cache/languages');
-if (file_exists($CFG->dataroot.'/cache/languages')) {
- print_error('cannotdeletelangcache', 'error');
-}
get_string_manager()->reset_caches();
$notice_ok = array();
@@ -68,41 +61,22 @@
make_upload_directory('temp');
make_upload_directory('lang');
- if (is_array($pack)) {
- $packs = $pack;
- } else {
- $packs = array($pack);
- }
-
- foreach ($packs as $pack) {
- if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
- $status = $cd->install();
- switch ($status) {
- case COMPONENT_ERROR:
- if ($cd->get_error() == 'remotedownloaderror') {
- $a = new stdClass();
- $a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
- $a->dest = $CFG->dataroot.'/lang';
- print_error($cd->get_error(), 'error', 'langimport.php', $a);
- } else {
- print_error($cd->get_error(), 'error', 'langimport.php');
- }
- break;
- case COMPONENT_INSTALLED:
- $notice_ok[] = get_string('langpackinstalled','admin',$pack);
- if ($parentlang = get_parent_language($pack)) {
- // install also parent pack if specified
- if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion,
- $parentlang.'.zip', 'languages.md5', 'lang')) {
- $cd->install();
- }
- }
- break;
- case COMPONENT_UPTODATE:
- break;
- }
- } else {
- echo $OUTPUT->notification('Had an unspecified error with the component installer, sorry.');
+ $installer = new lang_installer($pack);
+ $results = $installer->run();
+ foreach ($results as $langcode => $langstatus) {
+ switch ($langstatus) {
+ case lang_installer::RESULT_DOWNLOADERROR:
+ $a = new stdClass();
+ $a->url = $installer->lang_pack_url($langcode);
+ $a->dest = $CFG->dataroot.'/lang';
+ print_error('remotedownloaderror', 'error', 'langimport.php', $a);
+ break;
+ case lang_installer::RESULT_INSTALLED:
+ $notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
+ break;
+ case lang_installer::RESULT_UPTODATE:
+ $notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
+ break;
}
}
}
@@ -141,7 +115,9 @@
if ($mode == UPDATE_ALL_LANG) {
set_time_limit(0);
- if (!$availablelangs = get_remote_list_of_languages()) {
+ $installer = new lang_installer();
+
+ if (!$availablelangs = $installer->get_remote_list_of_languages()) {
print_error('cannotdownloadlanguageupdatelist', 'error');
}
$md5array = array(); // (string)langcode => (string)md5
@@ -176,8 +152,8 @@
make_upload_directory('temp');
make_upload_directory('lang');
- $updated = false; // any packs updated?
- foreach ($neededlangs as $pack) {
+ // clean-up currently installed versions of the packs
+ foreach ($neededlangs as $packindex => $pack) {
if ($pack == 'en') {
continue;
}
@@ -190,41 +166,38 @@
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
+ unset($neededlangs[$packindex]);
continue;
}
}
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
+ unset($neededlangs[$packindex]);
continue;
}
}
+ }
- // copy and unzip new version
- if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
- $status = $cd->install();
- switch ($status) {
-
- case COMPONENT_ERROR:
- if ($cd->get_error() == 'remotedownloaderror') {
- $a = new stdClass();
- $a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
- $a->dest = $CFG->dataroot.'/lang';
- print_error($cd->get_error(), 'error', 'langimport.php', $a);
- } else {
- print_error($cd->get_error(), 'error', 'langimport.php');
- }
- break;
-
- case COMPONENT_UPTODATE:
- // should not get here
- break;
-
- case COMPONENT_INSTALLED:
- $notice_ok[] = get_string('langpackupdated', 'admin', $pack);
- $updated = true;
- break;
- }
+ // install all needed language packs
+ $installer->set_queue($neededlangs);
+ $results = $installer->run();
+ $updated = false; // any packs updated?
+ foreach ($results as $langcode => $langstatus) {
+ switch ($langstatus) {
+ case lang_installer::RESULT_DOWNLOADERROR:
+ $a = new stdClass();
+ $a->url = $installer->lang_pack_url($langcode);
+ $a->dest = $CFG->dataroot.'/lang';
+ print_error('remotedownloaderror', 'error', 'langimport.php', $a);
+ break;
+ case lang_installer::RESULT_INSTALLED:
+ $updated = true;
+ $notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
+ break;
+ case lang_installer::RESULT_UPTODATE:
+ $notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
+ break;
}
}
@@ -233,6 +206,8 @@
} else {
$notice_ok[] = get_string('nolangupdateneeded','admin');
}
+
+ unset($installer);
}
get_string_manager()->reset_caches();
@@ -244,15 +219,17 @@
$missingparents = array();
foreach ($installedlangs as $installedlang => $unused) {
$parent = get_parent_language($installedlang);
- if (empty($parent) or ($parent === 'en')) {
+ if (empty($parent)) {
continue;
}
if (!isset($installedlangs[$parent])) {
$missingparents[$installedlang] = $parent;
}
}
-if ($availablelangs = get_remote_list_of_languages()) {
+$installer = new lang_installer();
+
+if ($availablelangs = $installer->get_remote_list_of_languages()) {
$remote = true;
} else {
$remote = false;
@@ -362,26 +339,3 @@ function is_installed_lang($lang, $md5check) {
}
return false;
}
-
-/**
- * Returns the list of available language packs from download.moodle.org
- *
- * @return array|bool false if can not download
- */
-function get_remote_list_of_languages() {
- $source = 'http://download.moodle.org/langpack/2.0/languages.md5';
- $availablelangs = array();
-
- if ($content = download_file_content($source)) {
- $alllines = explode("\n", $content);
- foreach($alllines as $line) {
- if (!empty($line)){
- $availablelangs[] = explode(',', $line);
- }
- }
- return $availablelangs;
-
- } else {
- return false;
- }
-}
View
41 admin/plugins.php
@@ -0,0 +1,41 @@
+<?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/>.
+
+/**
+ * UI for general plugins management
+ *
+ * @package core
+ * @subpackage admin
+ * @copyright 2011 David Mudrak <david@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once(dirname(dirname(__FILE__)) . '/config.php');
+require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->libdir . '/pluginlib.php');
+
+require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+admin_externalpage_setup('pluginsoverview');
+$output = $PAGE->get_renderer('core', 'admin');
+$pluginman = plugin_manager::instance();
+
+echo $output->header();
+echo $output->heading(get_string('pluginsoverview', 'core_admin'));
+echo $output->box_start('generalbox');
+echo $output->plugins_control_panel($pluginman->get_plugins());
+echo $output->box_end();
+echo $output->footer();
View
0 admin/process_email.php 100755 → 100644
File mode changed.
View
296 admin/renderer.php
@@ -0,0 +1,296 @@
+<?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/>.
+
+/**
+ * Renderer for core_admin subsystem
+ *
+ * @package core
+ * @subpackage admin
+ * @copyright 2011 David Mudrak <david@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+require_once($CFG->libdir . '/pluginlib.php');
+
+/**
+ * Standard HTML output renderer for core_admin subsystem
+ */
+class core_admin_renderer extends plugin_renderer_base {
+
+ /**
+ * Displays all known plugins and information about their installation or upgrade
+ *
+ * This default implementation renders all plugins into one big table. The rendering
+ * options support:
+ * (bool)full = false: whether to display up-to-date plugins, too
+ *
+ * @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
+ * @param array $options rendering options
+ * @return string HTML code
+ */
+ public function plugins_check(array $plugininfo, array $options = null) {
+
+ if (empty($plugininfo)) {
+ return '';
+ }
+
+ if (empty($options)) {
+ $options = array(
+ 'full' => false,
+ );
+ }
+
+ $pluginman = plugin_manager::instance();
+
+ $table = new html_table();
+ $table->id = 'plugins-check';
+ $table->head = array(
+ get_string('displayname', 'core_plugin'),
+ get_string('rootdir', 'core_plugin'),
+ get_string('source', 'core_plugin'),
+ get_string('versiondb', 'core_plugin'),
+ get_string('versiondisk', 'core_plugin'),
+ get_string('status', 'core_plugin'),
+ );
+ $table->colclasses = array(
+ 'displayname', 'rootdir', 'source', 'versiondb', 'versiondisk', 'status',
+ );
+ $table->data = array();
+
+ $numofhighlighted = array(); // number of highlighted rows per this subsection
+
+ foreach ($plugininfo as $type => $plugins) {
+
+ $header = new html_table_cell($pluginman->plugintype_name_plural($type));
+ $header->header = true;
+ $header->colspan = count($table->head);
+ $header = new html_table_row(array($header));
+ $header->attributes['class'] = 'plugintypeheader type-' . $type;
+
+ $numofhighlighted[$type] = 0;
+
+ if (empty($plugins) and $options['full']) {
+ $msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
+ $msg->colspan = count($table->head);
+ $row = new html_table_row(array($msg));
+ $row->attributes['class'] .= 'msg msg-noneinstalled';
+ $table->data[] = $header;
+ $table->data[] = $row;
+ continue;
+ }
+
+ $plugintyperows = array();
+
+ foreach ($plugins as $name => $plugin) {
+ $row = new html_table_row();
+ $row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
+
+ if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
+ $icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
+ } else {
+ $icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
+ }
+ $displayname = $icon . ' ' . $plugin->displayname;
+ $displayname = new html_table_cell($displayname);
+
+ $rootdir = new html_table_cell($plugin->get_dir());
+
+ if ($isstandard = $plugin->is_standard()) {
+ $row->attributes['class'] .= ' standard';
+ $source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
+ } else {
+ $row->attributes['class'] .= ' extension';
+ $source = new html_table_cell(get_string('sourceext', 'core_plugin'));
+ }
+
+ $versiondb = new html_table_cell($plugin->versiondb);
+ $versiondisk = new html_table_cell($plugin->versiondisk);
+
+ $statuscode = $plugin->get_status();
+ $row->attributes['class'] .= ' status-' . $statuscode;
+
+ $status = new html_table_cell(get_string('status_' . $statuscode, 'core_plugin'));
+
+ if ($isstandard and in_array($statuscode, array(plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE))) {
+ if (empty($options['full'])) {
+ continue;
+ }
+ } else {
+ $numofhighlighted[$type]++;
+ }
+
+ $row->cells = array($displayname, $rootdir, $source, $versiondb, $versiondisk, $status);
+ $plugintyperows[] = $row;
+ }
+
+ if (empty($numofhighlighted[$type]) and empty($options['full'])) {
+ continue;
+ }
+
+ $table->data[] = $header;
+ $table->data = array_merge($table->data, $plugintyperows);
+ }
+
+ $sumofhighlighted = array_sum($numofhighlighted);
+
+ if ($sumofhighlighted == 0) {
+ $out = $this->output->container_start('nonehighlighted', 'plugins-check-info');
+ $out .= $this->output->heading(get_string('nonehighlighted', 'core_plugin'));
+ if (empty($options['full'])) {
+ $out .= html_writer::link(new moodle_url('/admin/index.php',
+ array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
+ get_string('nonehighlightedinfo', 'core_plugin'));
+ }
+ $out .= $this->output->container_end();
+
+ } else {
+ $out = $this->output->container_start('somehighlighted', 'plugins-check-info');
+ $out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
+ if (empty($options['full'])) {
+ $out .= html_writer::link(new moodle_url('/admin/index.php',
+ array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
+ get_string('somehighlightedinfo', 'core_plugin'));
+ }
+ $out .= $this->output->container_end();
+ }
+
+ if ($sumofhighlighted > 0 or $options['full']) {
+ $out .= html_writer::table($table);
+ }
+
+ return $out;
+ }
+
+ /**
+ * Displays all known plugins and links to manage them
+ *
+ * This default implementation renders all plugins into one big table.
+ *
+ * @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
+ * @return string HTML code
+ */
+ public function plugins_control_panel(array $plugininfo) {
+
+ if (empty($plugininfo)) {
+ return '';
+ }
+
+ $pluginman = plugin_manager::instance();
+
+ $table = new html_table();
+ $table->id = 'plugins-control-panel';
+ $table->head = array(
+ get_string('displayname', 'core_plugin'),
+ get_string('systemname', 'core_plugin'),
+ get_string('source', 'core_plugin'),
+ get_string('version', 'core_plugin'),
+ get_string('availability', 'core_plugin'),
+ get_string('settings', 'core_plugin'),
+ get_string('uninstall','core_plugin'),
+ );
+ $table->colclasses = array(
+ 'displayname', 'systemname', 'source', 'version', 'availability', 'settings', 'uninstall',
+ );
+
+ foreach ($plugininfo as $type => $plugins) {
+
+ $header = new html_table_cell($pluginman->plugintype_name_plural($type));
+ $header->header = true;
+ $header->colspan = count($table->head);
+ $header = new html_table_row(array($header));
+ $header->attributes['class'] = 'plugintypeheader type-' . $type;
+ $table->data[] = $header;
+
+ if (empty($plugins)) {
+ $msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
+ $msg->colspan = count($table->head);
+ $row = new html_table_row(array($msg));
+ $row->attributes['class'] .= 'msg msg-noneinstalled';
+ $table->data[] = $row;
+ continue;
+ }
+
+ foreach ($plugins as $name => $plugin) {
+ $row = new html_table_row();
+ $row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
+
+ if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
+ $icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
+ } else {
+ $icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
+ }
+ if ($plugin->get_status() === plugin_manager::PLUGIN_STATUS_MISSING) {
+ $msg = html_writer::tag('span', get_string('status_missing', 'core_plugin'), array('class' => 'notifyproblem'));
+ $row->attributes['class'] .= ' missingfromdisk';
+ } else {
+ $msg = '';
+ }
+ $displayname = $icon . ' ' . $plugin->displayname . ' ' . $msg;
+ $displayname = new html_table_cell($displayname);
+
+ $systemname = new html_table_cell($plugin->type . '_' . $plugin->name);
+
+ if ($plugin->is_standard()) {
+ $row->attributes['class'] .= ' standard';
+ $source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
+ } else {
+ $row->attributes['class'] .= ' extension';
+ $source = new html_table_cell(get_string('sourceext', 'core_plugin'));
+ }
+
+ $version = new html_table_cell($plugin->versiondb);
+
+ $isenabled = $plugin->is_enabled();
+ if (is_null($isenabled)) {
+ $availability = new html_table_cell('');
+ } else if ($isenabled) {
+ $row->attributes['class'] .= ' enabled';
+ $icon = $this->output->pix_icon('i/hide', get_string('pluginenabled', 'core_plugin'));
+ $availability = new html_table_cell($icon . ' ' . get_string('pluginenabled', 'core_plugin'));
+ } else {
+ $row->attributes['class'] .= ' disabled';
+ $icon = $this->output->pix_icon('i/show', get_string('plugindisabled', 'core_plugin'));
+ $availability = new html_table_cell($icon . ' ' . get_string('plugindisabled', 'core_plugin'));
+ }
+
+ $settingsurl = $plugin->get_settings_url();
+ if (is_null($settingsurl)) {
+ $settings = new html_table_cell('');
+ } else {
+ $settings = html_writer::link($settingsurl, get_string('settings', 'core_plugin'));
+ $settings = new html_table_cell($settings);
+ }
+
+ $uninstallurl = $plugin->get_uninstall_url();
+ if (is_null($uninstallurl)) {
+ $uninstall = new html_table_cell('');
+ } else {
+ $uninstall = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'));
+ $uninstall = new html_table_cell($uninstall);
+ }
+
+ $row->cells = array(
+ $displayname, $systemname, $source, $version, $availability, $settings, $uninstall
+ );
+ $table->data[] = $row;
+ }
+ }
+
+ return html_writer::table($table);
+ }
+}
View
37 admin/replace.php
@@ -11,47 +11,42 @@
$search = optional_param('search', '', PARAM_RAW);
$replace = optional_param('replace', '', PARAM_RAW);
+$sure = optional_param('sure', 0, PARAM_BOOL);
###################################################################
echo $OUTPUT->header();
echo $OUTPUT->heading('Search and replace text throughout the whole database');
+if ($DB->get_dbfamily() !== 'mysql' and $DB->get_dbfamily() !== 'postgres') {
+ //TODO: add $DB->text_replace() to DML drivers
+ echo $OUTPUT->notification('Sorry, this feature is implemented only for MySQL and PostgreSQL databases.');
+ echo $OUTPUT->footer();
+ die;
+}
-if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Print a form
+if (!data_submitted() or !$search or !$replace or !confirm_sesskey() or !$sure) { /// Print a form
+ echo $OUTPUT->notification('This script is not supported, always make complete backup before proceeding!<br />This operation can not be reverted!');
echo $OUTPUT->box_start();
echo '<div class="mdl-align">';
- echo '<form action="replace.php" method="post">';
+ echo '<form action="replace.php" method="post"><div>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
- echo 'Search whole database for: <input type="text" name="search" /><br />';
- echo 'Replace with this string: <input type="text" name="replace" /><br />';
- echo '<input type="submit" value="Yes, do it now" /><br />';
- echo '</form>';
+ echo '<div><label for="search">Search whole database for: </label><input id="search" type="text" name="search" size="40" /> (usually previous server URL)</div>';
+ echo '<div><label for="replace">Replace with this string: </label><input type="text" id="replace" name="replace" size="40" /> (usually new server URL)</div>';
+ echo '<div><label for="sure">I understand the risks of this operation: </label><input type="checkbox" id="sure" name="sure" value="1" /></div>';
+ echo '<div class="buttons"><input type="submit" class="singlebutton" value="Yes, do it now" /></div>';
+ echo '</div></form>';
echo '</div>';
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
die;
}
echo $OUTPUT->box_start();
-
-if (!db_replace($search, $replace)) {
- print_error('erroroccur', debug);
-}
-
+db_replace($search, $replace);
echo $OUTPUT->box_end();
-/// Try to replace some well-known serialised contents (html blocks)
-echo $OUTPUT->notification('Replacing in html blocks...');
-$instances = $DB->get_recordset('block_instances', array('blockname' => 'html'));
-foreach ($instances as $instance) {
- $blockobject = block_instance('html', $instance);
- $blockobject->config->text = str_replace($search, $replace, $blockobject->config->text);
- $blockobject->instance_config_commit();
-}
-$instances->close();
-
/// Rebuild course cache which might be incorrect now
echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
View
6 admin/report/customlang/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="admin/report/customlang/db" VERSION="20101115" COMMENT="XMLDB file for Moodle admin/report/customlang"
+<XMLDB PATH="admin/report/customlang/db" VERSION="20110419" COMMENT="XMLDB file for Moodle admin/report/customlang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
@@ -30,11 +30,11 @@
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The normalized name of the plugin" PREVIOUS="id" NEXT="version"/>
- <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The checked out version of the plugin, null of the version is unknown" PREVIOUS="name"/>
+ <FIELD NAME="version" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The checked out version of the plugin, null if the version is unknown" PREVIOUS="name"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
View
13 admin/report/customlang/db/upgrade.php
@@ -57,5 +57,18 @@ function xmldb_report_customlang_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2010111500, 'report', 'customlang');
}
+ /**
+ * Change the version field from integer to varchar
+ */
+ if ($oldversion < 2011041900) {
+ $table = new xmldb_table('report_customlang_components');
+ $field = new xmldb_field('version', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'name');
+
+ $dbman->change_field_type($table, $field);
+
+ upgrade_plugin_savepoint(true, 2011041900, 'report', 'customlang');
+ }
+
+
return $result;
}
View
20 admin/report/customlang/index.php
@@ -24,6 +24,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+define('NO_OUTPUT_BUFFERING', true); // progress bar is used here
+
require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/locallib.php');
require_once($CFG->libdir.'/adminlib.php');
@@ -45,8 +47,22 @@
if (empty($lng)) {
print_error('missingparameter');
}
- report_customlang_utils::checkout($lng);
- redirect(new moodle_url('/admin/report/customlang/edit.php', array('lng' => $lng)));
+
+ $PAGE->set_cacheable(false); // progress bar is used here
+ $output = $PAGE->get_renderer('report_customlang');
+ echo $output->header();
+ echo $output->heading(get_string('pluginname', 'report_customlang'));
+ $progressbar = new progress_bar();
+ $progressbar->create(); // prints the HTML code of the progress bar
+
+ // we may need a bit of extra execution time and memory here
+ @set_time_limit(HOURSECS);
+ raise_memory_limit(MEMORY_EXTRA);
+ report_customlang_utils::checkout($lng, $progressbar);
+
+ echo $output->continue_button(new moodle_url('/admin/report/customlang/edit.php', array('lng' => $lng)), 'get');
+ echo $output->footer();
+ exit;
}
if ($action === 'checkin') {
View
4 admin/report/customlang/lang/en/report_customlang.php
@@ -27,7 +27,9 @@
defined('MOODLE_INTERNAL') || die();
$string['checkin'] = 'Check in strings into disk';
-$string['checkout'] = 'Check out strings into translator';
+$string['checkout'] = 'Check out strings into the translator';
+$string['checkoutdone'] = 'Strings checked out successfully into the translator';
+$string['checkoutinprogress'] = 'Checking out strings into the translator';
$string['confirmcheckin'] = 'You are about to check in modified strings into your local language pack. This will export the customized strings from the translator into the data directory and Moodle will start using the modified strings. Press \'Continue\' button to proceed check in.';
$string['customlang:edit'] = 'Edit local translation';
$string['customlang:view'] = 'View local translation';
View
25 admin/report/customlang/locallib.php
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Definition of classes used by Langugae customization admin report
+ * Definition of classes used by language customization admin report
*
* @package report
* @subpackage customlang
@@ -33,6 +33,12 @@
*/
class report_customlang_utils {
+ /**
+ * Rough number of strings that are being processed during a full checkout.
+ * This is used to estimate the progress of the checkout.
+ */