mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 13:11:31 +00:00
fix line indenting
This commit is contained in:
parent
851ca7013b
commit
078847ab9b
|
@ -25,50 +25,50 @@
|
||||||
* @version Release: @package_version@
|
* @version Release: @package_version@
|
||||||
*/
|
*/
|
||||||
class SeedDMS_Core_File {
|
class SeedDMS_Core_File {
|
||||||
/**
|
/**
|
||||||
* @param $old
|
* @param $old
|
||||||
* @param $new
|
* @param $new
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function renameFile($old, $new) { /* {{{ */
|
static function renameFile($old, $new) { /* {{{ */
|
||||||
return @rename($old, $new);
|
return @rename($old, $new);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function removeFile($file) { /* {{{ */
|
static function removeFile($file) { /* {{{ */
|
||||||
return @unlink($file);
|
return @unlink($file);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $target
|
* @param $target
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function copyFile($source, $target) { /* {{{ */
|
static function copyFile($source, $target) { /* {{{ */
|
||||||
return @copy($source, $target);
|
return @copy($source, $target);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $target
|
* @param $target
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function moveFile($source, $target) { /* {{{ */
|
static function moveFile($source, $target) { /* {{{ */
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
if (!@copyFile($source, $target))
|
if (!@copyFile($source, $target))
|
||||||
return false;
|
return false;
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
return @removeFile($source);
|
return @removeFile($source);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
static function fileSize($file) { /* {{{ */
|
static function fileSize($file) { /* {{{ */
|
||||||
if(!$a = fopen($file, 'r'))
|
if(!$a = fopen($file, 'r'))
|
||||||
return false;
|
return false;
|
||||||
fseek($a, 0, SEEK_END);
|
fseek($a, 0, SEEK_END);
|
||||||
|
@ -77,22 +77,22 @@ class SeedDMS_Core_File {
|
||||||
return $filesize;
|
return $filesize;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $size
|
* @param $size
|
||||||
* @param array $sizes
|
* @param array $sizes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||||
if ($size == 0) return('0 Bytes');
|
if ($size == 0) return('0 Bytes');
|
||||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $str
|
* @param $str
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
static function parse_filesize($str) { /* {{{ */
|
static function parse_filesize($str) { /* {{{ */
|
||||||
preg_replace('/\s\s+/', ' ', $str);
|
preg_replace('/\s\s+/', ' ', $str);
|
||||||
if(strtoupper(substr($str, -1)) == 'B') {
|
if(strtoupper(substr($str, -1)) == 'B') {
|
||||||
$value = (int) substr($str, 0, -2);
|
$value = (int) substr($str, 0, -2);
|
||||||
|
@ -115,32 +115,32 @@ class SeedDMS_Core_File {
|
||||||
return $value;
|
return $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/** @noinspection PhpUnreachableStatementInspection */
|
/** @noinspection PhpUnreachableStatementInspection */
|
||||||
return false;
|
return false;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function checksum($file) { /* {{{ */
|
static function checksum($file) { /* {{{ */
|
||||||
return md5_file($file);
|
return md5_file($file);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $old
|
* @param $old
|
||||||
* @param $new
|
* @param $new
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function renameDir($old, $new) { /* {{{ */
|
static function renameDir($old, $new) { /* {{{ */
|
||||||
return @rename($old, $new);
|
return @rename($old, $new);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function makeDir($path) { /* {{{ */
|
static function makeDir($path) { /* {{{ */
|
||||||
|
|
||||||
if( !is_dir( $path ) ){
|
if( !is_dir( $path ) ){
|
||||||
$res=@mkdir( $path , 0777, true);
|
$res=@mkdir( $path , 0777, true);
|
||||||
|
@ -195,11 +195,11 @@ class SeedDMS_Core_File {
|
||||||
*/
|
*/
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function removeDir($path) { /* {{{ */
|
static function removeDir($path) { /* {{{ */
|
||||||
$handle = @opendir($path);
|
$handle = @opendir($path);
|
||||||
while ($entry = @readdir($handle) )
|
while ($entry = @readdir($handle) )
|
||||||
{
|
{
|
||||||
|
@ -220,12 +220,12 @@ class SeedDMS_Core_File {
|
||||||
return @rmdir($path);
|
return @rmdir($path);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sourcePath
|
* @param $sourcePath
|
||||||
* @param $targetPath
|
* @param $targetPath
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||||
if (mkdir($targetPath, 0777)) {
|
if (mkdir($targetPath, 0777)) {
|
||||||
$handle = @opendir($sourcePath);
|
$handle = @opendir($sourcePath);
|
||||||
while ($entry = @readdir($handle) ) {
|
while ($entry = @readdir($handle) ) {
|
||||||
|
@ -247,26 +247,26 @@ class SeedDMS_Core_File {
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sourcePath
|
* @param $sourcePath
|
||||||
* @param $targetPath
|
* @param $targetPath
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
if (!copyDir($sourcePath, $targetPath))
|
if (!copyDir($sourcePath, $targetPath))
|
||||||
return false;
|
return false;
|
||||||
/** @noinspection PhpUndefinedFunctionInspection */
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
return removeDir($sourcePath);
|
return removeDir($sourcePath);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
// code by Kioob (php.net manual)
|
// code by Kioob (php.net manual)
|
||||||
/**
|
/**
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param bool $level
|
* @param bool $level
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
static function gzcompressfile($source, $level=false) { /* {{{ */
|
static function gzcompressfile($source, $level=false) { /* {{{ */
|
||||||
$dest=$source.'.gz';
|
$dest=$source.'.gz';
|
||||||
$mode='wb'.$level;
|
$mode='wb'.$level;
|
||||||
$error=false;
|
$error=false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user