예제 #1
0
        }
    }
}
if ($success) {
    echo 'done';
}
echo "\n";
echo "\n" . 'Checking Pandoc... ';
$pandoc_ver = get_pandoc_version();
if ($pandoc_ver === false) {
    echo 'Not installed' . "\n";
} else {
    echo $pandoc_ver . "\n";
}
echo "\n" . 'Checking content dir... ';
if (check_content_dir()) {
    echo 'done' . "\n";
} else {
    echo 'failed. Make sure the webserver process can write to ' . config('content_dir') . '.' . "\n";
}
echo "\n" . 'Checking cache health... ';
if (check_cache_lru()) {
    echo 'done' . "\n";
} else {
    echo 'failed. Some files in ' . config('content_dir') . '/cache might not be removable by the webserver process.' . "\n";
}
echo "\n" . 'Checking tmp dir health... ';
if (check_tmp_dir_age()) {
    echo 'done' . "\n";
} else {
    echo 'failed. Some files in ' . config('content_dir') . '/tmp might not be removable by the webserver process.' . "\n";
예제 #2
0
/**
 *	Get a remote Git repo for reading only
 *
 *	This will always return the default (master) branch. Don't call release_repo()
 *	together with this function.
 *	@param $url Git (clone) URL
 *	@param $force_update force a fetch
 *	@return cache key, or false if unsuccessful
 */
function get_repo_for_reading($url, $force_update = false)
{
    $cache_key = git_url_to_cache_key($url);
    if ($cache_key === false) {
        return false;
    }
    // make sure the content directory is set up
    if (false === check_content_dir()) {
        return false;
    }
    // serve from cache, if possible, or clone from remote
    if (is_dir(cache_dir($cache_key))) {
        if (false === repo_check_for_update($cache_key, $force_update)) {
            return false;
        }
    } else {
        if (false === repo_add_to_cache($url)) {
            return false;
        }
    }
    // XXX (later): this could be done asynchronously
    check_cache_lru();
    return $cache_key;
}