From 85f8fe5e1b6be400284b962f73d87d96ca59d138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 17 Jun 2015 22:32:14 +0200 Subject: [PATCH 1/2] MDL-50631 cli: Add a new function to display Moodle ASCII logo --- lib/clilib.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/clilib.php b/lib/clilib.php index be869e331dc..962a700f16e 100644 --- a/lib/clilib.php +++ b/lib/clilib.php @@ -176,3 +176,35 @@ function cli_error($text, $errorcode=1) { die($errorcode); } +/** + * Print an ASCII version of the Moodle logo. + * + * @param int $padding left padding of the logo + * @param bool $return should we print directly (false) or return the string (true) + * @return mixed void or string + */ +function cli_logo($padding=2, $return=false) { + + $lines = array( + ' .-..-. ', + ' _____ | || | ', + '/____/-.---_ .---. .---. .-.| || | .---. ', + '| | _ _ |/ _ \\/ _ \\/ _ || |/ __ \\', + '* | | | | | || |_| || |_| || |_| || || |___/', + ' |_| |_| |_|\\_____/\\_____/\\_____||_|\\_____)', + ); + + $logo = ''; + + foreach ($lines as $line) { + $logo .= str_repeat(' ', $padding); + $logo .= $line; + $logo .= PHP_EOL; + } + + if ($return) { + return $logo; + } else { + echo $logo; + } +} From 394034ec6e09bdd61788405528199c773ce83323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 17 Jun 2015 22:48:14 +0200 Subject: [PATCH 2/2] MDL-50631 cli: Display the Moodle ASCII logo in the CLI installer header --- admin/cli/install.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/cli/install.php b/admin/cli/install.php index acd6060d17f..e43430eccd3 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -286,6 +286,8 @@ if ($options['help']) { } //Print header +cli_logo(); +echo PHP_EOL; echo get_string('cliinstallheader', 'install', $CFG->target_release)."\n"; //Fist select language