From c01678b1d2e55fd97c3d225057c7762f371ffa54 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 7 Nov 2009 09:31:20 +0000 Subject: [PATCH] MDL-20767 can not use messaging in upgrade and fatal errors in strings --- lang/en_utf8/admin.php | 22 ++-------------------- lib/db/upgrade.php | 20 +++++--------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index cc8af818b4..fa092b8ed7 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -39,28 +39,10 @@ $string['blockmultiple'] = 'Multiple'; $string['blocksettings'] = 'Manage blocks'; $string['bloglevel'] = 'Blog visibility'; $string['bloglevelupgrade'] = 'Blog visibility upgrade'; -$string['bloglevelupgradebody'] = 'Hi! You are receiving this message as an administrator of $a->sitename. - -This site has recently been upgraded to Moodle 2.0. - -Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. - -To preserve the course-based or group-based visibility of the blog entries on your site, you need to run the following upgrade script, which will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. - -Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process. - -You can run the script by visiting $a->fixurl. -'; -$string['bloglevelupgradehtml'] = '

Hi! You are receiving this message as an administrator of $a->sitename.

- -

This site has recently been upgraded to Moodle 2.0.

- +$string['bloglevelupgradedescription'] = '

This site has recently been upgraded to Moodle 2.0.

Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types.

- -

To preserve the course-based or group-based visibility of the blog entries on your site, you need to run the following upgrade script, which will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum.

- +

To preserve the course-based or group-based visibility of the blog entries on your site, you need to run the following upgrade script, which will create a special \"blog\" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum.

Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.

-

You can run the script by visiting fixurl\">the blog level upgrade page.

'; $string['bloglevelupgradeinfo'] = 'Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. To preserve the course-based or group-based visibility of the blog entries on your site, the following upgrade script will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.'; $string['bloglevelupgradenotice'] = 'Your site is using an old blog visibility setting, the blog visibility upgrade is recommended.'; diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 14580b7776..781992782d 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2686,21 +2686,11 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); $a->sitename = $site->fullname; $a->fixurl = "$CFG->wwwroot/$CFG->admin/bloglevelupgrade.php"; - $subject = get_string('bloglevelupgrade', 'admin'); - $plainbody = get_string('bloglevelupgradebody', 'admin', $a); - $htmlbody = get_string('bloglevelupgradehtml', 'admin', $a); - - foreach ($admins as $admin) { - $eventdata = new object(); - $eventdata->component = 'moodle'; - $eventdata->userfrom = $USER; - $eventdata->userto = $admin; - $eventdata->subject = $subject; - $eventdata->fullmessage = $plainbody; - $eventdata->fullmessageformat = FORMAT_PLAIN; - $eventdata->fullmessagehtml = $htmlbody; - events_trigger('message_send', $eventdata); - } + $subject = get_string('bloglevelupgrade', 'admin'); + $description = get_string('bloglevelupgradedescription', 'admin', $a); + + // can not use messaging here because it is not configured yet! + upgrade_log(UPGRADE_LOG_NOTICE, null, $subject, $description); } /// Main savepoint reached upgrade_main_savepoint($result, 2009103000); -- 2.39.5