summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/ajax/getVersions.php23
-rw-r--r--apps/files_versions/ajax/preview.php23
-rw-r--r--apps/files_versions/ajax/rollbackVersion.php28
-rw-r--r--apps/files_versions/appinfo/app.php22
-rw-r--r--apps/files_versions/appinfo/routes.php25
-rw-r--r--apps/files_versions/appinfo/update.php22
-rw-r--r--apps/files_versions/command/expire.php58
-rw-r--r--apps/files_versions/download.php41
-rw-r--r--apps/files_versions/js/versions.js7
-rw-r--r--apps/files_versions/lib/capabilities.php23
-rw-r--r--apps/files_versions/lib/hooks.php27
-rw-r--r--apps/files_versions/lib/storage.php61
-rw-r--r--apps/files_versions/tests/versions.php40
13 files changed, 336 insertions, 64 deletions
diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
index f3fc91116ba..20d60240179 100644
--- a/apps/files_versions/ajax/getVersions.php
+++ b/apps/files_versions/ajax/getVersions.php
@@ -1,4 +1,27 @@
<?php
+/**
+ * @author Bart Visscher <bartv@thisnet.nl>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Frank Karlitschek <frank@owncloud.org>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Sam Tuke <mail@samtuke.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('files_versions');
diff --git a/apps/files_versions/ajax/preview.php b/apps/files_versions/ajax/preview.php
index bd9b7366ab0..fab46abdc48 100644
--- a/apps/files_versions/ajax/preview.php
+++ b/apps/files_versions/ajax/preview.php
@@ -1,9 +1,24 @@
<?php
/**
- * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
\OC_Util::checkLoggedIn();
diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php
index 7bcac614bbc..3f4d78af82b 100644
--- a/apps/files_versions/ajax/rollbackVersion.php
+++ b/apps/files_versions/ajax/rollbackVersion.php
@@ -1,5 +1,31 @@
<?php
-
+/**
+ * @author Bart Visscher <bartv@thisnet.nl>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Frank Karlitschek <frank@owncloud.org>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Robin Appelman <icewind@owncloud.com>
+ * @author Sam Tuke <mail@samtuke.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Thomas Tanghus <thomas@tanghus.net>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::callCheck();
diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php
index e13dc64c46e..0705371b8f4 100644
--- a/apps/files_versions/appinfo/app.php
+++ b/apps/files_versions/appinfo/app.php
@@ -1,5 +1,25 @@
<?php
-
+/**
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Frank Karlitschek <frank@owncloud.org>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
OCP\Util::addscript('files_versions', 'versions');
OCP\Util::addStyle('files_versions', 'versions');
diff --git a/apps/files_versions/appinfo/routes.php b/apps/files_versions/appinfo/routes.php
index 83c7746d1e7..9a9bd5bd655 100644
--- a/apps/files_versions/appinfo/routes.php
+++ b/apps/files_versions/appinfo/routes.php
@@ -1,8 +1,27 @@
<?php
/**
- * Copyright (c) 2013, Tom Needham <tom@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or later.
- * See the COPYING-README file.
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Tom Needham <tom@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
/** @var $this \OCP\Route\IRouter */
diff --git a/apps/files_versions/appinfo/update.php b/apps/files_versions/appinfo/update.php
index fdc6b1e5f1b..6fa0fd6185f 100644
--- a/apps/files_versions/appinfo/update.php
+++ b/apps/files_versions/appinfo/update.php
@@ -1,5 +1,25 @@
<?php
-
+/**
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
$installedVersion=OCP\Config::getAppValue('files_versions', 'installed_version');
// move versions to new directory
if (version_compare($installedVersion, '1.0.4', '<')) {
diff --git a/apps/files_versions/command/expire.php b/apps/files_versions/command/expire.php
new file mode 100644
index 00000000000..d6523746525
--- /dev/null
+++ b/apps/files_versions/command/expire.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA\Files_Versions\Command;
+
+use OC\Command\FileAccess;
+use OCA\Files_Versions\Storage;
+use OCP\Command\ICommand;
+use OCP\IUser;
+
+class Expire implements ICommand {
+ use FileAccess;
+
+ /**
+ * @var string
+ */
+ private $fileName;
+
+ /**
+ * @var int|null
+ */
+ private $versionsSize;
+
+ /**
+ * @var int
+ */
+ private $neededSpace = 0;
+
+ /**
+ * @var string
+ */
+ private $user;
+
+ /**
+ * @param string $user
+ * @param string $fileName
+ * @param int|null $versionsSize
+ * @param int $neededSpace
+ */
+ function __construct($user, $fileName, $versionsSize = null, $neededSpace = 0) {
+ $this->user = $user;
+ $this->fileName = $fileName;
+ $this->versionsSize = $versionsSize;
+ $this->neededSpace = $neededSpace;
+ }
+
+
+ public function handle() {
+ \OC_Util::setupFS($this->user);
+ Storage::expire($this->fileName, $this->versionsSize, $this->neededSpace);
+ \OC_Util::tearDownFS();
+ }
+}
diff --git a/apps/files_versions/download.php b/apps/files_versions/download.php
index c63fde51954..72018ca68b9 100644
--- a/apps/files_versions/download.php
+++ b/apps/files_versions/download.php
@@ -1,25 +1,26 @@
<?php
-
/**
-* ownCloud - Download versions directly from the versions drop-down
-*
-* @author Bjoern Schiessle
-* @copyright 2013 Bjoern Schiessle schiessle@owncloud.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::checkLoggedIn();
diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js
index 1a47c1749f9..e86bb4c3307 100644
--- a/apps/files_versions/js/versions.js
+++ b/apps/files_versions/js/versions.js
@@ -40,6 +40,7 @@ $(document).ready(function(){
if ( $('#dropdown').hasClass('drop-versions') && file == $('#dropdown').data('file')) {
createDropDown = false;
}
+ $('#dropdown').slideUp(OC.menuSpeed);
$('#dropdown').remove();
$('tr').removeClass('mouseOver');
}
@@ -71,7 +72,7 @@ function revertFile(file, revision) {
if (response.status === 'error') {
OC.Notification.show( t('files_version', 'Failed to revert {file} to revision {timestamp}.', {file:file, timestamp:formatDate(revision * 1000)}) );
} else {
- $('#dropdown').hide('blind', function() {
+ $('#dropdown').slideUp(OC.menuSpeed, function() {
$('#dropdown').closest('tr').find('.modified:first').html(relative_modified_date(revision));
$('#dropdown').remove();
$('tr').removeClass('mouseOver');
@@ -175,13 +176,13 @@ function createVersionsDropdown(filename, files, fileList) {
version.appendTo('#found_versions');
}
- $('#dropdown').show('blind');
+ $('#dropdown').slideDown(1000);
}
$(this).click(
function(event) {
if ($('#dropdown').has(event.target).length === 0 && $('#dropdown').hasClass('drop-versions')) {
- $('#dropdown').hide('blind', function() {
+ $('#dropdown').slideUp(OC.menuSpeed, function() {
$('#dropdown').remove();
$('tr').removeClass('mouseOver');
});
diff --git a/apps/files_versions/lib/capabilities.php b/apps/files_versions/lib/capabilities.php
index 45d7dd3fb02..aea31b25240 100644
--- a/apps/files_versions/lib/capabilities.php
+++ b/apps/files_versions/lib/capabilities.php
@@ -1,9 +1,24 @@
<?php
/**
- * Copyright (c) 2013 Tom Needham <tom@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * @author Christopher Schäpers <kondou@ts.unde.re>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Tom Needham <tom@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
namespace OCA\Files_Versions;
diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php
index 53980463120..ccd89a4a14f 100644
--- a/apps/files_versions/lib/hooks.php
+++ b/apps/files_versions/lib/hooks.php
@@ -1,9 +1,28 @@
<?php
/**
- * Copyright (c) 2012 Sam Tuke <samtuke@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * @author Bart Visscher <bartv@thisnet.nl>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Robin Appelman <icewind@owncloud.com>
+ * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
+ * @author Sam Tuke <mail@samtuke.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
/**
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index 60a4c463fd5..01a7935c0c5 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -1,10 +1,34 @@
<?php
/**
- * Copyright (c) 2012 Frank Karlitschek <frank@owncloud.org>
- * 2013 Bjoern Schiessle <schiessle@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * @author Bart Visscher <bartv@thisnet.nl>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Felix Moeller <mail@felixmoeller.de>
+ * @author Florin Peter <github@florin-peter.de>
+ * @author Georg Ehrke <georg@owncloud.com>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Robin Appelman <icewind@owncloud.com>
+ * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
+ * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
/**
@@ -15,6 +39,8 @@
namespace OCA\Files_Versions;
+use OCA\Files_Versions\Command\Expire;
+
class Storage {
const DEFAULTENABLED=true;
@@ -132,7 +158,7 @@ class Storage {
// 1.5 times as large as the current version -> 2.5
$neededSpace = $files_view->filesize($filename) * 2.5;
- self::expire($filename, $versionsSize, $neededSpace);
+ self::scheduleExpire($filename, $versionsSize, $neededSpace);
// disable proxy to prevent multiple fopen calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -237,7 +263,7 @@ class Storage {
}
if (!$files_view->is_dir($newpath)) {
- self::expire($newpath);
+ self::scheduleExpire($newpath);
}
}
@@ -272,7 +298,7 @@ class Storage {
// rollback
if( @$users_view->rename('files_versions'.$filename.'.v'.$revision, 'files'.$filename) ) {
$files_view->touch($file, $revision);
- Storage::expire($file);
+ Storage::scheduleExpire($file);
return true;
}else if ( $versionCreated ) {
@@ -476,9 +502,24 @@ class Storage {
}
/**
- * Erase a file's versions which exceed the set quota
+ * @param string $fileName
+ * @param int|null $versionsSize
+ * @param int $neededSpace
+ */
+ private static function scheduleExpire($fileName, $versionsSize = null, $neededSpace = 0) {
+ $command = new Expire(\OC::$server->getUserSession()->getUser()->getUID(), $fileName, $versionsSize, $neededSpace);
+ \OC::$server->getCommandBus()->push($command);
+ }
+
+ /**
+ * Expire versions which exceed the quota
+ *
+ * @param $filename
+ * @param int|null $versionsSize
+ * @param int $offset
+ * @return bool|int|null
*/
- private static function expire($filename, $versionsSize = null, $offset = 0) {
+ public static function expire($filename, $versionsSize = null, $offset = 0) {
$config = \OC::$server->getConfig();
if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
list($uid, $filename) = self::getUidAndFilename($filename);
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index cf0ffb320e2..6852f769a3d 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -1,22 +1,25 @@
<?php
/**
- * ownCloud
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
*
- * @author Bjoern Schiessle
- * @copyright 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
@@ -243,6 +246,8 @@ class Test_Files_Versioning extends \Test\TestCase {
// execute rename hook of versions app
\OC\Files\Filesystem::rename("test.txt", "test2.txt");
+ $this->runCommands();
+
$this->assertFalse($this->rootView->file_exists($v1));
$this->assertFalse($this->rootView->file_exists($v2));
@@ -285,8 +290,11 @@ class Test_Files_Versioning extends \Test\TestCase {
// execute rename hook of versions app
\OC\Files\Filesystem::rename('/folder1/test.txt', '/folder1/folder2/test.txt');
+
self::loginHelper(self::TEST_VERSIONS_USER2);
+ $this->runCommands();
+
$this->assertFalse($this->rootView->file_exists($v1));
$this->assertFalse($this->rootView->file_exists($v2));
@@ -330,6 +338,8 @@ class Test_Files_Versioning extends \Test\TestCase {
self::loginHelper(self::TEST_VERSIONS_USER);
+ $this->runCommands();
+
$this->assertTrue($this->rootView->file_exists($v1));
$this->assertTrue($this->rootView->file_exists($v2));
@@ -361,6 +371,8 @@ class Test_Files_Versioning extends \Test\TestCase {
// execute copy hook of versions app
\OC\Files\Filesystem::copy("test.txt", "test2.txt");
+ $this->runCommands();
+
$this->assertTrue($this->rootView->file_exists($v1));
$this->assertTrue($this->rootView->file_exists($v2));
@@ -414,7 +426,9 @@ class Test_Files_Versioning extends \Test\TestCase {
public static function loginHelper($user, $create = false) {
if ($create) {
- \OC_User::createUser($user, $user);
+ $backend = new \OC_User_Dummy();
+ $backend->createUser($user, $user);
+ \OC::$server->getUserManager()->registerBackend($backend);
}
\OC_Util::tearDownFS();