* @return string The full path to the content file
*/
protected function get_local_path_from_hash($contenthash, $fetchifnotfound = false) {
- return $this->get_fulldir_from_hash($contenthash) . DIRECTORY_SEPARATOR . $contenthash;
+ return $this->get_fulldir_from_hash($contenthash) . '/' .$contenthash;
}
/**
* @return string The full path to the content directory
*/
protected function get_fulldir_from_hash($contenthash) {
- return $this->filedir . DIRECTORY_SEPARATOR . $this->get_contentdir_from_hash($contenthash);
+ return $this->filedir . '/' . $this->get_contentdir_from_hash($contenthash);
}
/**
* @return string The filepath within filedir
*/
protected function get_contentpath_from_hash($contenthash) {
- return $this->get_contentdir_from_hash($contenthash) . "/$contenthash";
+ return $this->get_contentdir_from_hash($contenthash) . '/' . $contenthash;
}
/**
* @return string The full path to the trash directory
*/
protected function get_trash_fulldir_from_hash($contenthash) {
- return $this->trashdir . DIRECTORY_SEPARATOR . $this->get_contentdir_from_hash($contenthash);
+ return $this->trashdir . '/' . $this->get_contentdir_from_hash($contenthash);
}
/**
* @return string The full path to the trash file
*/
protected function get_trash_fullpath_from_hash($contenthash) {
- return $this->trashdir . DIRECTORY_SEPARATOR . $this->get_contentpath_from_hash($contenthash);
+ return $this->trashdir . '/' . $this->get_contentpath_from_hash($contenthash);
}
/**
$contenthash = $file->get_contenthash();
$contentdir = $this->get_fulldir_from_storedfile($file);
$trashfile = $this->get_trash_fullpath_from_hash($contenthash);
- $alttrashfile = $this->trashdir . DIRECTORY_SEPARATOR . $contenthash;
+ $alttrashfile = "{$this->trashdir}/{$contenthash}";
if (!is_readable($trashfile)) {
// The trash file was not found. Check the alternative trash file too just in case.
* errors and behaves as expected.
*/
public function test_mimetype_known() {
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . '/fixtures/testimage.jpg';
$mimetype = file_storage::mimetype_from_file($filepath);
$this->assertEquals('image/jpeg', $mimetype);
}
* errors and behaves as expected.
*/
public function test_mimetype_from_file_known() {
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . '/fixtures/testimage.jpg';
$mimetype = file_storage::mimetype_from_file($filepath);
$this->assertEquals('image/jpeg', $mimetype);
}
* for an image.
*/
public function test_get_imageinfo_from_path() {
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . "/fixtures/testimage.jpg";
// Get the filesystem mock.
$fs = $this->get_testable_mock();
$fs = $this->get_testable_mock(['get_remote_path_from_storedfile']);
$fs->method('get_remote_path_from_storedfile')
- ->willReturn(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'test.tgz');
+ ->willReturn(__DIR__ . "/fixtures/test.tgz");
// Note: We are unable to determine the mode in which the $fh was opened.
$fh = $fs->get_content_file_handle($file, stored_file::FILE_HANDLE_GZOPEN);
$contenthash = file_storage::hash_from_string($filecontent);
$filename = 'example';
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . "/fixtures/testimage.jpg";
$fs = $this->get_testable_mock(['get_remote_path_from_hash']);
$fs->method('get_remote_path_from_hash')->willReturn($filepath);
$contenthash = file_storage::hash_from_string($filecontent);
$filename = 'example';
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . "/fixtures/testimage.jpg";
$fs = $this->get_testable_mock([
'get_remote_path_from_hash',
* a locally available file whose filename does not suggest mimetype.
*/
public function test_mimetype_from_storedfile_using_file_content() {
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . "/fixtures/testimage.jpg";
$fs = $this->get_testable_mock(['get_remote_path_from_storedfile']);
$fs->method('get_remote_path_from_storedfile')->willReturn($filepath);
* a remotely available file whose filename does not suggest mimetype.
*/
public function test_mimetype_from_storedfile_using_file_content_remote() {
- $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg';
+ $filepath = __DIR__ . "/fixtures/testimage.jpg";
$fs = $this->get_testable_mock([
'get_remote_path_from_storedfile',
// Prepare files.
$files = $this->prepare_file_list();
- $archivefile = make_request_directory() . DIRECTORY_SEPARATOR . 'test.tgz';
+ $archivefile = make_request_directory() . '/test.tgz';
$packer->archive_to_pathname($files, $archivefile);
// Extract same files.
$packer = get_file_packer('application/x-gzip');
// Create sample files.
- $archivefile = make_request_directory() . DIRECTORY_SEPARATOR . 'test.tgz';
+ $archivefile = make_request_directory() . '/test.tgz';
file_put_contents($archivefile, '');
// Extract same files.