From c74748c6bdbffe157fca749de8af8018c48eda95 Mon Sep 17 00:00:00 2001 From: John Okely Date: Thu, 31 Aug 2017 16:41:33 +0800 Subject: [PATCH] MDL-46269 tool_httpsreplace: Add more info and warnings about the tool --- admin/tool/httpsreplace/cli/url_finder.php | 4 ++++ admin/tool/httpsreplace/cli/url_replace.php | 4 ++++ admin/tool/httpsreplace/index.php | 7 ++++--- .../httpsreplace/lang/en/tool_httpsreplace.php | 14 ++++++++------ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/admin/tool/httpsreplace/cli/url_finder.php b/admin/tool/httpsreplace/cli/url_finder.php index 62bbb14ed64c8..82bd3744db722 100644 --- a/admin/tool/httpsreplace/cli/url_finder.php +++ b/admin/tool/httpsreplace/cli/url_finder.php @@ -41,6 +41,10 @@ exit(0); } +if (!is_https()) { + echo $OUTPUT->notification(get_string('httpwarning', 'tool_httpsreplace'), 'warning'); +} + $urlfinder = new \tool_httpsreplace\url_finder(); $results = $urlfinder->http_link_stats(); $fp = fopen('php://stdout', 'w'); diff --git a/admin/tool/httpsreplace/cli/url_replace.php b/admin/tool/httpsreplace/cli/url_replace.php index ef95a5c5ad5ab..33e4affbb1932 100644 --- a/admin/tool/httpsreplace/cli/url_replace.php +++ b/admin/tool/httpsreplace/cli/url_replace.php @@ -41,5 +41,9 @@ exit(0); } +if (!is_https()) { + echo $OUTPUT->notification(get_string('httpwarning', 'tool_httpsreplace'), 'warning'); +} + $urlfinder = new \tool_httpsreplace\url_finder(); $urlfinder->upgrade_http_links(); diff --git a/admin/tool/httpsreplace/index.php b/admin/tool/httpsreplace/index.php index 8e4abb7130314..8f3974aa175ab 100644 --- a/admin/tool/httpsreplace/index.php +++ b/admin/tool/httpsreplace/index.php @@ -50,9 +50,9 @@ die; } -echo $OUTPUT->box_start(); -echo $OUTPUT->notification(get_string('takeabackupwarning', 'tool_httpsreplace')); -echo $OUTPUT->box_end(); +if (!is_https()) { + echo $OUTPUT->notification(get_string('httpwarning', 'tool_httpsreplace'), 'warning'); +} $form = new \tool_httpsreplace\form(); @@ -89,6 +89,7 @@ $table->data = $data; echo html_writer::table($table); } + echo $OUTPUT->notification(get_string('takeabackupwarning', 'tool_httpsreplace'), 'warning'); $form->display(); } else { // Scroll to the end when finished. diff --git a/admin/tool/httpsreplace/lang/en/tool_httpsreplace.php b/admin/tool/httpsreplace/lang/en/tool_httpsreplace.php index b24d59a5df72e..55c80365c8681 100644 --- a/admin/tool/httpsreplace/lang/en/tool_httpsreplace.php +++ b/admin/tool/httpsreplace/lang/en/tool_httpsreplace.php @@ -28,12 +28,14 @@ $string['doclink'] = 'Read more documentation on the wiki'; $string['doit'] = 'Perform replacement'; $string['domain'] = 'Problematic domain'; -$string['domainexplain'] = 'When an instance is moved from http to https, all embeded http content will stop working. This tool always you to automatically convert the http content to https. Below is a report of content that may not work once you run this script. You may want to check each one has https available or find alternative resources.'; -$string['domainexplainhelp'] = 'These domains are found in your content, but do not appear to support https content. After switching to https, the content included from these sites will no longer display within Moodle for users with secure modern browsers. It is possible that these sites are temporarily or permanently unavailable and will not work with either security setting. Proceed only after reviewing these results and determining if this externally hosted content is non-essential.'; +$string['domainexplain'] = 'When an instance is moved from HTTP to HTTPS, all embeded HTTP content will stop working. This tool always you to automatically convert the HTTP content to HTTPS. Below is a report of content that may not work once you run this script. You may want to check each one has HTTPS available or find alternative resources.'; +$string['domainexplainhelp'] = 'These domains are found in your content, but do not appear to support HTTPS content. After switching to HTTPS, the content included from these sites will no longer display within Moodle for users with secure modern browsers. It is possible that these sites are temporarily or permanently unavailable and will not work with either security setting. Proceed only after reviewing these results and determining if this externally hosted content is non-essential.'; +$string['httpwarning'] = 'This instance is still running on HTTP. You can still run this tool and external content will be changed to HTTPS, but internal content will remain on HTTP. You will need to run this script again after switching to HTTPS to convert internal content.'; $string['notimplemented'] = 'Sorry, this feature is not implemented in your database driver.'; -$string['oktoprocede'] = 'The scan finds no issues with your content. You can proceed to upgrade any http content to use https.'; -$string['pageheader'] = 'Upgrade externally hosted content urls to https'; +$string['oktoprocede'] = 'The scan finds no issues with your content. You can proceed to upgrade any HTTP content to use HTTPS.'; +$string['pageheader'] = 'Upgrade externally hosted content urls to HTTPS'; $string['pluginname'] = 'HTTPS conversion tool'; -$string['replacing'] = 'Replacing http content with https...'; +$string['replacing'] = 'Replacing HTTP content with HTTPS...'; $string['searching'] = 'Searching {$a}'; -$string['takeabackupwarning'] = 'Once this tool run, changes made can\'t be reverted. A complete backup should be made before running this script! There is a low risk that the wrong content will be replaced, introducing problems.'; +$string['takeabackupwarning'] = 'Once this is tool run, changes made can\'t be reverted. A complete backup should be made before running this script. There is a low risk that the wrong content will be replaced, introducing problems.'; +$string['toolintro'] = 'If you are planning on converting your site to HTTPS, you can use the HTTPS conversion tool to convert your embeded content to HTTPS.';