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
137d4728
Commit
137d4728
authored
Feb 08, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console command to flush cache
parent
64fb2a81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
Application.php
framework/console/Application.php
+1
-0
CacheController.php
framework/console/controllers/CacheController.php
+49
-0
todo.md
todo.md
+1
-2
No files found.
framework/console/Application.php
View file @
137d4728
...
@@ -127,6 +127,7 @@ class Application extends \yii\base\Application
...
@@ -127,6 +127,7 @@ class Application extends \yii\base\Application
'help'
=>
'yii\console\controllers\HelpController'
,
'help'
=>
'yii\console\controllers\HelpController'
,
'migrate'
=>
'yii\console\controllers\MigrateController'
,
'migrate'
=>
'yii\console\controllers\MigrateController'
,
'app'
=>
'yii\console\controllers\CreateController'
,
'app'
=>
'yii\console\controllers\CreateController'
,
'cache'
=>
'yii\console\controllers\CacheController'
,
);
);
}
}
...
...
framework/console/controllers/CacheController.php
0 → 100644
View file @
137d4728
<?php
/**
* CacheController class file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\console\controllers
;
use
yii\console\Controller
;
use
yii\console\Exception
;
use
yii\caching\Cache
;
/**
* This command allows you to flush cache.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
CacheController
extends
Controller
{
public
function
actionIndex
()
{
$this
->
forward
(
'help/index'
,
array
(
'-args'
=>
array
(
'cache/flush'
)));
}
/**
* Flushes cache.
* @param string $component Name of the cache application component to use.
*
* @throws \yii\console\Exception
*/
public
function
actionFlush
(
$component
=
'cache'
)
{
/** @var $cache Cache */
$cache
=
\Yii
::
$app
->
getComponent
(
$component
);
if
(
!
$cache
||
!
$cache
instanceof
Cache
)
{
throw
new
Exception
(
'Application component "'
.
$component
.
'" is not defined or not a cache.'
);
}
if
(
!
$cache
->
flush
())
{
throw
new
Exception
(
'Unable to flush cache.'
);
}
echo
"
\n
Done.
\n
"
;
}
}
todo.md
View file @
137d4728
...
@@ -13,8 +13,7 @@
...
@@ -13,8 +13,7 @@
*
ProfileTarget (TBD after web is in place): should consider using javascript and make it into a toolbar
*
ProfileTarget (TBD after web is in place): should consider using javascript and make it into a toolbar
*
unit tests
*
unit tests
-
caching
-
caching
*
a console command to clear cached data
*
backend-specific unit tests
*
unit tests
-
validators
-
validators
*
FileValidator: depends on CUploadedFile
*
FileValidator: depends on CUploadedFile
*
CaptchaValidator: depends on CaptchaAction
*
CaptchaValidator: depends on CaptchaAction
...
...
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