diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2015-09-09 18:37:33 +0300 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2015-09-15 17:08:54 +0300 |
commit | f46b434a122377596f7861a75fc50106ea514e8e (patch) | |
tree | c49e322cc49f237eb1a769f6fa8cd432fdb6e8d7 /apps/files_versions | |
parent | c3e055549e79b59de19fac46d949f55225998f32 (diff) | |
download | nextcloud-server-f46b434a122377596f7861a75fc50106ea514e8e.tar.gz nextcloud-server-f46b434a122377596f7861a75fc50106ea514e8e.zip |
Namespacing, reusing
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/storage.php | 9 | ||||
-rw-r--r-- | apps/files_versions/tests/expiration.php | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 90fe308e970..ba2b78ff4d2 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -68,6 +68,9 @@ class Storage { //until the end one version per week 6 => array('intervalEndsAfter' => -1, 'step' => 604800), ); + + /** @var \OCA\Files_Versions\AppInfo\Application */ + private static $application; public static function getUidAndFilename($filename) { $uid = \OC\Files\Filesystem::getOwner($filename); @@ -709,8 +712,10 @@ class Storage { * @return Expiration */ protected static function getExpiration(){ - $application = new Application(); - return $application->getContainer()->query('Expiration'); + if (is_null(self::$application)) { + self::$application = new Application(); + } + return self::$application->getContainer()->query('Expiration'); } } diff --git a/apps/files_versions/tests/expiration.php b/apps/files_versions/tests/expiration.php index fd5e022f689..54024b85b78 100644 --- a/apps/files_versions/tests/expiration.php +++ b/apps/files_versions/tests/expiration.php @@ -19,9 +19,11 @@ * */ -namespace OCA\Files_Versions; +namespace OCA\Files_Versions\Tests; -class Expiration_Test extends \PHPUnit_Framework_TestCase { +use \OCA\Files_Versions\Expiration; + +class Expiration_Test extends \Test\TestCase { const SECONDS_PER_DAY = 86400; //60*60*24 public function expirationData(){ |