Commit Graph

21 Commits

Author SHA1 Message Date
Morris Jobke 11283c57d9 Merge pull request #11056 from AdamWill/9885-opcode
add function to invalidate one opcache file, use it if possible #9885
2015-02-10 17:21:15 +01:00
Lukas Reschke 17f2cfbb9c Use `file_exists` to verify that config file exists
There might be the case that `fopen($file, 'r')` returns false and thus ownCloud might believe that the config file is empty and thus potentially leading to an overwrite of the config file.

This changeset introduces `file_exists` again which was used in ownCloud 5 where no such problems where reported and should not be affected by such problems.

Ref https://github.com/owncloud/core/issues/12785#issuecomment-71548720
2015-01-27 00:50:14 +01:00
Joas Schilling c61e9f3912 Add a method to set/unset multiple config values in one call
This reduces the number of file writes we do for config.php and therefor
hopefully helps lowering the chances for empty config.php files
2015-01-23 11:00:53 +01:00
Morris Jobke 9a7362dd0d drop unused isDebugMode and setDebugMode of OC_Config 2014-12-08 22:42:44 +01:00
Lukas Reschke 49ddaf9489 Try to read the file only instead of trying to touch
The permissions are already catched properly on the installation so we just have to check whether the file is readable to prevent fatal errors from happening.

Fixes https://github.com/owncloud/core/issues/12135
2014-11-12 15:57:19 +01:00
Adam Williamson 013feb8da0 writeData(): correct variable name for config file path
It changed since we wrote this patch.
2014-11-06 18:10:43 -08:00
Adam Williamson 3b4823d89c add function to invalidate one opcache file, use it if possible #9885
Issue #9885 appears to be triggered by ownCloud invalidating the entire
PHP opcache. Testing indicates it can be avoided by only invalidating the
single file that was written from the opcache, instead of clearing the
whole thing. In general it is more efficient to invalidate only the single
file that was changed, rather than the whole cache.

This adds a deleteFromOpcodeCache() function which invalidates a single
file from the opcache if possible, returning true if the underlying
function returns true (which may mean 'success', or 'file does not exist',
or 'file exists but is not in opcache', all of which are OK to treat as
good for our purposes). It also changes writeData() in config.php to try
using deleteFromOpcodeCache() and only fall back on clearOpcodeCache() if
that fails.
2014-11-06 17:58:58 -08:00
Lukas Reschke 9790801268 First check whether it is the default config before touchign
Potentially fixes https://github.com/owncloud/core/issues/11678
2014-11-03 16:37:04 +01:00
Lukas Reschke 68cf6681e5 Add flock to config
This adds a file lock to the config in hope that this prevents race conditions as reported in https://github.com/owncloud/core/issues/11070

Testplan:

- [ ] Delete config.php and make it read-only => Error is thrown that it is not writeable
- [ ] Installation still works
- [ ] Changing config settings works (i.e. using the SMTP config switches in the administration menu)
- [ ] Your PC didn't blow up
- [ ] Installing the news app and the "Disable AppCode checker" app did not destroy your installation

Only skip the main config

Otherwise read only additional configs might not be processed

Test on tmpdir
2014-09-30 15:53:27 +02:00
Morris Jobke dc36d30953 Remove all occurences of @brief and @returns from PHPDoc
* test case added to avoid adding them later
2014-05-19 17:50:53 +02:00
Robin McCorkell bac8962bbc Fix Scrutinizer errors 2014-05-13 19:08:14 +01:00
Robin McCorkell b5bc37d2e4 Fix @return array PHPDocs, in /lib 2014-05-13 19:08:14 +01:00
Volkan Gezer b6ad7c3cdd Fix admin-dir_permissions redirection when cannot write warning
is shown.
2014-04-02 12:41:46 +02:00
kondou 5e3b6f1fd9 Fix some more docstrings 2014-03-03 17:32:29 +01:00
Scrutinizer Auto-Fixer adaee6a5a1 Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720

Enabled analysis tools:
 - PHP Analyzer
 - JSHint
 - PHP Copy/Paste Detector
 - PHP PDepend
2014-02-19 09:31:54 +01:00
Bart Visscher 2c6411b897 $default of OC_Config::[gs]etValue can have more then string as type 2014-02-12 17:38:32 +01:00
Robin Appelman 6b4c3df087 Load a separate config (if present) when running unit tests 2014-01-17 14:40:48 +01:00
Thomas Müller 87a09156f8 use OC_Helper::linkToDocs() in lib/private/config.php 2013-10-21 23:08:09 +02:00
Thomas Müller 148d2616e5 introduce link_to_docs() and migrate links 2013-10-21 21:29:45 +02:00
Bart Visscher ce9436c051 OC_Defaults is only used in error reporting 2013-10-04 18:11:02 +02:00
Thomas Müller 9c9dc276b7 move the private namespace OC into lib/private - OCP will stay in lib/public
Conflicts:
	lib/private/vcategories.php
2013-09-30 16:36:59 +02:00