<?php
include 'include/common.php';
include 'include/init.php';
use webbi\db\DatabaseConnection;
use webbi\caching\CacheManagerImpl;
// User logged out and session data removed
session_destroy();
// Remove database tables
$factories = array(
'webbi\user\UserFactory',
'webbi\user\UserLogger',
'webbi\user\GhostFactory',
'webbi\user\UserCategoryFactory',
'webbi\request\PageFactory',
'webbi\filemanagement\MediaManager',
'webbi\request\PublicationFactory',
'webbi\util\attribute\AttributeManagerImpl'
);
$db = DatabaseConnection::loadInstance();
foreach($factories as $factory_class_name) {
$factory = new $factory_class_name();
$db->query(sprintf('DROP TABLE IF EXISTS %s', $factory->dbTable()));
}
// Remove cache files
$cache = new CacheManagerImpl();
$cache->removeAllCache();
echo 'Database tables removed and cache files deleted';