Browse Source

Merge branch 'master' of github.com:yiisoft/yii2

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
fa198518e1
  1. 4
      framework/yii/base/Application.php
  2. 20
      framework/yii/console/Application.php
  3. 3
      framework/yii/web/Application.php

4
framework/yii/base/Application.php

@ -139,7 +139,7 @@ abstract class Application extends Module
*/ */
public function run() public function run()
{ {
$response = $this->handle($this->getRequest()); $response = $this->handleRequest($this->getRequest());
$response->send(); $response->send();
return $response->exitStatus; return $response->exitStatus;
} }
@ -153,7 +153,7 @@ abstract class Application extends Module
* @param Request $request the request to be handled * @param Request $request the request to be handled
* @return Response the resulting response * @return Response the resulting response
*/ */
abstract public function handle($request); abstract public function handleRequest($request);
private $_runtimePath; private $_runtimePath;

20
framework/yii/console/Application.php

@ -89,7 +89,7 @@ class Application extends \yii\base\Application
* @param Request $request the request to be handled * @param Request $request the request to be handled
* @return Response the resulting response * @return Response the resulting response
*/ */
public function handle($request) public function handleRequest($request)
{ {
list ($route, $params) = $request->resolve(); list ($route, $params) = $request->resolve();
$result = $this->runAction($route, $params); $result = $this->runAction($route, $params);
@ -103,24 +103,6 @@ class Application extends \yii\base\Application
} }
/** /**
* Processes the request.
* The request is represented in terms of a controller route and action parameters.
* @return integer the exit status of the controller action (0 means normal, non-zero values mean abnormal)
* @throws Exception if the script is not running from the command line
*/
public function processRequest()
{
/** @var $request Request */
$request = $this->getRequest();
if ($request->getIsConsoleRequest()) {
list ($route, $params) = $request->resolve();
return $this->runAction($route, $params);
} else {
throw new Exception(\Yii::t('yii', 'This script must be run from the command line.'));
}
}
/**
* Returns the response component. * Returns the response component.
* @return Response the response component * @return Response the response component
*/ */

3
framework/yii/web/Application.php

@ -53,7 +53,7 @@ class Application extends \yii\base\Application
* @return Response the resulting response * @return Response the resulting response
* @throws HttpException if the requested route is invalid * @throws HttpException if the requested route is invalid
*/ */
public function handle($request) public function handleRequest($request)
{ {
Yii::setAlias('@wwwroot', dirname($request->getScriptFile())); Yii::setAlias('@wwwroot', dirname($request->getScriptFile()));
Yii::setAlias('@www', $request->getBaseUrl()); Yii::setAlias('@www', $request->getBaseUrl());
@ -78,7 +78,6 @@ class Application extends \yii\base\Application
} catch (InvalidRouteException $e) { } catch (InvalidRouteException $e) {
throw new HttpException(404, $e->getMessage(), $e->getCode(), $e); throw new HttpException(404, $e->getMessage(), $e->getCode(), $e);
} }
} }
private $_homeUrl; private $_homeUrl;

Loading…
Cancel
Save