Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
36bbfd54
Commit
36bbfd54
authored
Jun 02, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented "@app/runtime" alias.
parent
607f3a59
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
Application.php
framework/yii/base/Application.php
+27
-9
FileCache.php
framework/yii/caching/FileCache.php
+1
-5
No files found.
framework/yii/base/Application.php
View file @
36bbfd54
...
...
@@ -67,23 +67,46 @@ class Application extends Module
* Constructor.
* @param array $config name-value pairs that will be used to initialize the object properties.
* Note that the configuration must contain both [[id]] and [[basePath]].
* @throws InvalidConfigException if either [[id]] or [[basePath]] configuration is missing.
*/
public
function
__construct
(
$config
=
array
())
{
Yii
::
$app
=
$this
;
$this
->
preInit
(
$config
);
$this
->
registerErrorHandlers
();
$this
->
registerCoreComponents
();
Component
::
__construct
(
$config
);
}
/**
* Pre-initializes the application.
* This method is called at the beginning of the application constructor.
* When this method is called, none of the application properties are initialized yet.
* The default implementation will initialize a few important properties
* that may be referenced during the initialization of the rest of the properties.
* @param array $config the application configuration
* @throws InvalidConfigException if either [[id]] or [[basePath]] configuration is missing.
*/
public
function
preInit
(
$config
)
{
if
(
!
isset
(
$config
[
'id'
]))
{
throw
new
InvalidConfigException
(
'The "id" configuration is required.'
);
}
if
(
!
isset
(
$config
[
'basePath'
]))
{
throw
new
InvalidConfigException
(
'The "basePath" configuration is required.'
);
}
if
(
isset
(
$config
[
'basePath'
]))
{
$this
->
setBasePath
(
$config
[
'basePath'
]);
Yii
::
setAlias
(
'@app'
,
$this
->
getBasePath
());
unset
(
$config
[
'basePath'
]);
}
else
{
throw
new
InvalidConfigException
(
'The "basePath" configuration is required.'
);
if
(
isset
(
$config
[
'runtime'
]))
{
$this
->
setRuntimePath
(
$config
[
'runtime'
]);
unset
(
$config
[
'runtime'
]);
}
Yii
::
setAlias
(
'@app/runtime'
,
$this
->
getRuntimePath
());
if
(
isset
(
$config
[
'timeZone'
]))
{
$this
->
setTimeZone
(
$config
[
'timeZone'
]);
...
...
@@ -91,11 +114,6 @@ class Application extends Module
}
elseif
(
!
ini_get
(
'date.timezone'
))
{
$this
->
setTimeZone
(
'UTC'
);
}
$this
->
registerErrorHandlers
();
$this
->
registerCoreComponents
();
Component
::
__construct
(
$config
);
}
/**
...
...
framework/yii/caching/FileCache.php
View file @
36bbfd54
...
...
@@ -27,7 +27,7 @@ class FileCache extends Cache
* @var string the directory to store cache files. You may use path alias here.
* If not set, it will use the "cache" subdirectory under the application runtime path.
*/
public
$cachePath
;
public
$cachePath
=
'@app/runtime/cache'
;
/**
* @var string cache file suffix. Defaults to '.bin'.
*/
...
...
@@ -52,11 +52,7 @@ class FileCache extends Cache
public
function
init
()
{
parent
::
init
();
if
(
$this
->
cachePath
===
null
)
{
$this
->
cachePath
=
Yii
::
$app
->
getRuntimePath
()
.
DIRECTORY_SEPARATOR
.
'cache'
;
}
else
{
$this
->
cachePath
=
Yii
::
getAlias
(
$this
->
cachePath
);
}
if
(
!
is_dir
(
$this
->
cachePath
))
{
mkdir
(
$this
->
cachePath
,
0777
,
true
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment