Commit Graph

18 Commits

Author SHA1 Message Date
fiwswe 6c16a3a9aa Use str_starts_with/str_ends_with 2023-09-14 23:06:43 +02:00
Andreas Gohr 90fb952c4c code style: operator spacing 2023-08-31 22:38:07 +02:00
Andreas Gohr 7d34963b3e coding style: control flow line breaks 2023-08-31 15:04:10 +02:00
Andreas Gohr 177d6836e2 coding style: control flow whitespaces 2023-08-31 14:22:35 +02:00
Gerrit Uitslag a19c9aa021 recover comments in list 2023-08-31 00:25:09 +02:00
Andreas Gohr dccd6b2bba coding style: function call spacing 2023-08-30 18:41:45 +02:00
Andreas Gohr b2c8ab4769 coding style: loop declaration spacing 2023-08-30 18:27:09 +02:00
Andreas Gohr d868eb89f1 codestyle adjustments: function declaration braces/spaces 2023-08-30 17:09:14 +02:00
Andreas Gohr 8c7c53b032 codestyle adjustments: class declaration braces 2023-08-30 17:05:28 +02:00
Andreas Gohr c1482d1c08 codestyle adjustments: function argument spacing 2023-08-30 17:03:06 +02:00
Andreas Gohr 24870174d2 Apply rector fixes to the rest of inc 2023-08-29 19:42:15 +02:00
Andreas Gohr ac1d8211a0 fix some php 8.2 deprecation warnings 2023-03-19 21:11:05 +01:00
Moritz Raguschat 173de31c3b
Avoid some unnecessary index file writes.
word_idx modified should be reset to false for each word index file, or all unchanged word index files after the first changed one will be resaved unnecessarily.
2023-01-24 04:35:17 +01:00
Andreas Gohr bd5391243c 🔥 fix the calculation of file permissons
Our config allows to set the values for `dmode` and `fmode` to allow
users to explicitly define which permissions directories and files
should have.

To avoid unnessary chmod operations, we check the current umask to
compare what permissions files and directories would get witout our
intervention. If the result is already what the user wants, no chmods
will happen later on. Otherwise we set new configs called `dperm` and
`fperm` which will be used in chmod ops. This is done in
`init_creationmodes()`

When we created new directories, we used to pass the original `dmode`
config to `mkdir()`. The system will then apply the umask to that
`dmode`.

This means the resulting directory will *always* have different
permissions than `dmode`, *always* requiring a chmod operation.
That's silly.

**Breaking Change:** This patch removes the passing of `dmode` as
second parameter to all `mkdir` calls, making it default to `0700`
which is also what we test against in `init_creationmodes()`.

Plugins not relying on our `io_*` functions and do create their own
directories and which currenlty pass `dmode` to it need to be
adjusted to remove that second parameter.

Users may want to reapply the proper file permissions to their data
folder.

**Revert:** In 9fdcc8fcd8 @movatica
introduced a change to `init_creationmodes()` that compared the umask
against `fmode` instead of `0666`. I merged it because it looked logical
when compared to the code for directories which compared against `dmode`
as described above. However we do not pass `fmode` to any file creation
methods (that's not possible).

The result is that all changes made in the `fmode` setting resulted
in the wrong permissions for newly created files as first reported in
https://forum.dokuwiki.org/d/19463-setting-fmode-not-working-as-intended

I'm unsure about the orginal motivation behind @movatica's change. The
"fix" however, is wrong.

**Tests:** This patch introduces an integration test that will check the
actual results of directory and file creations under various umask,
`dmode` and `fmode` settings.
2021-08-14 11:43:40 +02:00
Damien Regad 7c3926398e Fix Undefined array key in Search/Indexer.php 2021-01-27 01:59:43 +01:00
Damien Regad 2342034612 Fix Undefined array key "fperm" warning
Also removed a few, now unnecessary `!empty` checks

Fixes #3382
2021-01-26 13:43:49 +01:00
movatica 3aa7587497 Fixed inconsistent handling of falsy values on fperm setting
The $conf['fperm'] value was checked in multiple files using different methods.
This can cause permission trouble with restricted environments, i.e. when chmod is forbidden and file permissions are non-default.
Now, all checks use implicit cast to boolean which leads to consistent behaviour.

Also, a misleading variable was renamed in context to better understand one of the checks.
2020-02-18 19:29:53 +01:00
Michael Große 6225b270e0
Extract dokuwiki\Search\Indexer class
Not sure why Doku_Indexer caused phpcs to complain about the class name
not being in PascalCase, but Doku_Handler didn't. 🤷

The namespace and new class name was selected to be compatible with the
upcoming changes in #2943. This should hpopefully reduce the overall
hassle of touching the same code base.
2020-01-06 19:59:09 +01:00