Commit Graph

33 Commits

Author SHA1 Message Date
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
Roeland Jago Douma 0e10d8cb7c
Fix locking logic
The comparrison on php8 return true while <php8 it is false.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-12-07 15:44:04 +01:00
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +02:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +02:00
Morris Jobke e878c0a054
Merge pull request #21074 from jvsalo/shared-lock-multi-release
Fix releasing a shared lock multiple times
2020-07-06 14:06:41 +02:00
Robin Appelman da2d425044
add proper paths to locking exceptions
while some code paths do wrap the "raw" locking exception into one with a proper path, not all of them do
by adding the proper path to the original exception we ensure that we always have the usefull information in out logs

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-06-30 18:10:42 +02:00
Jaakko Salo b7dd278e24 Fix releasing a shared lock multiple times
Signed-off-by: Jaakko Salo <jaakkos@gmail.com>
2020-05-24 20:23:57 +03:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Ole Ostergaard 0d778fcc4e Code cleanup.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
2019-03-21 11:42:00 +01:00
Ole Ostergaard a48ea8cffa Add insertIgnoreConflict to Adapter and use it for for executing the file locking.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
2019-03-21 11:42:00 +01:00
Morris Jobke fd8eeccb15
Merge pull request #11942 from nextcloud/techdebt/noid/use-count-function
Use the defined func()->count() instead of manual counting
2018-11-12 17:43:56 +01:00
Morris Jobke f7e3cf2085
Fix UniqueConstraintViolationException while insert into oc_file_locks
* fixes #9305 by not being prone to the race condition in insertIfNotExists
* fixes #6899 by not using a query that can result in a deadlock
* replaces the insertIfNotExists call with an insert which is wrapped into a try-catch block
* followup to #12371

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-11-12 15:13:10 +01:00
Joas Schilling bb352fb667
Use the defined func()->count() instead of manual counting
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-11-08 15:44:45 +01:00
Robin Appelman 3d5acbb1d0
prevent lock values from going negative with memcache backend
This can be caused by the code releasing more locks then it acquires,
once the lock value becomes negative it's likely that it will never be able
to change into an exclusive lock again.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-05 14:39:10 +02:00
Robin Appelman 25565dd7d8
Log more info about locking conflicts for memcache locking backends
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-05-04 13:30:18 +02:00
Morris Jobke 4d832cd4e3
Fixes false positive possible sql injection by phan
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-04-16 11:47:11 +02:00
Robin Appelman 89a9d35d90 dont keep shared database locks when running cli scripts
For cli scripts we don't have the assumption that the universe will be cleaned up soon

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-11 19:21:45 +02:00
Roeland Jago Douma 8edbfdb291
Made locking providers strict
* Added typehints
* Added return types
* Made strict

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-16 21:54:20 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Lukas Reschke 3d2600b039
Add Phan plugin to check for SQL injections
This adds a phan plugin which checks for SQL injections on code using our QueryBuilder, while it isn't perfect it should already catch most potential issues.

As always, static analysis will sometimes have false positives and this is also here the case. So in some cases the analyzer just doesn't know if something is potential user input or not, thus I had to add some `@suppress SqlInjectionChecker` in front of those potential injections.

The Phan plugin hasn't the most awesome code but it works and I also added a file with test cases.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-07-20 22:48:13 +02:00
Joas Schilling 0215b004da
Update with robin 2016-07-21 18:13:58 +02:00
Joas Schilling ba87db3fcc
Fix others 2016-07-21 18:13:57 +02:00
Lukas Reschke aba539703c
Update license headers 2016-05-26 19:57:24 +02:00
Thomas Müller 06293783e0 Merge pull request #24387 from owncloud/locking-mark-reload-free
free up memory when releasing the last shared lock
2016-05-03 12:03:41 +02:00
Robin Appelman 9677681a37 free up memory when releasing the last shared lock 2016-05-02 14:18:46 +02:00
Robin Appelman 49ad0fcfa9 optimize releaselock for memcache based locking backends 2016-04-29 12:54:33 +02:00
Roeland Jago Douma 7b3191705c
Let the querybuilder convert 2016-04-14 11:32:34 +02:00
Robin Appelman 68746e1bdb
chunk the cleaning up of shared locks 2016-04-14 11:32:34 +02:00
Roeland Jago Douma 86e757d2b3
Move \OC\Lock to PSR-4 2016-04-14 08:28:16 +02:00