private function create_default_options()
{
// Let's prepare the EventLog here, first
EventLog::register_type('default', 'habari');
EventLog::register_type('user', 'habari');
EventLog::register_type('authentication', 'habari');
EventLog::register_type('content', 'habari');
EventLog::register_type('comment', 'habari');
// Create the default options
$defaults = array('installed' => true, 'title' => $this->handler_vars['blog_title'], 'pagination' => 5, 'atom_entries' => 5, 'theme_name' => 'Charcoal', 'theme_dir' => 'charcoal', 'comments_require_id' => 1, 'locale' => $this->handler_vars['locale'], 'timezone' => 'UTC', 'dateformat' => 'Y-m-d', 'timeformat' => 'g:i a', 'log_min_severity' => 3, 'spam_percentage' => 100, 'GUID' => sha1(Utils::nonce()), 'private-GUID' => sha1(Utils::nonce()), 'public-GUID' => sha1(Utils::nonce()));
// Get values from config installation profile
foreach ($this->handler_vars as $id => $value) {
if (preg_match('/option_(.+)/u', $id, $matches)) {
$defaults[$matches[1]] = $value;
}
}
// Apply values to the options table and activate the default theme
foreach ($defaults as $key => $value) {
Options::set($key, $value);
}
// Add the cronjob to trim the log so that it doesn't get too big
CronTab::add_daily_cron('trim_log', Method::create('\\Habari\\EventLog', 'trim'), _t('Trim the log table'));
// Add the cronjob to check for plugin updates
CronTab::add_daily_cron('update_check', Method::create('\\Habari\\Update', 'cron'), _t('Perform a check for plugin updates.'));
// Add the cronjob to run garbage collection on expired sessions
CronTab::add_hourly_cron('session_gc', Method::create('\\Habari\\Session', 'gc'), _t('Perform session garbage collection.'));
return true;
}