Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
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
夏彬
yii2bootstrap
Commits
945c6e6a
Commit
945c6e6a
authored
Apr 03, 2012
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
9f716488
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
938 additions
and
4 deletions
+938
-4
ErrorHandler.php
framework/base/ErrorHandler.php
+487
-0
HttpException.php
framework/base/HttpException.php
+40
-0
Module.php
framework/base/Module.php
+1
-1
SecurityManager.php
framework/base/SecurityManager.php
+329
-0
StatePersister.php
framework/base/StatePersister.php
+74
-0
ActiveFinder.php
framework/db/ar/ActiveFinder.php
+7
-3
No files found.
framework/base/ErrorHandler.php
0 → 100644
View file @
945c6e6a
This diff is collapsed.
Click to expand it.
framework/base/HttpException.php
0 → 100644
View file @
945c6e6a
<?php
/**
* HttpException class file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2012 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\base
;
/**
* HttpException represents an exception caused by an improper request of the end-user.
*
* HttpException can be differentiated via its [[statusCode]] property value which
* keeps a standard HTTP status code (e.g. 404, 500). Error handlers may use this status code
* to decide how to format the error page.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
HttpException
extends
Exception
{
/**
* @var integer HTTP status code, such as 403, 404, 500, etc.
*/
public
$statusCode
;
/**
* Constructor.
* @param integer $status HTTP status code, such as 404, 500, etc.
* @param string $message error message
* @param integer $code error code
*/
public
function
__construct
(
$status
,
$message
=
null
,
$code
=
0
)
{
$this
->
statusCode
=
$status
;
parent
::
__construct
(
$message
,
$code
);
}
}
framework/base/Module.php
View file @
945c6e6a
...
@@ -393,7 +393,7 @@ abstract class Module extends Component implements Initable
...
@@ -393,7 +393,7 @@ abstract class Module extends Component implements Initable
* )
* )
* ~~~
* ~~~
*
*
* @param array $components application components (id => component configuration or instance
s
)
* @param array $components application components (id => component configuration or instance)
*/
*/
public
function
setComponents
(
$components
)
public
function
setComponents
(
$components
)
{
{
...
...
framework/base/SecurityManager.php
0 → 100644
View file @
945c6e6a
This diff is collapsed.
Click to expand it.
framework/base/StatePersister.php
0 → 100644
View file @
945c6e6a
<?php
/**
* StatePersister class file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2012 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\base
;
/**
* CStatePersister implements a file-based persistent data storage.
*
* It can be used to keep data available through multiple requests and sessions.
*
* By default, CStatePersister stores data in a file named 'state.bin' that is located
* under the application {@link CApplication::getRuntimePath runtime path}.
* You may change the location by setting the {@link stateFile} property.
*
* To retrieve the data from CStatePersister, call {@link load()}. To save the data,
* call {@link save()}.
*
* Comparison among state persister, session and cache is as follows:
* <ul>
* <li>session: data persisting within a single user session.</li>
* <li>state persister: data persisting through all requests/sessions (e.g. hit counter).</li>
* <li>cache: volatile and fast storage. It may be used as storage medium for session or state persister.</li>
* </ul>
*
* Since server resource is often limited, be cautious if you plan to use CStatePersister
* to store large amount of data. You should also consider using database-based persister
* to improve the throughput.
*
* CStatePersister is a core application component used to store global application state.
* It may be accessed via {@link CApplication::getStatePersister()}.
* page state persistent method based on cache.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
StatePersister
extends
ApplicationComponent
{
/**
* @var string the file path for keeping the state data. Make sure the directory containing
* the file exists and is writable by the Web server process. If using relative path, also
* make sure the path is correct. You may use a path alias here. If not set, it defaults
* to the `state.bin` file under the application's runtime directory.
*/
public
$dataFile
;
/**
* Loads state data from persistent storage.
* @return mixed state data. Null if no state data available.
*/
public
function
load
()
{
$dataFile
=
\Yii
::
getAlias
(
$this
->
dataFile
);
if
(
is_file
(
$dataFile
)
&&
(
$data
=
file_get_contents
(
$dataFile
))
!==
false
)
{
return
unserialize
(
$data
);
}
else
{
return
null
;
}
}
/**
* Saves application state in persistent storage.
* @param mixed $state state data (must be serializable).
*/
public
function
save
(
$state
)
{
file_put_contents
(
\Yii
::
getAlias
(
$this
->
dataFile
),
serialize
(
$state
),
LOCK_EX
);
}
}
framework/db/ar/ActiveFinder.php
View file @
945c6e6a
...
@@ -245,7 +245,7 @@ class ActiveFinder extends \yii\base\Object
...
@@ -245,7 +245,7 @@ class ActiveFinder extends \yii\base\Object
}
}
if
(
is_array
(
$with
))
{
if
(
is_array
(
$with
))
{
foreach
(
$with
as
$name
=>
$value
)
{
foreach
(
$with
as
$name
=>
$value
)
{
if
(
is_array
(
$value
))
{
if
(
is_array
(
$value
)
||
$value
instanceof
\Closure
)
{
$this
->
buildJoinTree
(
$parent
,
$name
,
$value
);
$this
->
buildJoinTree
(
$parent
,
$name
,
$value
);
}
else
{
}
else
{
$this
->
buildJoinTree
(
$parent
,
$value
);
$this
->
buildJoinTree
(
$parent
,
$value
);
...
@@ -299,8 +299,12 @@ class ActiveFinder extends \yii\base\Object
...
@@ -299,8 +299,12 @@ class ActiveFinder extends \yii\base\Object
}
}
}
}
foreach
(
$config
as
$name
=>
$value
)
{
if
(
$config
instanceof
\Closure
)
{
$child
->
query
->
$name
=
$value
;
call_user_func
(
$config
,
$child
->
query
);
}
else
{
foreach
(
$config
as
$name
=>
$value
)
{
$child
->
query
->
$name
=
$value
;
}
}
}
return
$child
;
return
$child
;
...
...
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