Merge pull request #7260 from nextcloud/cleanup-unused-code
Use basename() instead of self implementation
This commit is contained in:
commit
2f3484ba88
|
@ -259,7 +259,7 @@ class Cache implements ICache {
|
||||||
|
|
||||||
$data['path'] = $file;
|
$data['path'] = $file;
|
||||||
$data['parent'] = $this->getParentId($file);
|
$data['parent'] = $this->getParentId($file);
|
||||||
$data['name'] = \OC_Util::basename($file);
|
$data['name'] = basename($file);
|
||||||
|
|
||||||
list($queryParts, $params) = $this->buildParts($data);
|
list($queryParts, $params) = $this->buildParts($data);
|
||||||
$queryParts[] = '`storage`';
|
$queryParts[] = '`storage`';
|
||||||
|
@ -551,7 +551,7 @@ class Cache implements ICache {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` = ? WHERE `fileid` = ?';
|
$sql = 'UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` = ? WHERE `fileid` = ?';
|
||||||
$this->connection->executeQuery($sql, array($targetStorageId, $targetPath, md5($targetPath), \OC_Util::basename($targetPath), $newParentId, $sourceId));
|
$this->connection->executeQuery($sql, array($targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId));
|
||||||
$this->connection->commit();
|
$this->connection->commit();
|
||||||
} else {
|
} else {
|
||||||
$this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath);
|
$this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath);
|
||||||
|
|
|
@ -1407,16 +1407,6 @@ class OC_Util {
|
||||||
return $normalizedValue;
|
return $normalizedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param boolean|string $file
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function basename($file) {
|
|
||||||
$file = rtrim($file, '/');
|
|
||||||
$t = explode('/', $file);
|
|
||||||
return array_pop($t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human readable string is generated based on version and build number
|
* A human readable string is generated based on version and build number
|
||||||
*
|
*
|
||||||
|
|
|
@ -177,24 +177,6 @@ class UtilTest extends \Test\TestCase {
|
||||||
$this->assertSame(1, $matchesRegex);
|
$this->assertSame(1, $matchesRegex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider baseNameProvider
|
|
||||||
*/
|
|
||||||
public function testBaseName($expected, $file) {
|
|
||||||
$base = \OC_Util::basename($file);
|
|
||||||
$this->assertEquals($expected, $base);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function baseNameProvider() {
|
|
||||||
return array(
|
|
||||||
array('public_html', '/home/user/public_html/'),
|
|
||||||
array('public_html', '/home/user/public_html'),
|
|
||||||
array('', '/'),
|
|
||||||
array('public_html', 'public_html'),
|
|
||||||
array('442aa682de2a64db1e010f50e60fd9c9', 'local::C:\Users\ADMINI~1\AppData\Local\Temp\2/442aa682de2a64db1e010f50e60fd9c9/')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider filenameValidationProvider
|
* @dataProvider filenameValidationProvider
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue