Example #1
0
File: cache.php Project: hornos/C2
                    $bn = basename($f);
                    $cn = str_replace('.php', '', $bn);
                    $c = array_merge($c, array($cn => $f));
                }
            }
            break;
    }
    return $c;
}
function __c_cache($root = NULL, $cf = NULL, $rec = true, $v = true)
{
    $c = __c_dir($root, $rec);
    if (empty($c)) {
        return false;
    }
    if ($v) {
        print_r($c);
    }
    if (!($ch = fopen($cf, 'w'))) {
        return false;
    }
    fwrite($ch, serialize($c));
    fclose($ch);
}
// main
if (!($c2 = __k_fetch("c2"))) {
    die(__FILE__ . '(' . __LINE__ . ')');
}
foreach ($c2['sys.cache'] as $c => $d) {
    __c_cache($d['path'], $c2['path.cache'] . '/' . $c . '.php', true);
}
Example #2
0
                }
            }
            break;
            // end case
    }
    return $cache;
}
// end
function __c_cache($root = NULL, $cache_file = NULL, $recursive = true, $verbose = true)
{
    $cache = __c_cache_dir($root, $recursive);
    if (empty($cache)) {
        return false;
    }
    if ($verbose) {
        print_r($cache);
    }
    if (!($cache_handle = fopen($cache_file, 'w'))) {
        return false;
    }
    fwrite($cache_handle, serialize($cache));
    fclose($cache_handle);
}
//// BEGIN MAIN
if (!($cobra = __k_cache_fetch())) {
    die(__FILE__ . '(' . __LINE__ . ')');
}
foreach ($cobra['sys.cache'] as $cache => $desc) {
    __c_cache($desc['path'], $cobra['path.cache'] . '/' . $cache . '.' . COBRA_CACHE_EXTENSION, $desc['recursive']);
}
//// END MAIN