improve error message display on missing vendor-folder

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-06-25 11:10:32 +02:00
parent bdd583d251
commit 5dfb74701c
4 changed files with 65 additions and 9 deletions

View File

@@ -15,8 +15,13 @@
* @package Install
*
*/
if(!file_exists(dirname(__DIR__) . '/vendor/autoload.php')){
die('Vendor does not exist. Please run "composer install". For more informationen https://github.com/Froxlor/Froxlor/wiki');
if (! file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
// get hint-template
$vendor_hint = file_get_contents(dirname(__DIR__) . '/templates/Sparkle/misc/vendormissinghint.tpl');
// replace values
$vendor_hint = str_replace("<FROXLOR_INSTALL_DIR>", dirname(__DIR__), $vendor_hint);
$vendor_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $vendor_hint);
die($vendor_hint);
}
require dirname(__DIR__) . '/vendor/autoload.php';
require __DIR__ . '/lib/class.FroxlorInstall.php';

View File

@@ -16,8 +16,17 @@
* @package System
*
*/
if(!file_exists(dirname(__DIR__) . '/vendor/autoload.php')){
die('Vendor does not exist. Please run "composer install". For more informationen https://github.com/Froxlor/Froxlor/wiki');
// define default theme for configurehint, etc.
$_deftheme = 'Sparkle';
if (! file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
// get hint-template
$vendor_hint = file_get_contents(dirname(__DIR__) . '/templates/' . $_deftheme . '/misc/vendormissinghint.tpl');
// replace values
$vendor_hint = str_replace("<FROXLOR_INSTALL_DIR>", dirname(__DIR__), $vendor_hint);
$vendor_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $vendor_hint);
die($vendor_hint);
}
require dirname(__DIR__) . '/vendor/autoload.php';
@@ -72,9 +81,6 @@ unset($key);
$filename = htmlentities(basename($_SERVER['PHP_SELF']));
// define default theme for configurehint, etc.
$_deftheme = 'Sparkle';
// check whether the userdata file exists
if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php')) {
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/configurehint.tpl');
@@ -92,7 +98,7 @@ if (! is_readable(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php'))
// replace values
$owner_hint = str_replace("<USER>", $posixusername['name'], $owner_hint);
$owner_hint = str_replace("<GROUP>", $posixgroup['name'], $owner_hint);
$owner_hint = str_replace("<\Froxlor\Froxlor::getInstallDir()>", \Froxlor\Froxlor::getInstallDir(), $owner_hint);
$owner_hint = str_replace("<FROXLOR_INSTALL_DIR>", \Froxlor\Froxlor::getInstallDir(), $owner_hint);
$owner_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $owner_hint);
// show
die($owner_hint);

View File

@@ -25,7 +25,7 @@
<p>&nbsp;</p>
<p>This mostly happens due to wrong ownership.<br />Try the following command to correct the ownership:</p>
<p>&nbsp;</p>
<p><pre>chown -R <USER>:<GROUP> <\Froxlor\Froxlor::getInstallDir()></pre></p>
<p><pre>chown -R <USER>:<GROUP> <FROXLOR_INSTALL_DIR></pre></p>
</div>
</div>
<aside class="right">

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Default-Style" content="text/css" />
<link rel="stylesheet" href="templates/Sparkle/assets/css/main.css" />
<!--[if IE]><link rel="stylesheet" href="templates/Sparkle/assets/css/main_ie.css" /><![endif]-->
<!--[if lt IE 9]><script src="js/html5shiv.min.js"></script><![endif]-->
<link href="templates/Sparkle/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
<title>Froxlor Server Management Panel - Installation</title>
</head>
<body>
<div class="loginpage">
<article class="errorbox bradius">
<header class="dark">
<img src="templates/Sparkle/assets/img/logo.png" alt="Froxlor Server Management Panel" />
</header>
<section class="errorsec">
<div class="errorcontainer bradius">
<div class="errortitle">Whoops!</div>
<div class="error">
<p>It seems you are missing some required files.</p>
<p>&nbsp;</p>
<p>Froxlor uses composer for its external requirements.<br />Try the following command to install them:</p>
<p>&nbsp;</p>
<p><pre>cd <FROXLOR_INSTALL_DIR> && composer install --no-dev</pre></p>
</div>
</div>
<aside class="right">
<a href="index.php" title="Click to refresh">Refresh</a>
</aside>
</section>
</article>
</div>
<footer>
<span>
Froxlor &copy; 2009-<CURRENT_YEAR> by <a href="https://www.froxlor.org/" rel="external">the Froxlor Team</a>
</span>
</footer>
</body>
</html>