Actions

API16

JCacheStorageFile/clean

From Joomla! Documentation

< API16:JCacheStorageFile
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Clean cache for a group given a mode.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

clean($group, $mode)
Parameter Name Default Value Description
$group $group The cache data group
$mode notgroup]

Returns

boolean True on success, false otherwise

Defined in

libraries/joomla/cache/storage/file.php

Importing

jimport( 'joomla.cache.storage.file' );

Source Body

function clean($group, $mode)
{
        jimport('joomla.filesystem.folder');
 
        $return = true;
        $folder = $group;
 
        if (trim($folder) == '') {
                $mode = 'notgroup';
        }
 
        switch ($mode)
        {
                case 'notgroup':
                        $folders = JFolder::folders($this->_root);
                        for ($i=0,$n=count($folders);$i<$n;$i++)
                        {
                                if ($folders[$i] != $folder) {
                                        $return |= JFolder::delete($this->_root.DS.$folders[$i]);
                                }
                        }
                        break;
                case 'group':
                default:
                        if (is_dir($this->_root.DS.$folder)) {
                                $return = JFolder::delete($this->_root.DS.$folder);
                        }
                        break;
        }
        return $return;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />