-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.php
57 lines (44 loc) · 1.81 KB
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
+------------------------------------------------------------------------+
| Panthea |
+------------------------------------------------------------------------+
| Copyright (c) 2013-2014 Phalcon Team and contributors |
+------------------------------------------------------------------------+
| This source file is subject to the MIT License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to [email protected] so we can send you a copy immediately. |
+------------------------------------------------------------------------+
*/
use Phalcon\Logger\Adapter\File as Logger,
Phalcon\DI\FactoryDefault\CLI as CliDi,
Phalcon\CLI\Console as ConsoleApp;
// Define path to application directory
define('APP_PATH', realpath('.'));
//Create a service container
$di = new CliDi();
// Load the configuration file (if any)
$config = require APP_PATH . '/config/config.php';
// Load services
require APP_PATH . '/config/services.php';
// Define auto-loader
require APP_PATH . '/config/loader.php';
try {
// Create a console application
$console = new ConsoleApp();
$console->setDI($di);
// handle incoming arguments
$console->handle(array('task' => 'irc', 'action' => 'run'));
} catch (Exception $e) {
/**
* Log the exception
*/
$logger = new Logger(APP_PATH . '/logs/error.log');
$logger->error($e->getMessage());
$logger->error($e->getTraceAsString());
echo $e->getMessage(), PHP_EOL;
exit(255);
}