mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15305] Use an aditional interface for streams
PHPBB3-15305
This commit is contained in:
parent
cd2bae63cb
commit
c93c2d4007
4 changed files with 45 additions and 30 deletions
|
@ -92,28 +92,4 @@ interface adapter_interface
|
||||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
||||||
*/
|
*/
|
||||||
public function copy($path_orig, $path_dest);
|
public function copy($path_orig, $path_dest);
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a file as a stream.
|
|
||||||
*
|
|
||||||
* @param string $path File to read
|
|
||||||
*
|
|
||||||
* @throws \phpbb\storage\exception\exception When cannot open file
|
|
||||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
||||||
*
|
|
||||||
* @return resource Returns a file pointer
|
|
||||||
*/
|
|
||||||
public function read_stream($path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a new file using a stream.
|
|
||||||
*
|
|
||||||
* @param string $path The target file
|
|
||||||
* @param resource $resource The resource
|
|
||||||
*
|
|
||||||
* @throws \phpbb\storage\exception\exception When target file exists
|
|
||||||
* When target file cannot be created
|
|
||||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
||||||
*/
|
|
||||||
public function write_stream($path, $resource);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\storage\adapter;
|
namespace phpbb\storage\adapter;
|
||||||
|
|
||||||
|
use phpbb\storage\stream_interface;
|
||||||
use phpbb\storage\exception\exception;
|
use phpbb\storage\exception\exception;
|
||||||
use phpbb\filesystem\exception\filesystem_exception;
|
use phpbb\filesystem\exception\filesystem_exception;
|
||||||
use phpbb\filesystem\filesystem;
|
use phpbb\filesystem\filesystem;
|
||||||
|
@ -21,7 +22,7 @@ use phpbb\filesystem\helper as filesystem_helper;
|
||||||
/**
|
/**
|
||||||
* @internal Experimental
|
* @internal Experimental
|
||||||
*/
|
*/
|
||||||
class local implements adapter_interface
|
class local implements adapter_interface, stream_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Filesystem component
|
* Filesystem component
|
||||||
|
|
|
@ -155,8 +155,7 @@ class storage
|
||||||
* @param string $path File to read
|
* @param string $path File to read
|
||||||
*
|
*
|
||||||
* @throws \phpbb\storage\exception\exception When cannot open file
|
* @throws \phpbb\storage\exception\exception When cannot open file
|
||||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
||||||
*
|
|
||||||
* @return resource Returns a file pointer
|
* @return resource Returns a file pointer
|
||||||
*/
|
*/
|
||||||
public function read_stream($path)
|
public function read_stream($path)
|
||||||
|
@ -169,8 +168,6 @@ class storage
|
||||||
*
|
*
|
||||||
* @param string $path The target file
|
* @param string $path The target file
|
||||||
* @param resource $resource The resource
|
* @param resource $resource The resource
|
||||||
*
|
|
||||||
* @throws \phpbb\storage\exception\exception When target file exists
|
|
||||||
* When target file cannot be created
|
* When target file cannot be created
|
||||||
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
||||||
*/
|
*/
|
||||||
|
|
41
phpBB/phpbb/storage/stream_interface.php
Normal file
41
phpBB/phpbb/storage/stream_interface.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\storage;
|
||||||
|
|
||||||
|
interface stream_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Reads a file as a stream.
|
||||||
|
*
|
||||||
|
* @param string $path File to read
|
||||||
|
*
|
||||||
|
* @throws \phpbb\storage\exception\exception When cannot open file
|
||||||
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
||||||
|
*
|
||||||
|
* @return resource Returns a file pointer
|
||||||
|
*/
|
||||||
|
public function read_stream($path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a new file using a stream.
|
||||||
|
*
|
||||||
|
* @param string $path The target file
|
||||||
|
* @param resource $resource The resource
|
||||||
|
*
|
||||||
|
* @throws \phpbb\storage\exception\exception When target file exists
|
||||||
|
* When target file cannot be created
|
||||||
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
||||||
|
*/
|
||||||
|
public function write_stream($path, $resource);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue