:fire: fix the calculation of file permissonsOur config allows to set the values for `dmode` and `fmode` to allowusers to explicitly define which permissions directories and filesshould have.To
:fire: fix the calculation of file permissonsOur config allows to set the values for `dmode` and `fmode` to allowusers to explicitly define which permissions directories and filesshould have.To avoid unnessary chmod operations, we check the current umask tocompare what permissions files and directories would get witout ourintervention. If the result is already what the user wants, no chmodswill 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 differentpermissions than `dmode`, *always* requiring a chmod operation.That's silly.**Breaking Change:** This patch removes the passing of `dmode` assecond 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 owndirectories and which currenlty pass `dmode` to it need to beadjusted to remove that second parameter.Users may want to reapply the proper file permissions to their datafolder.**Revert:** In 9fdcc8fcd87114ca59a1764a84d213a53c655c8c @movaticaintroduced a change to `init_creationmodes()` that compared the umaskagainst `fmode` instead of `0666`. I merged it because it looked logicalwhen compared to the code for directories which compared against `dmode`as described above. However we do not pass `fmode` to any file creationmethods (that's not possible).The result is that all changes made in the `fmode` setting resultedin the wrong permissions for newly created files as first reported inhttps://forum.dokuwiki.org/d/19463-setting-fmode-not-working-as-intendedI'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 theactual results of directory and file creations under various umask,`dmode` and `fmode` settings.
show more ...
Fix Undefined array key in Search/Indexer.php
Fix Undefined array key "fperm" warningAlso removed a few, now unnecessary `!empty` checksFixes #3382
change MetadataSearch and FulltextSearch to non-singletonsingleton is not effective to reduce multiple instantiations, especially for MetadataSearch which is frequently used in ajax call.
change Tokenizer static utilityfrequently used in ajax call, singleton is not effective to reduce multiple instantiations.
fix scrutinizer claims
instantiate *Index with numeric page idwill reduce access to static $pidCache
change Index objects to non-singletonIndexer, FulltextIndex, MetadataIndex uses common directory to store *.idx files, but this does not mean they should be singleton objects to avoid lock confrict
change Index objects to non-singletonIndexer, FulltextIndex, MetadataIndex uses common directory to store *.idx files, but this does not mean they should be singleton objects to avoid lock confrictions.
avoid null in addMetaKeys()Just ignore $value argument if $key argument is array .Ignore enpty key of $key argument.Ensure to treat any null value of $key array as empty string.
remove unnecessary if blocksgetPID(), saveIndex(), saveIndexKey(), getPageWords() return always true, otherwise exceptions.
throw IndexWriteException in saveIndex()/saveIndexkey()
replace user errors with exceptionsExceptions are better to handle than errors. What I don't like is thatwe now have an unfortunate mix of return code and exception signallingfor errors. Some met
replace user errors with exceptionsExceptions are better to handle than errors. What I don't like is thatwe now have an unfortunate mix of return code and exception signallingfor errors. Some methods still return false for errors while othersnow throw exceptions (always returning true otherwise).
fix method name
make FulltextIndex::getIndexLengths() publicThird-party plugins may use this method. The [cloud plugin](https://github.com/dokufreaks/plugin-cloud) uses idx_indexLength().
Follow up #2985, fperm seettingFixed inconsistent handling of falsy values on fperm setting
add comment for $requireLock argument
move histogram() into MetadataIndex class
Revert "histogram() change args order"This reverts commit 4d04b7bbfe9c97673b0f22586d88e161aca34f70.
simplify dispatch()
Fixed inconsistent handling of falsy values on fperm settingThe $conf['fperm'] value was checked in multiple files using different methods.This can cause permission trouble with restricted environ
Fixed inconsistent handling of falsy values on fperm settingThe $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.
change static methods into instance methods
fix getPID()getPID() will be called only when the page exists.
fix set Stopwords property
move backlinks() and mediause() into MediaIndex class
AbstractIndex class const INDEX_MARK_DELETED
123456