-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrufony.module
59 lines (54 loc) · 1.32 KB
/
drufony.module
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* @file
* Drufony module
*/
/**
* Implements hook_boot().
*/
function drufony_boot() {
Drufony\boot();
}
/**
* Implements hook_flush_caches().
*/
function drufony_flush_caches() {
$paths = array('var://');
if (Drufony::hasContainer()) {
$paths[] = Drufony::getContainer()->getParameter('kernel.cache_dir');
}
register_shutdown_function(function ($paths) {
foreach ($paths as $path) {
if (is_dir($path)) {
$dir = dir($path);
while (($entry = $dir->read()) !== FALSE) {
if ($entry === '.' || $entry === '..') {
continue;
}
$entry_path = $dir->path . DIRECTORY_SEPARATOR . $entry;
file_unmanaged_delete_recursive($entry_path);
}
$dir->close();
}
}
}, $paths);
return array();
}
/**
* Implements hook_stream_wrappers().
*/
function drufony_stream_wrappers() {
return array(
'var' => array(
'name' => t('Variable files'),
'class' => 'Drufony\\Bridge\\DrupalVarStreamWrapper',
'description' => t('Temporary local files for upload and previews.'),
'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
),
);
}
if (!function_exists('composer_manager_register_autoloader')) {
function composer_manager_register_autoloader() {
require_once DRUPAL_ROOT . '/../vendor/autoload.php';
}
}