-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathWindCommandFrontController.php
More file actions
110 lines (103 loc) · 3.89 KB
/
WindCommandFrontController.php
File metadata and controls
110 lines (103 loc) · 3.89 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* 命令行前端控制器
*
* @author Shi Long <[email protected]>
* @copyright ©2003-2103 phpwind.com
* @license http://www.windframework.com
* @version $Id$
* @package command
*/
class WindCommandFrontController extends AbstractWindFrontController {
/* (non-PHPdoc)
* @see AbstractWindFrontController::run()
*/
public function run() {
parent::run();
exit("Completely Done~\r\n");
}
/**
* @return WindHttpRequest
*/
public function getRequest() {
if ($this->_request === null) {
$this->_request = WindFactory::createInstance('WindCommandRequest');
}
return $this->_request;
}
/**
* 创建并返回应用
*
* @return WindCommandApplication
*/
protected function _createApplication() {
$application = new WindCommandApplication($this->getRequest(), $this->getFactory());
$application->setDelayAttributes(
array('windView' => array('ref' => 'windView'), 'handlerAdapter' => array('ref' => 'router')));
return $application;
}
/* (non-PHPdoc)
* @see AbstractWindFrontController::showErrorMessage()
*/
protected function showErrorMessage($message, $file, $line, $trace, $errorcode) {
$log = $message . "\r\n" . $file . ":" . $line . "\r\n";
list($fileLines, $trace) = WindUtility::crash($file, $line, $trace);
foreach ($trace as $key => $value) {
$log .= $value . "\r\n";
}
if (WIND_DEBUG & 2) Wind::getApp()->getComponent('windLogger')->error($log, 'error', true);
exit($log);
}
/* (non-PHPdoc)
* @see AbstractWindFrontController::_components()
*/
protected function _components() {
return array(
'router' => array('path' => 'WIND:command.WindCommandRouter', 'scope' => 'application'),
'windView' => array('path' => 'WIND:command.WindCommandView', 'scope' => 'prototype'),
'db' => array('path' => 'WIND:db.WindConnection', 'scope' => 'singleton'),
'configParser' => array('path' => 'WIND:parser.WindConfigParser', 'scope' => 'singleton'),
'errorMessage' => array('path' => 'WIND:base.WindErrorMessage', 'scope' => 'prototype'),
'windLogger' => array(
'path' => 'WIND:log.WindLogger',
'scope' => 'singleton',
'destroy' => 'flush',
'constructor-args' => array('0' => array('value' => 'DATA:log'), '1' => array('value' => '2'))),
'i18n' => array(
'path' => 'WIND:i18n.WindLangResource',
'scope' => 'singleton',
'config' => array('path' => 'i18n')));
}
/* (non-PHPdoc)
* @see AbstractWindFrontController::_loadBaseLib()
*/
protected function _loadBaseLib() {
Wind::$_imports += array(
'WIND:i18n.WindLangResource' => 'WindLangResource',
'WIND:log.WindLogger' => 'WindLogger',
'WIND:base.WindErrorMessage' => 'WindErrorMessage',
'WIND:parser.WindConfigParser' => 'WindConfigParser',
'WIND:db.WindConnection' => 'WindConnection',
'WIND:command.WindCommandView' => 'WindCommandView',
'WIND:command.WindCommandRouter' => 'WindCommandRouter',
'WIND:command.WindCommandErrorHandler' => 'WindCommandErrorHandler',
'WIND:command.WindCmmandRequest' => 'WindCommandRequest',
'WIND:command.WindCommandResponse' => 'WindCommandResponse',
'WIND:command.WindCommandController' => 'WindCommandController',
'WIND:command.WindCommandApplication' => 'WindCommandApplication');
Wind::$_classes += array(
'WindLangResource' => 'i18n/WindLangResource',
'WindLogger' => 'log/WindLogger',
'WindErrorMessage' => 'base/WindErrorMessage',
'WindConfigParser' => 'parser/WindConfigParser',
'WindConnection' => 'db/WindConnection',
'WindCommandView' => 'command/WindCommandView',
'WindCommandRouter' => 'command/WindCommandRouter',
'WindCommandApplication' => 'command/WindCommandApplication',
'WindCommandController' => 'command/WindCommandController',
'WindCommandErrorHandler' => 'command/WindCommandErrorHandler',
'WindCommandRequest' => 'command/WindCommandRequest',
'WindCommandResponse' => 'command/WindCommandResponse');
}
}
?>