Merge pull request #146 from yiisoft/requirements-searchpath
search for framework path in requirements.php
This commit is contained in:
commit
53d896e18b
@ -11,13 +11,36 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// you may need to adjust this path to the correct Yii framework path
|
// you may need to adjust this path to the correct Yii framework path
|
||||||
$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2';
|
// uncomment and adjust the following line if Yii is not located at the default path
|
||||||
|
//$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2';
|
||||||
|
|
||||||
if (!is_dir($frameworkPath)) {
|
|
||||||
echo '<h1>Error</h1>';
|
if (!isset($frameworkPath)) {
|
||||||
echo '<p><strong>The path to yii framework seems to be incorrect.</strong></p>';
|
$searchPaths = [
|
||||||
echo '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . '</abbr>.</p>';
|
dirname(__FILE__) . '/vendor/yiisoft/yii2',
|
||||||
echo '<p>Please refer to the <abbr title="' . dirname(__FILE__) . '/README.md">README</abbr> on how to install Yii.</p>';
|
dirname(__FILE__) . '/../vendor/yiisoft/yii2',
|
||||||
|
];
|
||||||
|
foreach($searchPaths as $path) {
|
||||||
|
if (is_dir($path)) {
|
||||||
|
$frameworkPath = $path;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($frameworkPath) || !is_dir($frameworkPath)) {
|
||||||
|
$message = "<h1>Error</h1>\n\n"
|
||||||
|
. "<p><strong>The path to yii framework seems to be incorrect.</strong></p>\n"
|
||||||
|
. '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . "</abbr>.</p>\n"
|
||||||
|
. '<p>Please refer to the <abbr title="' . dirname(__FILE__) . "/README.md\">README</abbr> on how to install Yii.</p>\n";
|
||||||
|
|
||||||
|
if (!empty($_SERVER['argv'])) {
|
||||||
|
// do not print HTML when used in console mode
|
||||||
|
echo strip_tags($message);
|
||||||
|
} else {
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
|
require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
|
||||||
|
Loading…
Reference in New Issue
Block a user