Skip to content

Commit

Permalink
fix(YesWikiLoader): better catch error if file not existing (otherwis…
Browse files Browse the repository at this point in the history
…e catching depends on php.ini)
  • Loading branch information
J9rem committed Feb 9, 2022
1 parent aa7fea2 commit ef0d9a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/YesWikiLoader.php
Expand Up @@ -13,6 +13,7 @@
namespace YesWiki\Core;

use Doctrine\Common\Annotations\AnnotationRegistry;
use Exception;
use Throwable;
use YesWiki\Wiki;

Expand All @@ -33,13 +34,12 @@ public static function getWiki(bool $test = false): Wiki
if (is_null(self::$wiki)) {
require_once 'includes/autoload.inc.php';
try {
$loader = require_once 'vendor/autoload.php';
} catch (Throwable $th) {
$message = "";
if (!file_exists('vendor/autoload.php')) {
$message .= "ERROR ! : Folder `vendor/` seems not to be entirely copied ! (Maybe a YesWiki update aborted before its end !)<br/><strong>Could you manually copy the folder `vendor/` on your server by ftp ?</strong><br/>";
throw new Exception("ERROR ! : Folder `vendor/` seems not to be entirely copied ! (Maybe a YesWiki update aborted before its end !)<br/><strong>Could you manually copy the folder `vendor/` on your server by ftp ?</strong><br/>");
}
$message .= $th->getMessage();
$loader = require_once 'vendor/autoload.php';
} catch (Throwable $th) {
$message = $th->getMessage();
// echo message directly because TemplateEngine not ready here
echo "<div style=\"border:1px red solid;background-color: #FFCCCC;margin:3px;padding:5px;border-radius:5px;\">$message</div>";
exit();
Expand Down

0 comments on commit ef0d9a9

Please sign in to comment.