throw new \yii\base\Exception(\Yii::t('yii', 'Application runtime path "{path}" is not valid. Please make sure it is a directory writable by the Web server process.',
throw new \yii\base\Exception("Application runtime path \"$path\" is invalid. Please make sure it is a directory writable by the Web server process.");
array('{path}' => $path)));
}
}
$this->_runtimePath = $runtimePath;
$this->_runtimePath = $path;
}
}
/**
/**
* Returns the root directory that holds all third-party extensions.
* Returns the language that the end user is using.
* @return string the directory that contains all extensions. Defaults to the 'extensions' directory under 'protected'.
* @return string the language that the user is using (e.g. 'en_US', 'zh_CN').
*/
* Defaults to the value of [[sourceLanguage]].
public function getExtensionPath()
{
return \Yii::getPathOfAlias('ext');
}
/**
* Sets the root directory that holds all third-party extensions.
* @param string $path the directory that contains all third-party extensions.
*/
public function setExtensionPath($path)
{
if (($extensionPath = realpath($path)) === false || !is_dir($extensionPath)) {
throw new \yii\base\Exception(\Yii::t('yii', 'Extension path "{path}" does not exist.',
array('{path}' => $path)));
}
\Yii::setAlias('ext', $extensionPath);
}
/**
* Returns the language that the user is using and the application should be targeted to.
* @return string the language that the user is using and the application should be targeted to.
* Defaults to the {@link sourceLanguage source language}.
*/
*/
public function getLanguage()
public function getLanguage()
{
{
@ -309,13 +229,10 @@ abstract class Application extends Module
}
}
/**
/**
* Specifies which language the application is targeted to.
* Specifies which language the end user is using.
*
* This is the language that the application should use to display to end users.
* This is the language that the application displays to end users.
* By default, [[language]] and [[sourceLanguage]] are the same.
* If set null, it uses the {@link sourceLanguage source language}.
* Do not set this property unless your application needs to support multiple languages.
*
* Unless your application needs to support multiple languages, you should always
* set this language to null to maximize the application's performance.
* @param string $language the user language (e.g. 'en_US', 'zh_CN').
* @param string $language the user language (e.g. 'en_US', 'zh_CN').
* If it is null, the {@link sourceLanguage} will be used.
* If it is null, the {@link sourceLanguage} will be used.
*/
*/
@ -429,7 +346,7 @@ abstract class Application extends Module
/**
/**
* Returns the database connection component.
* Returns the database connection component.
* @return CDbConnection the database connection
* @return \yii\db\dao\Connection the database connection
*/
*/
public function getDb()
public function getDb()
{
{
@ -438,7 +355,7 @@ abstract class Application extends Module
/**
/**
* Returns the error handler component.
* Returns the error handler component.
* @return CErrorHandler the error handler application component.
* @return ErrorHandler the error handler application component.
*/
*/
public function getErrorHandler()
public function getErrorHandler()
{
{
@ -447,7 +364,7 @@ abstract class Application extends Module
/**
/**
* Returns the security manager component.
* Returns the security manager component.
* @return CSecurityManager the security manager application component.
* @return SecurityManager the security manager application component.
*/
*/
public function getSecurityManager()
public function getSecurityManager()
{
{
@ -465,7 +382,7 @@ abstract class Application extends Module
/**
/**
* Returns the cache component.
* Returns the cache component.
* @return CCache the cache application component. Null if the component is not enabled.
* @return \yii\caching\Cache the cache application component. Null if the component is not enabled.
*/
*/
public function getCache()
public function getCache()
{
{
@ -474,7 +391,7 @@ abstract class Application extends Module
/**
/**
* Returns the core message translations component.
* Returns the core message translations component.
* @return CPhpMessageSource the core message translations
* @return \yii\i18n\MessageSource the core message translations
*/
*/
public function getCoreMessages()
public function getCoreMessages()
{
{
@ -483,7 +400,7 @@ abstract class Application extends Module
/**
/**
* Returns the application message translations component.
* Returns the application message translations component.
* @return CMessageSource the application message translations
* @return \yii\i18n\MessageSource the application message translations
*/
*/
public function getMessages()
public function getMessages()
{
{
@ -492,7 +409,7 @@ abstract class Application extends Module
/**
/**
* Returns the request component.
* Returns the request component.
* @return CHttpRequest the request component
* @return Request the request component
*/
*/
public function getRequest()
public function getRequest()
{
{
@ -500,93 +417,6 @@ abstract class Application extends Module
}
}
/**
/**
* Returns the URL manager component.
* @return CUrlManager the URL manager component
*/
public function getUrlManager()
{
return $this->getComponent('urlManager');
}
/**
* @return CController the currently active controller. Null is returned in this base class.
*/
public function getController()
{
return null;
}
/**
* Creates a relative URL based on the given controller and action information.
* @param string $route the URL route. This should be in the format of 'ControllerID/ActionID'.
* @param array $params additional GET parameters (name=>value). Both the name and value will be URL-encoded.
* @param string $ampersand the token separating name-value pairs in the URL.
* @return string the constructed URL
*/
public function createUrl($route, $params = array(), $ampersand = '&')