mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-11 23:34:30 +02:00
RuntimeException instead of die()
This commit is contained in:
parent
38693521b3
commit
13d0718780
@ -6,7 +6,7 @@ require_once BASE . 'config.local.php';
|
|||||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||||
{
|
{
|
||||||
header('Location: ' . BASE_URL . 'install/');
|
header('Location: ' . BASE_URL . 'install/');
|
||||||
die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
define('ADMIN_PANEL', true);
|
define('ADMIN_PANEL', true);
|
||||||
|
@ -65,7 +65,7 @@ if(config('env') === 'dev') {
|
|||||||
if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE . 'install'))
|
if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE . 'install'))
|
||||||
{
|
{
|
||||||
header('Location: ' . BASE_URL . 'install/');
|
header('Location: ' . BASE_URL . 'install/');
|
||||||
die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
@ -183,7 +183,7 @@ $twig->addGlobal('status', $status);
|
|||||||
|
|
||||||
// verify myaac tables exists in database
|
// verify myaac tables exists in database
|
||||||
if(!$db->hasTable('myaac_account_actions')) {
|
if(!$db->hasTable('myaac_account_actions')) {
|
||||||
die('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// database migrations
|
// database migrations
|
||||||
|
@ -57,7 +57,7 @@ if($step == 'finish' && (!isset($config['installed']) || !$config['installed']))
|
|||||||
// step verify
|
// step verify
|
||||||
$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => 'finish');
|
$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => 'finish');
|
||||||
if(!in_array($step, $steps)) // check if step is valid
|
if(!in_array($step, $steps)) // check if step is valid
|
||||||
die('ERROR: Unknown step.');
|
throw new RuntimeException('ERROR: Unknown step.');
|
||||||
|
|
||||||
$install_status['step'] = $step;
|
$install_status['step'] = $step;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
@ -903,7 +903,7 @@ function load_config_lua($filename)
|
|||||||
if(!@file_exists($config_file))
|
if(!@file_exists($config_file))
|
||||||
{
|
{
|
||||||
log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true));
|
log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true));
|
||||||
die('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log');
|
throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
@ -949,7 +949,7 @@ function load_config_lua($filename)
|
|||||||
$ret = @eval("return $value;");
|
$ret = @eval("return $value;");
|
||||||
if((string) $ret == '') // = parser error
|
if((string) $ret == '') // = parser error
|
||||||
{
|
{
|
||||||
die('ERROR: Loading config.lua file. Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]');
|
throw new RuntimeException('ERROR: Loading config.lua file. Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]');
|
||||||
}
|
}
|
||||||
$result[$key] = $ret;
|
$result[$key] = $ret;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ if(file_exists(BASE . 'config.local.php')) // user customizations
|
|||||||
require BASE . 'config.local.php';
|
require BASE . 'config.local.php';
|
||||||
|
|
||||||
if(!isset($config['installed']) || !$config['installed']) {
|
if(!isset($config['installed']) || !$config['installed']) {
|
||||||
die('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||||
}
|
}
|
||||||
|
|
||||||
date_default_timezone_set($config['date_timezone']);
|
date_default_timezone_set($config['date_timezone']);
|
||||||
@ -139,7 +139,7 @@ else {
|
|||||||
$vocations->load($file);
|
$vocations->load($file);
|
||||||
|
|
||||||
if(!$vocations)
|
if(!$vocations)
|
||||||
die('ERROR: Cannot load <i>vocations.xml</i> file.');
|
throw new RuntimeException('ERROR: Cannot load <i>vocations.xml</i> file.');
|
||||||
|
|
||||||
$config['vocations'] = array();
|
$config['vocations'] = array();
|
||||||
foreach($vocations->getElementsByTagName('vocation') as $vocation) {
|
foreach($vocations->getElementsByTagName('vocation') as $vocation) {
|
||||||
|
@ -24,7 +24,7 @@ function generateItem($id = 100, $count = 1) {
|
|||||||
function itemImageExists($id, $count = 1)
|
function itemImageExists($id, $count = 1)
|
||||||
{
|
{
|
||||||
if(!isset($id))
|
if(!isset($id))
|
||||||
die('ERROR - itemImageExists: id has been not set!');
|
throw new RuntimeException('ERROR - itemImageExists: id has been not set!');
|
||||||
|
|
||||||
$file_name = $id;
|
$file_name = $id;
|
||||||
if($count > 1)
|
if($count > 1)
|
||||||
|
@ -241,7 +241,7 @@ class Items_Images
|
|||||||
self::$spr = fopen(self::$files['spr'], 'rb');
|
self::$spr = fopen(self::$files['spr'], 'rb');
|
||||||
|
|
||||||
if(!self::$otb || !self::$dat || !self::$spr)
|
if(!self::$otb || !self::$dat || !self::$spr)
|
||||||
die('ERROR: Cannot load data files.');
|
throw new RuntimeException('ERROR: Cannot load data files.');
|
||||||
/*
|
/*
|
||||||
if ( $nostand )
|
if ( $nostand )
|
||||||
{
|
{
|
||||||
|
@ -57,8 +57,7 @@ if(isset($last_threads[0]))
|
|||||||
|
|
||||||
$player->load($thread['player_id']);
|
$player->load($thread['player_id']);
|
||||||
if(!$player->isLoaded()) {
|
if(!$player->isLoaded()) {
|
||||||
error('Forum error: Player not loaded.');
|
throw new RuntimeException('Forum error: Player not loaded.');
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_account = $player->getAccount();
|
$player_account = $player->getAccount();
|
||||||
|
@ -46,8 +46,7 @@ foreach($posts as &$post)
|
|||||||
$player = $post['player'];
|
$player = $post['player'];
|
||||||
$player->load($post['player_id']);
|
$player->load($post['player_id']);
|
||||||
if(!$player->isLoaded()) {
|
if(!$player->isLoaded()) {
|
||||||
error('Forum error: Player not loaded.');
|
throw new RuntimeException('Forum error: Player not loaded.');
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config['characters']['outfit']) {
|
if($config['characters']['outfit']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user