function getCachePath()
 {
     global $xoopsUser;
     if (is_object($xoopsUser)) {
         $uid = $xoopsUser->getVar('uid');
     } else {
         $uid = 0;
     }
     $base = d3pipes_common_cache_path_base($this->mydirname);
     return $base . sprintf('%05d_%02d_uid_%d_cache', $this->pipe_id, $this->stage, $uid);
 }
 function getCachePath()
 {
     $base = d3pipes_common_cache_path_base($this->mydirname);
     return $base . sprintf('%05d_%02d_ping', $this->pipe_id, $this->stage);
 }
Beispiel #3
0
function d3pipes_common_delete_all_cache($mydirname, $pipe_id = 0, $with_fetch = true, $with_ping = true)
{
    $base = d3pipes_common_cache_path_base($mydirname);
    $prefix = substr(strrchr($base, '/'), 1);
    $prefix_length = strlen($prefix);
    $basedir = substr($base, 0, -$prefix_length);
    if ($handler = @opendir($basedir)) {
        while (($file = readdir($handler)) !== false) {
            if (strncmp($file, $prefix, $prefix_length) === 0) {
                // save 'fetch' cache if necessary
                if (!$with_fetch && substr($file, -5) == 'fetch') {
                    continue;
                }
                // save 'ping' cache if necessary
                if (!$with_ping && substr($file, -4) == 'ping') {
                    continue;
                }
                if ($pipe_id > 0) {
                    // only specified pipe's cache
                    if (intval(substr($file, $prefix_length + 1)) == $pipe_id) {
                        @unlink($basedir . $file);
                    }
                } else {
                    // all pipe's cache
                    @unlink($basedir . $file);
                }
            }
        }
    }
}