$it"; } $bt = debug_backtrace(); array_shift($bt); // Remove this function array_shift($bt); // Remove eval in lib/log.inc $errorText .= "
Backtrace to the error:
";
		$base = dirname(config::$main['scriptdir']);
		foreach ($bt as $data) {
			$str = "... " . str_repeat(' ', strlen($data['class']) > 30 ? 1 : (31 - strlen($data['class'])))
				. $data['class'] . " :: " . $data['function'];
			if (!is_null($data['file'])) {
				$str .= str_repeat(' ', strlen($data['function']) > 25 ? 1 : (26 - strlen($data['function'])));
				$fn = preg_replace("#^$base/#", "", $data['file']);
				$str .= "  (line {$data['line']}, file '$fn')";
			}
			$errorText .= "$str\n";
		}
		$errorText .= "
"; throw new Exception($errorText); } l::setFatalHandler('__adminFatalError'); try { dbConnect(); $game = config::getGame($gName); if (is_null($game)) { throw new Exception("Game '$gName' not found"); } l::notice("administration script executing tick {$gName}::{$tName}"); $game->getDBAccess(); $game->runTick($tName, true); l::notice("tick {$gName}::{$tName} executed"); dbClose(); } catch (Exception $e) { $argh = $e->getMessage(); } chdir($oldDir); return; } else { l::setSyslogPrefix("lwTicks"); if (count($argv) > 1) { /* Checks for command line arguments */ if ($argv[1] == "-r" && count($argv) == 4) { $game = $argv[2]; $tick = $argv[3]; dbConnect(); $game = config::getGame($argv[2]); if (is_null($game)) { die("Error: game {$argv[2]} not found"); } l::notice("manually executing {$argv[2]}::{$argv[3]}"); $game->getDBAccess(); $game->runTick($argv[3], true); l::notice("{$argv[2]}::{$argv[3]} executed"); dbClose(); exit(0); } elseif ($argv[1] != "-d") { die("Syntax: {$argv[0]}\n\t -> to run as a daemon\n\t{$argv[0]} -d\n\t -> to run in debugging mode\n\t{$argv[0]} -r \n\t -> to run a tick manually\n"); } } else { /* Starts the main thread */ new tick_manager($argv[1] == "-d"); } } ?>