diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/comments/comment.php | 2 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/availability.php | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/private/comments/comment.php b/lib/private/comments/comment.php index 31848ed38b6..60663d61578 100644 --- a/lib/private/comments/comment.php +++ b/lib/private/comments/comment.php @@ -362,7 +362,7 @@ class Comment implements IComment { protected function fromArray($data) { foreach(array_keys($data) as $key) { // translate DB keys to internal setter names - $setter = 'set' . str_replace('_', '', ucwords($key,'_')); + $setter = 'set' . implode('', array_map('ucfirst', explode('_', $key))); $setter = str_replace('Timestamp', 'DateTime', $setter); if(method_exists($this, $setter)) { diff --git a/lib/private/files/storage/wrapper/availability.php b/lib/private/files/storage/wrapper/availability.php index 55ddb0d5e8f..0ed31ba854a 100644 --- a/lib/private/files/storage/wrapper/availability.php +++ b/lib/private/files/storage/wrapper/availability.php @@ -29,6 +29,16 @@ namespace OC\Files\Storage\Wrapper; class Availability extends Wrapper { const RECHECK_TTL_SEC = 600; // 10 minutes + public static function shouldRecheck($availability) { + if (!$availability['available']) { + // trigger a recheck if TTL reached + if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) { + return true; + } + } + return false; + } + /** * @return bool */ @@ -47,11 +57,8 @@ class Availability extends Wrapper { */ private function isAvailable() { $availability = $this->getAvailability(); - if (!$availability['available']) { - // trigger a recheck if TTL reached - if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) { - return $this->updateAvailability(); - } + if (self::shouldRecheck($availability)) { + return $this->updateAvailability(); } return $availability['available']; } |