aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-11-14 14:57:45 +0100
committerGravatar GitHub <noreply@github.com> 2022-11-14 14:57:45 +0100
commit8864d514c82bc29f0014e45330383ab2ee812910 (patch)
tree342b8954274742cda8b39a3553b249f150dc74ab /lib
parent1f86aae415951b3a5c83d092765fa92337fc29ee (diff)
NFS-friendly is_writable() checks (#4780)
#fix https://github.com/FreshRSS/FreshRSS/issues/4779
Diffstat (limited to 'lib')
-rw-r--r--lib/lib_install.php8
-rw-r--r--lib/lib_rss.php10
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/lib_install.php b/lib/lib_install.php
index 494ddc6dd..0204c90c9 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -42,14 +42,14 @@ function checkRequirements($dbType = '') {
$json = function_exists('json_encode');
$mbstring = extension_loaded('mbstring');
// @phpstan-ignore-next-line
- $data = DATA_PATH && is_writable(DATA_PATH);
+ $data = DATA_PATH && touch(DATA_PATH . '/index.html'); // is_writable() is not reliable for a folder on NFS
// @phpstan-ignore-next-line
- $cache = CACHE_PATH && is_writable(CACHE_PATH);
+ $cache = CACHE_PATH && touch(CACHE_PATH . '/index.html');
// @phpstan-ignore-next-line
$tmp = TMP_PATH && is_writable(TMP_PATH);
// @phpstan-ignore-next-line
- $users = USERS_PATH && is_writable(USERS_PATH);
- $favicons = is_writable(join_path(DATA_PATH, 'favicons'));
+ $users = USERS_PATH && touch(USERS_PATH . '/index.html');
+ $favicons = touch(DATA_PATH . '/favicons/index.html');
return array(
'php' => $php ? 'ok' : 'ko',
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 592ad8149..d0e819d98 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -696,13 +696,13 @@ function check_install_php() {
function check_install_files() {
return array(
// @phpstan-ignore-next-line
- 'data' => DATA_PATH && is_writable(DATA_PATH),
+ 'data' => DATA_PATH && touch(DATA_PATH . '/index.html'), // is_writable() is not reliable for a folder on NFS
// @phpstan-ignore-next-line
- 'cache' => CACHE_PATH && is_writable(CACHE_PATH),
+ 'cache' => CACHE_PATH && touch(CACHE_PATH . '/index.html'),
// @phpstan-ignore-next-line
- 'users' => USERS_PATH && is_writable(USERS_PATH),
- 'favicons' => is_writable(DATA_PATH . '/favicons'),
- 'tokens' => is_writable(DATA_PATH . '/tokens'),
+ 'users' => USERS_PATH && touch(USERS_PATH . '/index.html'),
+ 'favicons' => touch(DATA_PATH . '/favicons/index.html'),
+ 'tokens' => touch(DATA_PATH . '/tokens/index.html'),
);
}