diff options
author | Matthias Held <ilovemilk@wusa.io> | 2018-09-14 21:37:43 +0300 |
---|---|---|
committer | Matthias Held <ilovemilk@wusa.io> | 2018-09-14 21:37:43 +0300 |
commit | 0a3747e6f5a18dbfc60c2984df33be2991230b4e (patch) | |
tree | 438fd635c8ebc55ae982f6975f3d5816c7fec300 | |
parent | d13f6eb2292046408b7f60f8b94d483a3be1733e (diff) |
Fix visibility and unused code
Signed-off-by: Matthias Held <matthias.held@uni-konstanz.de>
-rw-r--r-- | lib/Monitor.php | 66 | ||||
-rw-r--r-- | tests/Unit/MonitorTest.php | 10 |
2 files changed, 35 insertions, 41 deletions
diff --git a/lib/Monitor.php b/lib/Monitor.php index 5bb70de..9c658b9 100644 --- a/lib/Monitor.php +++ b/lib/Monitor.php @@ -279,6 +279,39 @@ class Monitor } /** + * Check if we are in the LoginController and if so, ignore the firewall. + * + * @return bool + */ + protected function isCreatingSkeletonFiles() + { + $exception = new \Exception(); + $trace = $exception->getTrace(); + foreach ($trace as $step) { + if (isset($step['class'], $step['function']) && + $step['class'] === 'OC\Core\Controller\LoginController' && + $step['function'] === 'tryLogin') { + return true; + } + } + + return false; + } + + /** + * Reset PROPFIND_COUNT. + */ + protected function resetProfindCount() + { + $userKeys = $this->config->getUserKeys($this->userId, Application::APP_ID); + foreach ($userKeys as $key) { + if (strpos($key, 'propfind_count') !== false) { + $this->config->deleteUserValue($this->userId, Application::APP_ID, $key); + } + } + } + + /** * Return file size of a path. * * @param string $path @@ -343,39 +376,6 @@ class Monitor } /** - * Check if we are in the LoginController and if so, ignore the firewall. - * - * @return bool - */ - protected function isCreatingSkeletonFiles() - { - $exception = new \Exception(); - $trace = $exception->getTrace(); - foreach ($trace as $step) { - if (isset($step['class'], $step['function']) && - $step['class'] === 'OC\Core\Controller\LoginController' && - $step['function'] === 'tryLogin') { - return true; - } - } - - return false; - } - - /** - * Reset PROPFIND_COUNT. - */ - protected function resetProfindCount() - { - $userKeys = $this->config->getUserKeys($this->userId, Application::APP_ID); - foreach ($userKeys as $key) { - if (strpos($key, 'propfind_count') !== false) { - $this->config->deleteUserValue($this->userId, Application::APP_ID, $key); - } - } - } - - /** * Add a folder to the operations. * * @param array $paths diff --git a/tests/Unit/MonitorTest.php b/tests/Unit/MonitorTest.php index 50daee7..4a7a488 100644 --- a/tests/Unit/MonitorTest.php +++ b/tests/Unit/MonitorTest.php @@ -122,7 +122,7 @@ class MonitorTest extends TestCase $this->appManager, $this->logger, $this->rootFolder, $this->entropyAnalyzer, $this->mapper, $this->fileExtensionAnalyzer, $this->fileCorruptionAnalyzer, $this->userId]) - ->setMethods(['isUploadedFile', 'isCreatingSkeletonFiles', 'classifySequence', 'resetProfindCount', 'triggerAsyncAnalysis']) + ->setMethods(['isUploadedFile', 'isCreatingSkeletonFiles', 'classifySequence', 'resetProfindCount']) ->getMock(); $storage = $this->createMock(IStorage::class); @@ -142,9 +142,6 @@ class MonitorTest extends TestCase $monitor->expects($this->any()) ->method('resetProfindCount'); - $monitor->expects($this->any()) - ->method('triggerAsyncAnalysis'); - $entropyResult = new EntropyResult(EntropyResult::COMPRESSED, 7.99, 0.004); $this->entropyAnalyzer->method('analyze') @@ -205,7 +202,7 @@ class MonitorTest extends TestCase $this->appManager, $this->logger, $this->rootFolder, $this->entropyAnalyzer, $this->mapper, $this->fileExtensionAnalyzer, $this->fileCorruptionAnalyzer, $this->userId]) - ->setMethods(['isUploadedFile', 'isCreatingSkeletonFiles', 'triggerAsyncAnalysis', 'resetProfindCount']) + ->setMethods(['isUploadedFile', 'isCreatingSkeletonFiles', 'resetProfindCount']) ->getMock(); $storage = $this->createMock(IStorage::class); @@ -225,9 +222,6 @@ class MonitorTest extends TestCase $monitor->expects($this->any()) ->method('resetProfindCount'); - $monitor->expects($this->any()) - ->method('triggerAsyncAnalysis'); - $node = $this->createMock(Folder::class); $node->method('getInternalPath') ->willReturn('/admin/files/test.file'); |