/**
 * Initialize pagecache
 * 
 * @param bool $refresh regenerate cache from pages files
 */
function init_pageCache($refresh = false)
{
    global $pageCacheXml;
    $file = GSDATAOTHERPATH . "pages.xml";
    if (file_exists($file) and !$refresh) {
        // if exists load it
        load_pageCache();
    } else {
        // else generate,save it,set global pagecache array
        $pageCacheXml = generate_pageCacheXml();
        save_pageCacheXml($pageCacheXml);
        pageCacheXMLtoArray($pageCacheXml);
        return;
    }
}
/**
 * LEGACY
 * Create the Cached Pages XML file
 *  
 * @since 3.1
 * @param bool $flag true saves pages.xml
 * @return null 
 */
function create_pagesxml($save = false)
{
    global $pagesArray, $pageCacheXml;
    $pageCacheXml = generate_pageCacheXml();
    if ((bool) $save) {
        save_pageCacheXml($pageCacheXml);
    }
    $pagesArray = pageCacheXMLtoArray($pageCacheXml);
}