MDL-60365 tool_mobile: Extra configuration checks

This commit is contained in:
Juan Leyva
2017-10-12 11:46:18 +02:00
parent 23ab0d7788
commit 66a159f8db
4 changed files with 128 additions and 8 deletions
+5 -8
View File
@@ -8746,17 +8746,14 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox {
* @return string XHTML
*/
public function output_html($data, $query='') {
global $CFG, $OUTPUT;
global $OUTPUT;
$html = parent::output_html($data, $query);
if ((string)$data === $this->yes) {
require_once($CFG->dirroot . "/lib/filelib.php");
$curl = new curl();
$httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot); //force https url
$curl->head($httpswwwroot . "/login/index.php");
$info = $curl->get_info();
if (empty($info['http_code']) or ($info['http_code'] >= 400)) {
$html .= $OUTPUT->notification(get_string('nohttpsformobilewarning', 'admin'));
$notifications = tool_mobile\api::get_potential_config_issues(); // Safe to call, plugin available if we reach here.
foreach ($notifications as $notification) {
$message = get_string($notification[0], $notification[1]);
$html .= $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING);
}
}