1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 18:54:08 +02:00

[ticket/15276] Use streams

PHPBB3-15276
This commit is contained in:
Rubén Calvo
2017-08-08 12:25:24 +02:00
parent 946f0348a2
commit 9e018e7c12
4 changed files with 35 additions and 9 deletions

View File

@@ -236,17 +236,17 @@ class local implements adapter_interface, stream_interface
}
}
public function get_file_info($path)
public function file_properties($path)
{
return [];
}
public function get_size($path)
public function file_size($path)
{
return filesize($this->root_path . $path);
}
public function get_mimetype($path)
public function file_mimetype($path)
{
return mime_content_type($this->root_path . $path);
}

View File

@@ -35,7 +35,7 @@ class file_info
{
$this->properties = [];
foreach($this->adapter->get_file_info($this->path) as $name => $value) {
foreach($this->adapter->file_properties($this->path) as $name => $value) {
$this->properties[$name] = $value;
}
}
@@ -47,12 +47,12 @@ class file_info
if (!isset($this->properties[$name]))
{
if (!method_exists($this->adapter, 'get_' . $name))
if (!method_exists($this->adapter, 'file_' . $name))
{
throw new not_implemented();
}
$this->properties[$name] = call_user_func($this->adapter, 'get_' . $name);
$this->properties[$name] = call_user_func($this->adapter, 'file_' . $name);
}
return $this->properties[$name];

View File

@@ -193,8 +193,8 @@ class storage
}
}
public function get_fileinfo($path)
public function file_info($path)
{
return new file_info($adapter, $path);
return new file_info($this->adapter, $path);
}
}