mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Prevent Apache access error due to directories being 0700
This commit is contained in:
parent
67b13e5b1b
commit
8af68d7c65
2 changed files with 35 additions and 0 deletions
|
|
@ -26,7 +26,10 @@ class InstallStep implements IRepairStep
|
||||||
|
|
||||||
\OCA\SnappyMail\Util\SnappyMailHelper::loadApp();
|
\OCA\SnappyMail\Util\SnappyMailHelper::loadApp();
|
||||||
|
|
||||||
|
\SnappyMail\Upgrade::fixPermissions();
|
||||||
|
|
||||||
$app_dir = \dirname(\dirname(__DIR__)) . '/app';
|
$app_dir = \dirname(\dirname(__DIR__)) . '/app';
|
||||||
|
// $app_dir = \rtrim(APP_INDEX_ROOT_PATH, '\\/');
|
||||||
|
|
||||||
// https://github.com/the-djmaze/snappymail/issues/790#issuecomment-1366527884
|
// https://github.com/the-djmaze/snappymail/issues/790#issuecomment-1366527884
|
||||||
if (!\file_exists($app_dir . '/.htaccess') && \file_exists($app_dir . '/_htaccess')) {
|
if (!\file_exists($app_dir . '/.htaccess') && \file_exists($app_dir . '/_htaccess')) {
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,9 @@ abstract class Upgrade
|
||||||
if (!$bResult) {
|
if (!$bResult) {
|
||||||
throw new \Exception('Extract core files failed');
|
throw new \Exception('Extract core files failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static::fixPermissions();
|
||||||
|
|
||||||
\error_log('Update success');
|
\error_log('Update success');
|
||||||
// opcache_reset is a terrible solution
|
// opcache_reset is a terrible solution
|
||||||
// \is_callable('opcache_reset') && \opcache_reset();
|
// \is_callable('opcache_reset') && \opcache_reset();
|
||||||
|
|
@ -219,4 +222,33 @@ abstract class Upgrade
|
||||||
}
|
}
|
||||||
return $bResult;
|
return $bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevents Apache access error due to directories being 0700
|
||||||
|
public static function fixPermissions($mode = 0755) : void
|
||||||
|
{
|
||||||
|
$target = \rtrim(APP_INDEX_ROOT_PATH, '\\/');
|
||||||
|
// Prevent Apache access error due to directories being 0700
|
||||||
|
foreach (\glob("{$target}/snappymail/v/*", \GLOB_ONLYDIR) as $dir) {
|
||||||
|
\chmod($dir, 0755);
|
||||||
|
$iterator = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveDirectoryIterator("{$dir}/static", \FilesystemIterator::SKIP_DOTS),
|
||||||
|
\RecursiveIteratorIterator::SELF_FIRST
|
||||||
|
);
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->isDir()) {
|
||||||
|
\chmod($item, 0755);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$iterator = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveDirectoryIterator("{$dir}/themes", \FilesystemIterator::SKIP_DOTS),
|
||||||
|
\RecursiveIteratorIterator::SELF_FIRST
|
||||||
|
);
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->isDir()) {
|
||||||
|
\chmod($item, 0755);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue