diff options
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/ajax/preview.php | 2 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/mk.js | 1 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/mk.json | 1 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/pt_BR.js | 4 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/pt_BR.json | 4 | ||||
-rw-r--r-- | apps/files_trashbin/lib/helper.php | 2 | ||||
-rw-r--r-- | apps/files_trashbin/lib/storage.php | 5 | ||||
-rw-r--r-- | apps/files_trashbin/tests/storage.php | 16 | ||||
-rw-r--r-- | apps/files_trashbin/tests/trashbin.php | 5 |
9 files changed, 29 insertions, 11 deletions
diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php index 49d6d93f574..ecb4971253f 100644 --- a/apps/files_trashbin/ajax/preview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -62,7 +62,7 @@ try{ $fileName = substr($fileName, 0, $i); } } - $mimetype = \OC_Helper::getFileNameMimeType($fileName); + $mimetype = \OC::$server->getMimeTypeDetector()->detectPath($fileName); } $preview->setMimetype($mimetype); $preview->setMaxX($maxX); diff --git a/apps/files_trashbin/l10n/mk.js b/apps/files_trashbin/l10n/mk.js index 6acb933aa80..8a4b16c52d8 100644 --- a/apps/files_trashbin/l10n/mk.js +++ b/apps/files_trashbin/l10n/mk.js @@ -9,6 +9,7 @@ OC.L10N.register( "Delete permanently" : "Трајно избришани", "Error" : "Грешка", "restored" : "повратени", + "No entries found in this folder" : "Нема ништо во оваа папка", "Name" : "Име", "Deleted" : "Избришан" }, diff --git a/apps/files_trashbin/l10n/mk.json b/apps/files_trashbin/l10n/mk.json index a9948f49ff6..2ec0b3c9500 100644 --- a/apps/files_trashbin/l10n/mk.json +++ b/apps/files_trashbin/l10n/mk.json @@ -7,6 +7,7 @@ "Delete permanently" : "Трајно избришани", "Error" : "Грешка", "restored" : "повратени", + "No entries found in this folder" : "Нема ништо во оваа папка", "Name" : "Име", "Deleted" : "Избришан" },"pluralForm" :"nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;" diff --git a/apps/files_trashbin/l10n/pt_BR.js b/apps/files_trashbin/l10n/pt_BR.js index b1a3768a3bd..806200ea651 100644 --- a/apps/files_trashbin/l10n/pt_BR.js +++ b/apps/files_trashbin/l10n/pt_BR.js @@ -11,8 +11,8 @@ OC.L10N.register( "This operation is forbidden" : "Esta operação é proibida", "This directory is unavailable, please check the logs or contact the administrator" : "Este diretório não está disponível, por favor, verifique os logs ou entre em contato com o administrador", "restored" : "restaurado", - "No deleted files" : "Aquivos não removidos", - "You will be able to recover deleted files from here" : "Você pode recuperar arquivos removidos daqui", + "No deleted files" : "Nenhum arquivo excluído", + "You will be able to recover deleted files from here" : "Neste local, você será capaz de recuperar arquivos excluídos", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", "Select all" : "Selecionar tudo", "Name" : "Nome", diff --git a/apps/files_trashbin/l10n/pt_BR.json b/apps/files_trashbin/l10n/pt_BR.json index db2dc331d5d..177a377bdfd 100644 --- a/apps/files_trashbin/l10n/pt_BR.json +++ b/apps/files_trashbin/l10n/pt_BR.json @@ -9,8 +9,8 @@ "This operation is forbidden" : "Esta operação é proibida", "This directory is unavailable, please check the logs or contact the administrator" : "Este diretório não está disponível, por favor, verifique os logs ou entre em contato com o administrador", "restored" : "restaurado", - "No deleted files" : "Aquivos não removidos", - "You will be able to recover deleted files from here" : "Você pode recuperar arquivos removidos daqui", + "No deleted files" : "Nenhum arquivo excluído", + "You will be able to recover deleted files from here" : "Neste local, você será capaz de recuperar arquivos excluídos", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", "Select all" : "Selecionar tudo", "Name" : "Nome", diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php index d14e97285c5..0ccf15cd2bc 100644 --- a/apps/files_trashbin/lib/helper.php +++ b/apps/files_trashbin/lib/helper.php @@ -87,7 +87,7 @@ class Helper $i = array( 'name' => $id, 'mtime' => $timestamp, - 'mimetype' => $view->is_dir($dir . '/' . $entryName) ? 'httpd/unix-directory' : \OC_Helper::getFileNameMimeType($id), + 'mimetype' => $view->is_dir($dir . '/' . $entryName) ? 'httpd/unix-directory' : \OC::$server->getMimeTypeDetector()->detectPath($id), 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file', 'directory' => ($dir === '/') ? '' : $dir, 'size' => $size, diff --git a/apps/files_trashbin/lib/storage.php b/apps/files_trashbin/lib/storage.php index 0e42df1e967..becde5e635b 100644 --- a/apps/files_trashbin/lib/storage.php +++ b/apps/files_trashbin/lib/storage.php @@ -26,6 +26,7 @@ namespace OCA\Files_Trashbin; use OC\Files\Filesystem; use OC\Files\Storage\Wrapper\Wrapper; +use OC\Files\View; use OCP\IUserManager; class Storage extends Wrapper { @@ -151,8 +152,8 @@ class Storage extends Wrapper { $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); $result = true; - if (!isset($this->deletedFiles[$normalized])) { - $view = Filesystem::getView(); + $view = Filesystem::getView(); + if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { $this->deletedFiles[$normalized] = $normalized; if ($filesPath = $view->getRelativePath($normalized)) { $filesPath = trim($filesPath, '/'); diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php index 3ebbbc3ec9d..30735fe7bc3 100644 --- a/apps/files_trashbin/tests/storage.php +++ b/apps/files_trashbin/tests/storage.php @@ -75,7 +75,8 @@ class Storage extends \Test\TestCase { protected function tearDown() { \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); $this->logout(); - \OC_User::deleteUser($this->user); + $user = \OC::$server->getUserManager()->get($this->user); + if ($user !== null) { $user->delete(); } \OC_Hook::clear(); parent::tearDown(); } @@ -531,4 +532,17 @@ class Storage extends \Test\TestCase { ['/schiesbn/', '/test.txt', false, false], ]; } + + /** + * Test that deleting a file doesn't error when nobody is logged in + */ + public function testSingleStorageDeleteFileLoggedOut() { + $this->logout(); + + if (!$this->userView->file_exists('test.txt')) { + $this->markTestSkipped('Skipping since the current home storage backend requires the user to logged in'); + } else { + $this->userView->unlink('test.txt'); + } + } } diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php index db7e7e6e840..9c19b67a904 100644 --- a/apps/files_trashbin/tests/trashbin.php +++ b/apps/files_trashbin/tests/trashbin.php @@ -88,7 +88,8 @@ class Test_Trashbin extends \Test\TestCase { public static function tearDownAfterClass() { // cleanup test user - \OC_User::deleteUser(self::TEST_TRASHBIN_USER1); + $user = \OC::$server->getUserManager()->get(self::TEST_TRASHBIN_USER1); + if ($user !== null) { $user->delete(); } \OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation); @@ -636,7 +637,7 @@ class Test_Trashbin extends \Test\TestCase { public static function loginHelper($user, $create = false) { if ($create) { try { - \OC_User::createUser($user, $user); + \OC::$server->getUserManager()->createUser($user, $user); } catch(\Exception $e) { // catch username is already being used from previous aborted runs } |