Skip to content

Commit 1c40724

Browse files
committed
improved requirements checker error message about framework
1 parent 6bb488d commit 1c40724

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

requirements.php

+13-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@
2828
}
2929
}
3030

31-
if (!is_dir($frameworkPath)) {
32-
echo '<h1>Error</h1>';
33-
echo '<p><strong>The path to yii framework seems to be incorrect.</strong></p>';
34-
echo '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . '</abbr>.</p>';
35-
echo '<p>Please refer to the <abbr title="' . dirname(__FILE__) . '/README.md">README</abbr> on how to install Yii.</p>';
31+
if (!isset($frameworkPath) || !is_dir($frameworkPath)) {
32+
$message = "<h1>Error</h1>\n\n"
33+
. "<p><strong>The path to yii framework seems to be incorrect.</strong></p>\n"
34+
. '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . "</abbr>.</p>\n"
35+
. '<p>Please refer to the <abbr title="' . dirname(__FILE__) . "/README.md\">README</abbr> on how to install Yii.</p>\n";
36+
37+
if (!empty($_SERVER['argv'])) {
38+
// do not print HTML when used in console mode
39+
echo strip_tags($message);
40+
} else {
41+
echo $message;
42+
}
43+
exit(1);
3644
}
3745

3846
require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');

0 commit comments

Comments
 (0)