forked from OpenXE-org/OpenXE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
refreshFileCache.php
44 lines (34 loc) · 1.45 KB
/
refreshFileCache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
use Xentral\Core\Installer\Installer;
use Xentral\Core\Installer\InstallerCacheConfig;
use Xentral\Core\Installer\InstallerCacheWriter;
use Xentral\Core\Installer\ClassMapGenerator;
use Xentral\Core\Installer\Psr4ClassNameResolver;
error_reporting(E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR | E_PARSE);
if(file_exists(__DIR__.'/xentral_autoloader.php')){
include_once (__DIR__.'/xentral_autoloader.php');
}
$config = new Config();
$installerCacheConfig = new InstallerCacheConfig($config->WFuserdata . '/tmp/' . $config->WFdbname);
// delete cache files
$serviceCacheFile = $installerCacheConfig->getServiceCacheFile();
$javascriptCacheFile = $installerCacheConfig->getJavascriptCacheFile();
@unlink($serviceCacheFile);
@unlink($javascriptCacheFile);
// create new cache
try {
echo "START File Cache Generator\r\n";
$resolver = new Psr4ClassNameResolver();
$resolver->addNamespace('Xentral\\', __DIR__ . '/classes');
$resolver->excludeFile(__DIR__ . '/classes/bootstrap.php');
$generator = new ClassMapGenerator($resolver, __DIR__);
$installer = new Installer($generator, $resolver);
$writer = new InstallerCacheWriter($installerCacheConfig, $installer);
echo "WRITING ServiceMap\r\n";
$writer->writeServiceCache();
echo "WRITING JavascriptMap\r\n";
$writer->writeJavascriptCache();
echo "FINISHED File Cache Generator\r\n";
} catch (Exception $e) {
echo "ERROR " . $e->getMessage() . "\r\n";
}