From 39fda04cdcd82c8f56b50c34c40e35f29bcbf868 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Sun, 1 Sep 2024 01:51:09 +0200 Subject: [PATCH] MDL-73700 core: remove unused functions and strings from installer While searching for no longer needed PHP 5.x & 7.0 checks, the `phpversionhelp` lang string and, subsequently, the `memorylimithelp` lang string and the `install_helpbutton()` and `install_print_help_page()` functions were discovered. According to comments on MDL-2787 and MDL-64482 they are no longer in use since Moodle 1.x (approximately), neither reachable since some good versions ago. With MDL-17458 (commit 3b09331066a91c51a2de1676ca8179ca7c90f64b), the function `print_compatibility_row()` was gone, and it seems like it was the only place calling `install_helpbutton()`. And `install_helpbutton()` was the only place where a link to the help mode (e.g. `install.php?help=$helpfield`) ever surfaced. As both lang strings and functions are particular to the installer and never could have been used outside of it, we are going for direct deletion instead of regular deprecation. Signed-off-by: Daniel Ziegenberg --- install.php | 5 ---- install/stringnames.txt | 2 -- lang/en/install.php | 22 ---------------- lib/installlib.php | 58 ----------------------------------------- 4 files changed, 87 deletions(-) diff --git a/install.php b/install.php index c0137efbcda..0878e7192a2 100644 --- a/install.php +++ b/install.php @@ -240,11 +240,6 @@ $hint_dataroot = ''; $hint_admindir = ''; $hint_database = ''; -// Are we in help mode? -if (isset($_GET['help'])) { - install_print_help_page($_GET['help']); -} - //first time here? find out suitable dataroot if (is_null($CFG->dataroot)) { $CFG->dataroot = __DIR__.'/../moodledata'; diff --git a/install/stringnames.txt b/install/stringnames.txt index c2b4c1f5491..f540aeba335 100644 --- a/install/stringnames.txt +++ b/install/stringnames.txt @@ -42,7 +42,6 @@ installation,install invalidmd5,error langdownloaderror,install language,moodle -memorylimithelp,install missingrequiredfield,error moodlelogo,moodle next,moodle @@ -59,7 +58,6 @@ pathssubwwwroot,install pathsunsecuredataroot,install pathswrongadmindir,install phpextension,install -phpversionhelp,install phpversion,install previous,moodle reload,moodle diff --git a/lang/en/install.php b/lang/en/install.php index da0bf4da0f5..59db172c741 100644 --- a/lang/en/install.php +++ b/lang/en/install.php @@ -150,25 +150,6 @@ $string['langdownloaderror'] = 'Unfortunately the language "{$a}" could not be d $string['langdownloadok'] = 'The language "{$a}" was installed successfully. The installation process will continue in this language.'; $string['memorylimit'] = 'Memory limit'; $string['memorylimiterror'] = 'The PHP memory limit is set quite low ... you may run into problems later.'; -$string['memorylimithelp'] = '

The PHP memory limit for your server is currently set to {$a}.

- -

This may cause Moodle to have memory problems later on, especially - if you have a lot of modules enabled and/or a lot of users.

- -

We recommend that you configure PHP with a higher limit if possible, like 40M. - There are several ways of doing this that you can try:

-
    -
  1. If you are able to, recompile PHP with --enable-memory-limit. - This will allow Moodle to set the memory limit itself.
  2. -
  3. If you have access to your php.ini file, you can change the memory_limit - setting in there to something like 40M. If you don\'t have access you might - be able to ask your administrator to do this for you.
  4. -
  5. On some PHP servers you can create a .htaccess file in the Moodle directory - containing this line: -
    php_value memory_limit 40M
    -

    However, on some servers this will prevent all PHP pages from working - (you will see errors when you look at pages) so you\'ll have to remove the .htaccess file.

  6. -
'; $string['mysqliextensionisnotpresentinphp'] = 'PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP.'; $string['nativeauroramysql'] = 'Aurora MySQL (native/auroramysql)'; $string['nativeauroramysqlhelp'] = '

The database is where most of the Moodle settings and data are stored and must be configured here.

@@ -218,9 +199,6 @@ $string['pathswrongadmindir'] = 'Admin directory does not exist'; $string['pgsqlextensionisnotpresentinphp'] = 'PHP has not been properly configured with the PGSQL extension so that it can communicate with PostgreSQL. Please check your php.ini file or recompile PHP.'; $string['phpextension'] = '{$a} PHP extension'; $string['phpversion'] = 'PHP version'; -$string['phpversionhelp'] = '

Moodle requires a PHP version of at least 5.6.5 or 7.1 (7.0.x has some engine limitations).

-

You are currently running version {$a}.

-

You must upgrade PHP or move to a host with a newer version of PHP.

'; $string['releasenoteslink'] = 'For information about this version of Moodle, please see the release notes at {$a}'; $string['safemode'] = 'Safe mode'; $string['safemodeerror'] = 'Moodle may have trouble with safe mode on'; diff --git a/lib/installlib.php b/lib/installlib.php index e185374459e..02198ae1ebf 100644 --- a/lib/installlib.php +++ b/lib/installlib.php @@ -149,23 +149,6 @@ function install_init_dataroot($dataroot, $dirpermissions) { return true; } -/** - * Print help button - * @param string $url - * @param string $titel - * @return void - */ -function install_helpbutton($url, $title='') { - if ($title == '') { - $title = get_string('help'); - } - echo ""; - echo "\"$title\""; - echo "\n"; -} - /** * This is in function because we want the /install.php to parse in PHP4 * @@ -275,47 +258,6 @@ function install_generate_configphp($database, $cfg) { return $configphp; } -/** - * Prints complete help page used during installation. - * Does not return. - * - * @global object - * @param string $help - */ -function install_print_help_page($help) { - global $CFG, $OUTPUT; //TODO: MUST NOT USE $OUTPUT HERE!!! - - @header('Content-Type: text/html; charset=UTF-8'); - @header('X-UA-Compatible: IE=edge'); - @header('Cache-Control: no-store, no-cache, must-revalidate'); - @header('Cache-Control: post-check=0, pre-check=0', false); - @header('Pragma: no-cache'); - @header('Expires: Mon, 20 Aug 1969 09:23:00 GMT'); - @header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - - echo ''; - echo ' - - - - '.get_string('installation','install').' - - '; - switch ($help) { - case 'phpversionhelp': - print_string($help, 'install', phpversion()); - break; - case 'memorylimithelp': - print_string($help, 'install', @ini_get('memory_limit')); - break; - default: - print_string($help, 'install'); - } - echo $OUTPUT->close_window_button(); //TODO: MUST NOT USE $OUTPUT HERE!!! - echo ''; - die; -} - /** * Prints installation page header, we can not use weblib yet in installer. *