[services-cvs] CVS services/etc/misc

CVS User miham root at tempel.bibl.u-szeged.hu
2004. Nov. 23., K, 17:40:42 CET


Update of /var/lib/cvs/services/etc/misc
In directory tempel:/tmp/cvs-serv26686

Added Files:
	cachedb.php 
Log Message:
Ez nem kimaradt?!



--- /var/lib/cvs/services/etc/misc/cachedb.php	2004/11/23 16:40:42	NONE
+++ /var/lib/cvs/services/etc/misc/cachedb.php	2004/11/23 16:40:42	1.1
<?
if (!defined('CACHE_DIR'))
    define('CACHE_DIR', './');

function write_error($errmsg) {
    $stderr = fopen("/dev/fd/2", 'w+');
    if (!$stderr) {
        echo "ERROR: {$errmsg}\n";
        return;
    }
    fwrite($stderr, "{$errmsg}\n");
    fclose($stderr);
    return;
}

function &read_cachedb($cachename) {
    if (!file_exists(CACHE_DIR . "{$cachename}.db"))
        return FALSE;
        
    $cachefd = fopen(CACHE_DIR . "{$cachename}.db", 'r');
    if (!$cachefd)
        return FALSE;

    $content = '';
    while (!feof($cachefd))
        $content .= fread($cachefd, 1024 * 16);
    
    $geplist = unserialize(pack('H*', $content));

    return $geplist;
}

function write_cachedb($cachename, &$cachedb) {
    $cachefd = fopen(CACHE_DIR . "{$cachename}.db", 'w');
    if (!$cachefd)
        return FALSE;
    
    fwrite($cachefd, bin2hex(serialize($cachedb)));
    fclose($cachefd);

    return TRUE;
}
?>




További információk a(z) Services-cvs levelezőlistáról