mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Added PHP 8 str_contains fallback
Clear cache folder on version change Secure data folder with .htaccess
This commit is contained in:
parent
490a706cc6
commit
10de3b8138
1 changed files with 19 additions and 0 deletions
|
|
@ -14,6 +14,14 @@
|
||||||
unset($load);
|
unset($load);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PHP 8
|
||||||
|
if (!\function_exists('str_contains')) {
|
||||||
|
function str_contains(string $haystack, string $needle) : bool
|
||||||
|
{
|
||||||
|
return false !== \strpos($haystack, $needle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ini_set('register_globals', 0);
|
ini_set('register_globals', 0);
|
||||||
ini_set('zend.ze1_compatibility_mode', 0);
|
ini_set('zend.ze1_compatibility_mode', 0);
|
||||||
|
|
||||||
|
|
@ -152,6 +160,17 @@
|
||||||
if (!is_dir(APP_PRIVATE_DATA))
|
if (!is_dir(APP_PRIVATE_DATA))
|
||||||
{
|
{
|
||||||
mkdir(APP_PRIVATE_DATA, 0755, true);
|
mkdir(APP_PRIVATE_DATA, 0755, true);
|
||||||
|
file_put_contents(APP_PRIVATE_DATA.'.htaccess', 'Require all denied');
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (is_dir(APP_PRIVATE_DATA.'cache'))
|
||||||
|
{
|
||||||
|
foreach (new RecursiveIteratorIterator(
|
||||||
|
new RecursiveDirectoryIterator(APP_PRIVATE_DATA.'cache', FilesystemIterator::SKIP_DOTS),
|
||||||
|
RecursiveIteratorIterator::CHILD_FIRST) as $value) {
|
||||||
|
$value->isDir() ? rmdir($value) : unlink($value);
|
||||||
|
}
|
||||||
|
clearstatcache();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array('logs', 'cache', 'configs', 'plugins', 'storage') as $sName)
|
foreach (array('logs', 'cache', 'configs', 'plugins', 'storage') as $sName)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue