mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-07 20:04:32 +02:00
Create FileSystemUtil interface
This commit is contained in:
parent
83f561ea49
commit
65624e2c19
2 changed files with 39 additions and 1 deletions
|
@ -12,7 +12,7 @@ use Friendica\Core\Logger\Exception\LoggerUnusableException;
|
||||||
/**
|
/**
|
||||||
* Util class for filesystem manipulation for Logger classes
|
* Util class for filesystem manipulation for Logger classes
|
||||||
*/
|
*/
|
||||||
class FileSystem
|
class FileSystem implements FileSystemUtil
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string a error message
|
* @var string a error message
|
||||||
|
|
38
src/Core/Logger/Util/FileSystemUtil.php
Normal file
38
src/Core/Logger/Util/FileSystemUtil.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Copyright (C) 2010-2024, the Friendica project
|
||||||
|
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
namespace Friendica\Core\Logger\Util;
|
||||||
|
|
||||||
|
use Friendica\Core\Logger\Exception\LoggerUnusableException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface for Util class for filesystem manipulation for Logger classes
|
||||||
|
*/
|
||||||
|
interface FileSystemUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates a directory based on a file, which gets accessed
|
||||||
|
*
|
||||||
|
* @param string $file The file
|
||||||
|
*
|
||||||
|
* @return string The directory name (empty if no directory is found, like urls)
|
||||||
|
*
|
||||||
|
* @throws LoggerUnusableException
|
||||||
|
*/
|
||||||
|
public function createDir(string $file): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a stream based on a URL (could be a local file or a real URL)
|
||||||
|
*
|
||||||
|
* @param string $url The file/url
|
||||||
|
*
|
||||||
|
* @return resource the open stream resource
|
||||||
|
*
|
||||||
|
* @throws LoggerUnusableException
|
||||||
|
*/
|
||||||
|
public function createStream(string $url);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue