<?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
 */

// remove cache file, just in case (so that the following data initialization works)
$cacheFile = sly_Util_AddOn::internalDirectory('webvariants/metainfo').'metainfos.php';

@unlink($cacheFile);

// clear cache
$cache = sly_Core::cache();
$cache->flush('metainfo', true);

// init autoloader
sly_Loader::addLoadPath(dirname(__FILE__).'/lib');

// build meta data (wait for execution of install.sql)
function _wv2_install(array $params) {
	WV2_Metainfo::loadAll(true);
	return $params['subject'];
}

sly_Core::dispatcher()->register('SLY_ADDON_POST_INSTALL', '_wv2_install');
