API15

JCacheStorageFile/clean

From Joomla! Documentation

< API15:JCacheStorageFile
Revision as of 17:12, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Clean cache for a group given a mode. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<now...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Clean cache for a group given a mode.

[Edit Descripton]

Template:Description:JCacheStorageFile/clean

Syntax[edit]

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

Returns[edit]

boolean True on success, false otherwise

Defined in[edit]

libraries/joomla/cache/storage/file.php

Importing[edit]

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

Source Body[edit]

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;
}

[Edit See Also] Template:SeeAlso:JCacheStorageFile/clean

Examples[edit]

<CodeExamplesForm />