<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

define('_WV8_PATH', dirname(__FILE__).'/');

// Bibliothek laden

sly_Loader::addLoadPath(_WV8_PATH.'lib');

$dispatcher = sly_Core::dispatcher();

if (sly_Core::isBackend()) {
	sly_Core::getI18N()->appendFile(_WV8_PATH.'lang');

	$dispatcher->register('SLY_CACHE_CLEARED', array('WV8_Settings', 'onClearCache'));
	$dispatcher->register('SLY_SYSTEM_CACHES', array('WV8_Settings', 'systemCacheList'));
	$dispatcher->register('SLY_BOOTCACHE_CLASSES_FRONTEND', array('WV8_Settings', 'bootcache'));
	$dispatcher->register('SLY_BOOTCACHE_CLASSES_BACKEND', array('WV8_Settings', 'bootcache'));
	$dispatcher->register('SLY_MEDIA_USAGES', array('WV8_Settings', 'mediaUsages'));
	$dispatcher->register('SLY_ADDONS_LOADED', array('WV8_Settings', 'backendNavigation'));

	// rebuild value table when importing a dump or clearing the cache
	$rebuildEvent = 'SLY_DB_IMPORTER_AFTER';
	$dispatcher->register($rebuildEvent, array('WV8_Settings', 'rebuild'));
}

// Settings synchronieren
if (sly_Core::isDeveloperMode()) {
	sly_Core::cache()->delete('globalsettings', 'settings');
	$dispatcher->register('SLY_ADDONS_LOADED', array('WV8_Settings', 'loadAll'));
}
