Update FileManagerApi.php
This commit is contained in:
parent
24480f09e4
commit
a6103f3d56
1 changed files with 5 additions and 16 deletions
|
@ -6,7 +6,7 @@ class FileManagerApi
|
|||
{
|
||||
public function isDir($path)
|
||||
{
|
||||
return ShellApi::exec('test -d ' . $path);
|
||||
return is_dir($path);
|
||||
}
|
||||
|
||||
public function isFile($path)
|
||||
|
@ -20,17 +20,17 @@ class FileManagerApi
|
|||
|
||||
public function mkdir($path)
|
||||
{
|
||||
ShellApi::exec('mkdir -p '.$path);
|
||||
return mkdir($path, 0755, true);
|
||||
}
|
||||
|
||||
public function fileGetContents($file)
|
||||
{
|
||||
return ShellApi::exec('cat ' . $file);
|
||||
return file_get_contents($file);
|
||||
}
|
||||
|
||||
public function symlink($source, $destination)
|
||||
{
|
||||
ShellApi::exec('ln -s ' . $source . ' ' . $destination);
|
||||
return symlink($source, $destination);
|
||||
}
|
||||
|
||||
public function fileExists($file)
|
||||
|
@ -39,18 +39,7 @@ class FileManagerApi
|
|||
}
|
||||
public function filePutContents($file, $data)
|
||||
{
|
||||
$tempfileName = md5($file . time() . rand(111, 999));
|
||||
|
||||
$tempfilePath = storage_path('tmp/' . $tempfileName);
|
||||
if (is_dir(dirname($tempfilePath)) == false) {
|
||||
mkdir(dirname($tempfilePath), 0755, true);
|
||||
}
|
||||
|
||||
file_put_contents($tempfilePath, $data);
|
||||
|
||||
ShellApi::exec('cp ' . $tempfilePath . ' ' . $file);
|
||||
|
||||
unlink($tempfilePath);
|
||||
return file_put_contents($file, $data);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue