Browse Source

Namespacing, reusing

tags/v8.2beta1
Victor Dubiniuk 8 years ago
parent
commit
f46b434a12
2 changed files with 11 additions and 4 deletions
  1. 7
    2
      apps/files_versions/lib/storage.php
  2. 4
    2
      apps/files_versions/tests/expiration.php

+ 7
- 2
apps/files_versions/lib/storage.php View File

@@ -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');
}

}

+ 4
- 2
apps/files_versions/tests/expiration.php View File

@@ -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(){

Loading…
Cancel
Save