-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfix-container-compatibility.php
More file actions
48 lines (38 loc) · 1.32 KB
/
fix-container-compatibility.php
File metadata and controls
48 lines (38 loc) · 1.32 KB
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
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
// Clear all cache directories
echo "Clearing cache directories...\n";
$cacheDirectories = [
__DIR__ . '/var/cache',
__DIR__ . '/tests/phpunit/Licence/var/cache',
__DIR__ . '/tests/phpunit/SingleTenant/var/cache',
__DIR__ . '/tests/phpunit/MultiTenant/var/cache',
];
foreach ($cacheDirectories as $cacheDir) {
if (is_dir($cacheDir)) {
echo "Clearing $cacheDir\n";
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($cacheDir, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($files as $file) {
if ($file->isDir()) {
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());
}
}
// Remove the directory itself
rmdir($cacheDir);
}
}
echo "Cache directories cleared.\n";
// Create a .gitignore file to prevent committing generated container files
$gitignoreContent = <<<EOT
# Ignore generated container files
/var/cache/
/tests/phpunit/*/var/cache/
EOT;
file_put_contents(__DIR__ . '/.gitignore', $gitignoreContent, FILE_APPEND);
echo "Added cache directories to .gitignore\n";
echo "Container compatibility fix completed.\n";