mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 21:48:41 +00:00
Fix linux bugs
This commit is contained in:
parent
771838c1a4
commit
dacf6a4771
|
|
@ -66,7 +66,7 @@ interface ContainerInterface
|
||||||
*
|
*
|
||||||
* @param string $path Path of the resource
|
* @param string $path Path of the resource
|
||||||
*
|
*
|
||||||
* @return int Permissions (e.g. 0644);
|
* @return int Permissions (e.g. 0755);
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -315,7 +315,7 @@ interface ContainerInterface
|
||||||
/**
|
/**
|
||||||
* Get the permissions id of the resource.
|
* Get the permissions id of the resource.
|
||||||
*
|
*
|
||||||
* @return int Permissions (e.g. 0644);
|
* @return int Permissions (e.g. 0755);
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function create(string $path, string $permission = '0644', bool $recursive = false) : bool
|
public static function create(string $path, string $permission = '0755', bool $recursive = false) : bool
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
|| (!$exists && ($mode & ContentPutMode::CREATE) === ContentPutMode::CREATE)
|
|| (!$exists && ($mode & ContentPutMode::CREATE) === ContentPutMode::CREATE)
|
||||||
) {
|
) {
|
||||||
if (!Directory::exists(dirname($path))) {
|
if (!Directory::exists(dirname($path))) {
|
||||||
Directory::create(dirname($path), 0644, true);
|
Directory::create(dirname($path), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stream = fopen('data://temp,' . $content, 'r');
|
$stream = fopen('data://temp,' . $content, 'r');
|
||||||
|
|
@ -271,7 +271,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
|
|
||||||
if ($overwrite || !self::exists($to)) {
|
if ($overwrite || !self::exists($to)) {
|
||||||
if (!Directory::exists(dirname($to))) {
|
if (!Directory::exists(dirname($to))) {
|
||||||
Directory::create(dirname($to), 0644, true);
|
Directory::create(dirname($to), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ftp_rename($con, $from, $to);
|
return ftp_rename($con, $from, $to);
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($to)) {
|
if (!file_exists($to)) {
|
||||||
self::create($to, 0644, true);
|
self::create($to, 0755, true);
|
||||||
} elseif ($overwrite && file_exists($to)) {
|
} elseif ($overwrite && file_exists($to)) {
|
||||||
self::delete($to);
|
self::delete($to);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -346,7 +346,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::exists(self::parent($to))) {
|
if (!self::exists(self::parent($to))) {
|
||||||
self::create(self::parent($to), 0644, true);
|
self::create(self::parent($to), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
rename($from, $to);
|
rename($from, $to);
|
||||||
|
|
@ -391,7 +391,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function create(string $path, int $permission = 0644, bool $recursive = false) : bool
|
public static function create(string $path, int $permission = 0755, bool $recursive = false) : bool
|
||||||
{
|
{
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
if (!$recursive && !file_exists(self::parent($path))) {
|
if (!$recursive && !file_exists(self::parent($path))) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
file_put_contents($path, $content . file_get_contents($path));
|
file_put_contents($path, $content . file_get_contents($path));
|
||||||
} else {
|
} else {
|
||||||
if (!Directory::exists(dirname($path))) {
|
if (!Directory::exists(dirname($path))) {
|
||||||
Directory::create(dirname($path), 0644, true);
|
Directory::create(dirname($path), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($path, $content);
|
file_put_contents($path, $content);
|
||||||
|
|
@ -265,7 +265,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
|
|
||||||
if ($overwrite || !file_exists($to)) {
|
if ($overwrite || !file_exists($to)) {
|
||||||
if (!Directory::exists(dirname($to))) {
|
if (!Directory::exists(dirname($to))) {
|
||||||
Directory::create(dirname($to), 0644, true);
|
Directory::create(dirname($to), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($overwrite && file_exists($to)) {
|
if ($overwrite && file_exists($to)) {
|
||||||
|
|
@ -291,7 +291,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
|
|
||||||
if ($overwrite || !file_exists($to)) {
|
if ($overwrite || !file_exists($to)) {
|
||||||
if (!Directory::exists(dirname($to))) {
|
if (!Directory::exists(dirname($to))) {
|
||||||
Directory::create(dirname($to), 0644, true);
|
Directory::create(dirname($to), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($overwrite && file_exists($to)) {
|
if ($overwrite && file_exists($to)) {
|
||||||
|
|
@ -359,7 +359,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
{
|
{
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
if (!Directory::exists(dirname($path))) {
|
if (!Directory::exists(dirname($path))) {
|
||||||
Directory::create(dirname($path), 0644, true);
|
Directory::create(dirname($path), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable(dirname($path))) {
|
if (!is_writable(dirname($path))) {
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ abstract class FileAbstract implements ContainerInterface
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected $permission = 0644;
|
protected $permission = 0755;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class LocalStorage extends StorageAbstract
|
||||||
*/
|
*/
|
||||||
public static function create(string $path) : bool
|
public static function create(string $path) : bool
|
||||||
{
|
{
|
||||||
return stripos($path, '.') === false ? Directory::create($path, 0644, true) : File::create($path);
|
return stripos($path, '.') === false ? Directory::create($path, 0755, true) : File::create($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user