|
174 | 174 | // Check some PHP server settings
|
175 | 175 |
|
176 | 176 | if (ini_get_bool('session.auto_start')) {
|
177 |
| - print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink)); |
| 177 | + throw new \moodle_exception('phpvaroff', 'debug', '', |
| 178 | + (object)array('name' => 'session.auto_start', 'link' => $documentationlink)); |
178 | 179 | }
|
179 | 180 |
|
180 | 181 | if (!ini_get_bool('file_uploads')) {
|
181 |
| - print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink)); |
| 182 | + throw new \moodle_exception('phpvaron', 'debug', '', |
| 183 | + (object)array('name' => 'file_uploads', 'link' => $documentationlink)); |
182 | 184 | }
|
183 | 185 |
|
184 | 186 | if (is_float_problem()) {
|
185 |
| - print_error('phpfloatproblem', 'admin', '', $documentationlink); |
| 187 | + throw new \moodle_exception('phpfloatproblem', 'admin', '', $documentationlink); |
186 | 188 | }
|
187 | 189 |
|
188 | 190 | // Set some necessary variables during set-up to avoid PHP warnings later on this page
|
|
203 | 205 | $CFG->target_release = $release; // used during installation and upgrades
|
204 | 206 |
|
205 | 207 | if (!$version or !$release) {
|
206 |
| - print_error('withoutversion', 'debug'); // without version, stop |
| 208 | + throw new \moodle_exception('withoutversion', 'debug'); // Without version, stop. |
207 | 209 | }
|
208 | 210 |
|
209 | 211 | if (!core_tables_exist()) {
|
|
275 | 277 | if (!$DB->setup_is_unicodedb()) {
|
276 | 278 | if (!$DB->change_db_encoding()) {
|
277 | 279 | // If could not convert successfully, throw error, and prevent installation
|
278 |
| - print_error('unicoderequired', 'admin'); |
| 280 | + throw new \moodle_exception('unicoderequired', 'admin'); |
279 | 281 | }
|
280 | 282 | }
|
281 | 283 |
|
|
297 | 299 | $PAGE->set_context(context_system::instance());
|
298 | 300 |
|
299 | 301 | if (empty($CFG->version)) {
|
300 |
| - print_error('missingconfigversion', 'debug'); |
| 302 | + throw new \moodle_exception('missingconfigversion', 'debug'); |
301 | 303 | }
|
302 | 304 |
|
303 | 305 | // Detect config cache inconsistency, this happens when you switch branches on dev servers.
|
|
748 | 750 | redirect("index.php?sessionstarted=1&sessionverify=1&lang=$CFG->lang");
|
749 | 751 | } else {
|
750 | 752 | if (empty($SESSION->sessionverify)) {
|
751 |
| - print_error('installsessionerror', 'admin', "index.php?sessionstarted=1&lang=$CFG->lang"); |
| 753 | + throw new \moodle_exception('installsessionerror', 'admin', "index.php?sessionstarted=1&lang=$CFG->lang"); |
752 | 754 | }
|
753 | 755 | unset($SESSION->sessionverify);
|
754 | 756 | }
|
|
765 | 767 | if ($adminuser->password === 'adminsetuppending') {
|
766 | 768 | // prevent installation hijacking
|
767 | 769 | if ($adminuser->lastip !== getremoteaddr()) {
|
768 |
| - print_error('installhijacked', 'admin'); |
| 770 | + throw new \moodle_exception('installhijacked', 'admin'); |
769 | 771 | }
|
770 | 772 | // login user and let him set password and admin details
|
771 | 773 | $adminuser->newadminuser = 1;
|
|
0 commit comments