<commit_before><?php
/**
 * Wasabi Core Plugin bootstrap
 *
 * Wasabi CMS
 * Copyright (c) <NAME> (http://frankfoerster.com)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) <NAME> (http://frankfoerster.com)
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\Event\EventManager;
use Cake\Routing\DispatcherFactory;
use Wasabi\Core\Event\GuardianListener;
use Wasabi\Core\Event\LanguagesListener;
use Wasabi\Core\Event\MenuListener;
use Wasabi\Core\Controller\Component\GuardianComponent;

try {
    // Load and apply the Wasabi Core cache config.
    Configure::load('Wasabi/Core.cache', 'default');
    foreach (Configure::consume('Cache') as $key => $config) {
        Cache::config($key, $config);
    }
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}

// Load messages from src/Locale/folder/sub_folder/filename.po

//I18n::translator(
//    'wasabi_core',
//    null,
//    new MessagesFileLoader('wasabi_core', 'folder/sub_folder', 'po')
//);

EventManager::instance()->on(new GuardianListener());
EventManager::instance()->on(new MenuListener());
EventManager::instance()->on(new LanguagesListener());

if (!function_exists('guardian')) {
    /**
     * Provides easy access to the GuardianComponent and can be used
     * throughout the whole backend.
     *
     * @return GuardianComponent<commit_msg>create cache folders for wasabi cache config<commit_after><?php
/**
 * Wasabi Core Plugin bootstrap
 *
 * Wasabi CMS
 * Copyright (c) <NAME> (http://frankfoerster.com)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) <NAME> (http://frankfoerster.com)
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\Event\EventManager;
use Cake\Filesystem\Folder;
use Cake\Routing\DispatcherFactory;
use Wasabi\Core\Event\GuardianListener;
use Wasabi\Core\Event\LanguagesListener;
use Wasabi\Core\Event\MenuListener;
use Wasabi\Core\Controller\Component\GuardianComponent;

try {
    // Load and apply the Wasabi Core cache config.
    Configure::load('Wasabi/Core.cache', 'default');
    foreach (Configure::consume('Cache') as $key => $config) {
        new Folder($config['path'], true, 0775);
        Cache::config($key, $config);
    }
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}

// Load messages from src/Locale/folder/sub_folder/filename.po

//I18n::translator(
//    'wasabi_core',
//    null,
//    new MessagesFileLoader('wasabi_core', 'folder/sub_folder', 'po')
//);

EventManager::instance()->on(new GuardianListener());
EventManager::instance()->on(new MenuListener());
EventManager::instance()->on(new LanguagesListener());

if (!function_exists('guardian')) {
    /**
     * Provides easy access to the GuardianComponent and can be used
     * throughout the whole backend.
     *
     * @return GuardianComponent
{'fraction_non_alphanumeric': 0.1434250764525994, 'fraction_numerical': 0.0024464831804281344, 'mean_word_length': 4.087091757387247, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1315397', 'n_tokens_mistral': 997, 'n_tokens_neox': 971, 'n_words': 247}