mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Fix #69
This commit is contained in:
parent
aaa936ad99
commit
0110db8edb
|
|
@ -97,7 +97,7 @@ class FtpStorage extends StorageAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function permission(string $path) : string
|
||||
public static function permission(string $path) : int
|
||||
{
|
||||
// TODO: Implement permission() method.
|
||||
}
|
||||
|
|
@ -174,6 +174,30 @@ class FtpStorage extends StorageAbstract
|
|||
// TODO: Implement basename() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function dirname(string $path) : string
|
||||
{
|
||||
// TODO: Implement basename() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function dirpath(string $path) : string
|
||||
{
|
||||
// TODO: Implement basename() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function list(string $path, string $filter = '*') : array
|
||||
{
|
||||
// TODO: Implement basename() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -178,11 +178,12 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function count(string $path, bool $recursive = true, array $ignore = ['.', '..', 'cgi-bin',
|
||||
'.DS_Store']) : int
|
||||
public static function count(string $path, bool $recursive = true, array $ignore = []) : int
|
||||
{
|
||||
$size = 0;
|
||||
$files = scandir($path);
|
||||
$ignore[] = '.';
|
||||
$ignore[] = '..';
|
||||
|
||||
foreach ($files as $t) {
|
||||
if (in_array($t, $ignore)) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class File extends FileAbstract implements FileInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function count(string $path) : int
|
||||
public static function count(string $path, bool $recursive = true, array $ignore = []) : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class LocalStorage extends StorageAbstract
|
|||
|
||||
private static function getClassType(string $path) : string
|
||||
{
|
||||
return is_dir($path) ? Directory::class : File::class;
|
||||
return is_dir($path) || (!is_file($path) && stripos($path, '.') === false) ? Directory::class : File::class;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +77,7 @@ class LocalStorage extends StorageAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function permission(string $path) : string
|
||||
public static function permission(string $path) : int
|
||||
{
|
||||
return self::getClassType($path)::permission($path);
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ class LocalStorage extends StorageAbstract
|
|||
*/
|
||||
public static function create(string $path) : bool
|
||||
{
|
||||
return self::getClassType($path)::create($path);
|
||||
return stripos($path, '.') === false ? Directory::create($path, 0644, true) : File::create($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -154,6 +154,22 @@ class LocalStorage extends StorageAbstract
|
|||
return self::getClassType($path)::basename($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function dirname(string $path) : string
|
||||
{
|
||||
return self::getClassType($path)::dirname($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function dirpath(string $path) : string
|
||||
{
|
||||
return self::getClassType($path)::dirpath($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -189,7 +205,7 @@ class LocalStorage extends StorageAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function list(string $path, string $filter = '*') : string
|
||||
public static function list(string $path, string $filter = '*') : array
|
||||
{
|
||||
if(is_file($path)) {
|
||||
throw new \Exception();
|
||||
|
|
@ -215,7 +231,7 @@ class LocalStorage extends StorageAbstract
|
|||
throw new \Exception();
|
||||
}
|
||||
|
||||
return File::set_socket_blocking($path, $content);
|
||||
return File::set($path, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -251,6 +267,6 @@ class LocalStorage extends StorageAbstract
|
|||
throw new \Exception();
|
||||
}
|
||||
|
||||
return File::extension($path, $content);
|
||||
return File::extension($path);
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ abstract class StorageAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public abstract static function permission(string $path) : string;
|
||||
public abstract static function permission(string $path) : int;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
@ -133,6 +133,21 @@ abstract class StorageAbstract
|
|||
*/
|
||||
public abstract static function basename(string $path) : string;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public abstract static function dirname(string $path) : string;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public abstract static function dirpath(string $path) : string;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public abstract static function list(string $path, string $filter = '*') : array;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user