updated large file support in dirlist.lib.php to support getting file size of files over 2GB on Windows systems, hopefully getting rid of php's filesize() limitations once and for all.

git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@38 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
jim
2006-11-12 18:42:56 +00:00
parent 104faa098a
commit c73e775903
2 changed files with 14 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
/*
dList v2.2.7 beta
dList v2.2.8 beta
Copyright © 2006 Jim Myhrberg.
zynode@gmail.com

View File

@@ -4,7 +4,7 @@ class dirList {
/*
Class: dirList v2.2 beta
Class: dirList v2.2.1 beta
Copyright © 2006 Jim Myhrberg.
zynode@gmail.com
@@ -227,29 +227,28 @@ class dirList {
}
function get_large_filesize ($file) {
$system = $this->system_info();
if ( $system == 'unix' ) {
if ( $this->system_info() == 'unix' ) {
exec('ls -l "'.str_replace('"', '\"', $file).'"', $details, $result);
if ( $result == 0 ) {
foreach( $details as $key => $value ) {
preg_match('/.*?([0-9]{10,32}).*/i', $value, $size);
return (!empty($size[1])) ? $size[1] : 'LARGE' ;
}
} else {
return 'LARGE';
}
} else {
return 'LARGE';
$file = str_replace('/', '\\', $file);
exec('dir /-C "'.str_replace('"', '\"', $file).'"', $details, $result);
}
if ( $result == 0 ) {
foreach( $details as $key => $value ) {
if ( preg_match('/.*?([0-9]{10,32}).*?'.preg_quote(basename($file), '/').'/i', $value, $size) ) {
return $size[1];
}
}
}
return 'LARGE';
}
function system_info () {
if ( stripos('windows', $_SERVER['SERVER_SOFTWARE']) ) {
if ( preg_match('/windows|win32|win64/i', $_SERVER['SERVER_SOFTWARE']) ) {
return 'windows';
} else {
return 'unix';
}
}
function getOwner ($item) {