mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-02 04:24:56 +02:00
120 lines
3.4 KiB
PHP
120 lines
3.4 KiB
PHP
<?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\adapter;
|
|
|
|
interface adapter_interface
|
|
{
|
|
/**
|
|
* Set adapter parameters
|
|
*
|
|
* @param array options Storage-specific options.
|
|
*/
|
|
public function configure($options);
|
|
|
|
/**
|
|
* Dumps content into a file.
|
|
*
|
|
* @param string path The file to be written to.
|
|
* @param string content The data to write into the file.
|
|
*
|
|
* @throws \phpbb\storage\exception\exception When the file already exists
|
|
* When the file cannot be written
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*/
|
|
public function put_contents($path, $content);
|
|
|
|
/**
|
|
* Read the contents of a file
|
|
*
|
|
* @param string $path The file to read
|
|
*
|
|
* @throws \phpbb\storage\exception\exception When the file dont exists
|
|
* When cannot read file contents
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*
|
|
* @return string Returns file contents
|
|
*
|
|
*/
|
|
public function get_contents($path);
|
|
|
|
/**
|
|
* Checks the existence of files or directories.
|
|
*
|
|
* @param string $path file/directory to check
|
|
*
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*
|
|
* @return bool Returns true if all files/directories exist, false otherwise
|
|
*/
|
|
public function exists($path);
|
|
|
|
/**
|
|
* Removes files or directories.
|
|
*
|
|
* @param string $path file/directory to remove
|
|
*
|
|
* @throws \phpbb\storage\exception\exception When removal fails.
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*/
|
|
public function delete($path);
|
|
|
|
/**
|
|
* Rename a file or a directory.
|
|
*
|
|
* @param string $path_orig The original file/direcotry
|
|
* @param string $path_dest The target file/directory
|
|
*
|
|
* @throws \phpbb\storage\exception\exception When target exists
|
|
* When file/directory cannot be renamed
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*/
|
|
public function rename($path_orig, $path_dest);
|
|
|
|
/**
|
|
* Copies a file.
|
|
*
|
|
* @param string $path_orig The original filename
|
|
* @param string $path_dest The target filename
|
|
*
|
|
* @throws \phpbb\storage\exception\exception When target exists
|
|
* When the file cannot be copied
|
|
* @throws \phpbb\storage\exception\not_implemented When the adapter doesnt implement the method
|
|
*/
|
|
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);
|
|
}
|