console-clearcache-and-assets Clear applications cache and/or assets with yiic

  1. Requirements
  2. Exceptions
  3. Usage
  4. PHP Code

Use this simple yiic console command to clear the application cache(s) and/or assets. You can supply multiple caches comma seperated to --cacheID

I will appreciate comments and suggestions on that as well as any hint how to make this better.

Requirements

Yii 1.1 or above

File Permissions

Make sure that the user who is executing this command has the permissions to delete the assets. This can be done by using the same user who created the assets, using sudo or by setting sticky flags on your assets folder.

Exceptions

You can not use this command to clear the APC Cache as cli mode and apache mode use different environments for it.

Usage

This extension comes with two php files.

The AbstractCommand class extents CConsoleCommand with a new getHelp method that collects and prints globaloptions and action options. It also adds printf() and verbose() to be used as output methods that behave like printf but autoadd PHP_EOL and honor the global option verbose.

The ClearcacheCommand class can be used to clear the cache(c) and assets of your application.

Update your config imports section

'import' => array(
	'application.commands.*',
),
Example Clear Cache
./protected/yiic clearcache cache
./protected/yiic clearcache cache --cacheID=apcCache
./protected/yiic clearcache cache --cacheID=fileCache,memCached
Help
$ ./protected/yiic clearcache help
Info: Usage: ./protected/yiic clearcache <action>
Actions:
    all [--cacheID=cache] [--assetPath=]
    cache [--cacheID=cache]
    assets [--assetPath=]
    help

Global options:
    [verbose=0]

PHP Code

Available as zipped download.

6 0
8 followers
1 389 downloads
Yii Version: 1.1
License: GPL-3.0
Category: Console
Developed by: firegate666
Created on: Mar 26, 2012
Last updated: 12 years ago

Downloads

show all

Related Extensions