-
Notifications
You must be signed in to change notification settings - Fork 0
/
zf.php
50 lines (46 loc) · 1.64 KB
/
zf.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
#!/usr/bin/env php
<?php
/**
* ZF2 command line tool
*
* @link http://github.com/zendframework/ZFTool for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
$basePath = getcwd();
ini_set('user_agent', 'ZFTool - Zend Framework 2 command line tool');
// load autoloader
if (file_exists("$basePath/vendor/autoload.php")) {
require_once "$basePath/vendor/autoload.php";
} elseif (file_exists("$basePath/init_autoloader.php")) {
require_once "$basePath/init_autoloader.php";
} elseif (\Phar::running()) {
require_once __DIR__ . '/vendor/autoload.php';
} else {
echo 'Error: I cannot find the autoloader of the application.' . PHP_EOL;
echo "Check if $basePath contains a valid ZF2 application." . PHP_EOL;
exit(2);
}
if (file_exists("$basePath/config/application.config.php")) {
$appConfig = require "$basePath/config/application.config.php";
if (!isset($appConfig['modules']['ZFTool'])) {
$appConfig['modules'][] = 'ZFTool';
$appConfig['module_listener_options']['module_paths']['ZFTool'] = __DIR__;
}
} else {
$appConfig = array(
'modules' => array(
'ZFTool',
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'.',
'./vendor',
),
),
);
}
Zend\Mvc\Application::init($appConfig)->run();