Browse Source

Added hacky fix for long path cleanup routine

tags/v7.0.0alpha2
Vincent Petry 10 years ago
parent
commit
6e2358c3a6
2 changed files with 11 additions and 4 deletions
  1. 2
    0
      lib/private/helper.php
  2. 9
    4
      tests/lib/files/view.php

+ 2
- 0
lib/private/helper.php View File

@@ -406,6 +406,8 @@ class OC_Helper {
static function rmdirr($dir) {
if (is_dir($dir)) {
$files = scandir($dir);
// FIXME: use flat array instead of recursion to avoid
// too many levels
foreach ($files as $file) {
if ($file !== '' && $file !== "." && $file !== "..") {
self::rmdirr("$dir/$file");

+ 9
- 4
tests/lib/files/view.php View File

@@ -22,6 +22,8 @@ class View extends \PHPUnit_Framework_TestCase {
private $storages = array();
private $user;

private $tempStorage;

public function setUp() {
\OC_User::clearBackends();
\OC_User::useBackend(new \OC_User_Dummy());
@@ -32,6 +34,8 @@ class View extends \PHPUnit_Framework_TestCase {
\OC_User::setUserId('test');

\OC\Files\Filesystem::clearMounts();

$this->tempStorage = null;
}

public function tearDown() {
@@ -41,6 +45,10 @@ class View extends \PHPUnit_Framework_TestCase {
$ids = $cache->getAll();
$cache->clear();
}

if ($this->tempStorage && !\OC_Util::runningOnWindows()) {
system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
}
}

/**
@@ -665,6 +673,7 @@ class View extends \PHPUnit_Framework_TestCase {
}

$storage = new \OC\Files\Storage\Temporary(array());
$this->tempStorage = $storage; // for later hard cleanup
\OC\Files\Filesystem::mount($storage, array(), '/');

$rootView = new \OC\Files\View('');
@@ -679,10 +688,6 @@ class View extends \PHPUnit_Framework_TestCase {
}

call_user_func(array($rootView, $operation), $longPath, $param0);

if (!\OC_Util::runningOnWindows()) {
system('rm -rf ' . escapeshellarg($storage->getDataDir()));
}
}

public function tooLongPathDataProvider() {

Loading…
Cancel
Save