require THEBUGGENIE_CORE_PATH . 'classes' . DS . 'TBGContext.class.php';
// Load the logging class so we can log stuff
require THEBUGGENIE_CORE_PATH . 'classes' . DS . 'TBGLogging.class.php';
// Start loading The Bug Genie
try {
    // Set the start time
    TBGContext::setLoadStart($starttime[1] + $starttime[0]);
    TBGLogging::log('Initializing Caspar framework');
    TBGLogging::log('PHP_SAPI says "' . PHP_SAPI . '"');
    if (!isset($argc) && !ini_get('session.auto_start')) {
        session_name(THEBUGGENIE_SESSION_NAME);
        session_start();
    }
    // Add classpath so we can find the TBG* classes
    TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'classes' . DS);
    TBGLogging::log(TBGCache::isEnabled() ? 'APC cache is enabled' : 'APC cache is not enabled');
    TBGLogging::log('Loading B2DB');
    try {
        TBGLogging::log('Adding B2DB classes to autoload path');
        define('B2DB_BASEPATH', THEBUGGENIE_CORE_PATH . 'B2DB' . DS);
        define('B2DB_CACHEPATH', THEBUGGENIE_CORE_PATH . 'cache' . DS . 'B2DB' . DS);
        TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'B2DB' . DS . 'classes' . DS);
        TBGLogging::log('...done (Adding B2DB classes to autoload path)');
        TBGLogging::log('Initializing B2DB');
        if (!isset($argc)) {
            B2DB::setHTMLException(true);
        }
        B2DB::initialize(THEBUGGENIE_CORE_PATH . 'b2db_bootstrap.inc.php');
        TBGLogging::log('...done (Initializing B2DB)');
        if (B2DB::isInitialized()) {
            TBGLogging::log('Database connection details found, connecting');
 public static function clearMenuLinkCache()
 {
     if (!TBGCache::isEnabled()) {
         return;
     }
     foreach (array(TBGCache::KEY_MAIN_MENU_LINKS) as $key) {
         TBGCache::delete($key);
         TBGCache::fileDelete($key);
     }
 }