예제 #1
0
 /**
  * Boot up the Spotweb system
  *
  * @return array (Services_Settings_Container|Dao_Factory_Base|SpotReq)[]
  */
 public function boot()
 {
     SpotTiming::start('bootstrap');
     $daoFactory = $this->getDaoFactory();
     $settings = $this->getSettings($daoFactory, true);
     $spotReq = $this->getSpotReq($settings);
     /*
      * Set the cache path
      */
     if ($settings->exists('cache_path')) {
         $daoFactory->setCachePath($settings->get('cache_path'));
     }
     # if
     /*
      * Run the validation of the most basic systems
      * in Spotweb
      */
     $this->validate(new Services_Settings_Base($settings, $daoFactory->getBlackWhiteListDao()));
     /*
      * Disable the timing part as soon as possible because it 
      * gobbles memory
      */
     if (!$settings->get('enable_timing')) {
         SpotTiming::disable();
     }
     # if
     /*
      * Disable XML entity loader as this might be an
      * security issue.
      */
     libxml_disable_entity_loader(true);
     SpotTiming::stop('bootstrap');
     return array($settings, $daoFactory, $spotReq);
 }
예제 #2
0
            }
        }
        # __FILE_CLASS__
        define('__DIR__', new __DIR_CLASS__());
    }
    # if
    chdir(__DIR__);
}
# if
require_once "lib/SpotClassAutoload.php";
require_once "settings.php";
require_once "lib/SpotTiming.php";
require_once "lib/exceptions/ParseSpotXmlException.php";
require_once "lib/exceptions/NntpException.php";
# disable timing, met alle queries die er draaien loopt dat  uit op een hele grote memory usage
SpotTiming::disable();
# in safe mode, max execution time cannot be set, warn the user
if (ini_get('safe_mode')) {
    echo "WARNING: PHP safemode is enabled, maximum execution cannot be reset! Turn off safemode if this causes problems" . PHP_EOL . PHP_EOL;
}
# if
try {
    $db = new SpotDb($settings['db']);
    $db->connect();
} catch (Exception $x) {
    die("Unable to connect to database: " . $x->getMessage() . PHP_EOL);
}
# catch
# Controleer dat we niet een schema upgrade verwachten
if (!$db->schemaValid()) {
    die("Database schema is gewijzigd, draai upgrade-db.php aub" . PHP_EOL);