show install error if vendor folder does not exist

this should help deter non-dev users from installing shimmie from the master/dev branches
This commit is contained in:
Daku 2016-05-19 17:11:03 +01:00
parent abababc57a
commit f28e78b6f0

View File

@ -58,8 +58,6 @@ date_default_timezone_set('UTC');
} }
#installer H3 { #installer H3 {
border-bottom: 1px solid black; border-bottom: 1px solid black;
border-top: 1px solid black;
margin-top: 32px;
} }
</style> </style>
<script type="text/javascript" src="lib/vendor/js/jquery-1.12.3.min.js"></script> <script type="text/javascript" src="lib/vendor/js/jquery-1.12.3.min.js"></script>
@ -78,6 +76,18 @@ date_default_timezone_set('UTC');
</div> </div>
</div> </div>
<pre style="display:none"> <pre style="display:none">
<?php } elseif(!file_exists("vendor/")) { ?>
<div id="installer">
<h1>Install Error</h1>
<h3>Warning: Composer vendor folder does not exist!</h3>
<div class="container">
<p>Shimmie is unable to find the composer vendor directory.<br>
Have you followed the composer setup instructions found in the <a href="https://github.com/shish/shimmie2#installation-development">README</a>?</>
<p>If you are not intending to do any development with Shimmie, it is highly recommend you use one of the pre-packaged releases found on <a href="https://github.com/shish/shimmie2/releases">Github</a> instead.</p>
</div>
</div>
<pre style="display:none">
<?php } <?php }
assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_BAIL, 1); assert_options(ASSERT_BAIL, 1);
@ -295,8 +305,8 @@ function create_tables() { // {{{
print <<<EOD print <<<EOD
<div id="installer"> <div id="installer">
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<div class="container">
<h3>Warning: The Database schema is not empty!</h3> <h3>Warning: The Database schema is not empty!</h3>
<div class="container">
<p>Please ensure that the database you are installing Shimmie with is empty before continuing.</p> <p>Please ensure that the database you are installing Shimmie with is empty before continuing.</p>
<p>Once you have emptied the database of any tables, please hit 'refresh' to continue.</p> <p>Once you have emptied the database of any tables, please hit 'refresh' to continue.</p>
<br/><br/> <br/><br/>
@ -416,12 +426,14 @@ function build_dirs() { // {{{
<div id='installer'> <div id='installer'>
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<h3>Directory Permissions Error:</h3> <h3>Directory Permissions Error:</h3>
<div class='container'>
<p>Shimmie needs to make three folders in it's directory, '<i>images</i>', '<i>thumbs</i>', and '<i>data</i>', and they need to be writable by the PHP user.</p> <p>Shimmie needs to make three folders in it's directory, '<i>images</i>', '<i>thumbs</i>', and '<i>data</i>', and they need to be writable by the PHP user.</p>
<p>If you see this error, if probably means the folders are owned by you, and they need to be writable by the web server.</p> <p>If you see this error, if probably means the folders are owned by you, and they need to be writable by the web server.</p>
<p>PHP reports that it is currently running as user: ".$_ENV["USER"]." (". $_SERVER["USER"] .")</p> <p>PHP reports that it is currently running as user: ".$_ENV["USER"]." (". $_SERVER["USER"] .")</p>
<p>Once you have created these folders and / or changed the ownership of the shimmie folder, hit 'refresh' to continue.</p> <p>Once you have created these folders and / or changed the ownership of the shimmie folder, hit 'refresh' to continue.</p>
<br/><br/> <br/><br/>
</div> </div>
</div>
"; ";
exit(7); exit(7);
} }
@ -442,8 +454,10 @@ function write_config() { // {{{
<div id="installer"> <div id="installer">
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<h3>Things are OK \o/</h3> <h3>Things are OK \o/</h3>
<div class="container">
<p>If you aren't redirected, <a href="index.php">click here to Continue</a>. <p>If you aren't redirected, <a href="index.php">click here to Continue</a>.
</div> </div>
</div>
EOD; EOD;
} }
else { else {
@ -452,6 +466,7 @@ EOD;
<div id="installer"> <div id="installer">
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<h3>File Permissions Error:</h3> <h3>File Permissions Error:</h3>
<div class="container">
The web server isn't allowed to write to the config file; please copy The web server isn't allowed to write to the config file; please copy
the text below, save it as 'data/config/shimmie.conf.php', and upload it into the shimmie the text below, save it as 'data/config/shimmie.conf.php', and upload it into the shimmie
folder manually. Make sure that when you save it, there is no whitespace folder manually. Make sure that when you save it, there is no whitespace
@ -462,6 +477,7 @@ EOD;
<p>Once done, <a href="index.php">click here to Continue</a>. <p>Once done, <a href="index.php">click here to Continue</a>.
<br/><br/> <br/><br/>
</div> </div>
</div>
EOD; EOD;
} }
echo "\n"; echo "\n";
@ -472,8 +488,8 @@ function handle_db_errors(/*bool*/ $isPDO, /*str*/ $errorMessage1, /*str*/ $err
print <<<EOD print <<<EOD
<div id="installer"> <div id="installer">
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<div class="container">
<h3>Unknown Error:</h3> <h3>Unknown Error:</h3>
<div class="container">
<p>{$errorMessage1}</p> <p>{$errorMessage1}</p>
<p>{$errorMessage1Extra}</p> <p>{$errorMessage1Extra}</p>
<p>{$errorMessage2}</p> <p>{$errorMessage2}</p>