mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-18 23:46:39 +00:00
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:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
dList v2.2.7 beta
|
dList v2.2.8 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg.
|
Copyright © 2006 Jim Myhrberg.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class dirList {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class: dirList v2.2 beta
|
Class: dirList v2.2.1 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg.
|
Copyright © 2006 Jim Myhrberg.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
@@ -227,29 +227,28 @@ class dirList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_large_filesize ($file) {
|
function get_large_filesize ($file) {
|
||||||
$system = $this->system_info();
|
if ( $this->system_info() == 'unix' ) {
|
||||||
if ( $system == 'unix' ) {
|
|
||||||
exec('ls -l "'.str_replace('"', '\"', $file).'"', $details, $result);
|
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 {
|
} 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 () {
|
function system_info () {
|
||||||
if ( stripos('windows', $_SERVER['SERVER_SOFTWARE']) ) {
|
if ( preg_match('/windows|win32|win64/i', $_SERVER['SERVER_SOFTWARE']) ) {
|
||||||
return 'windows';
|
return 'windows';
|
||||||
} else {
|
} else {
|
||||||
return 'unix';
|
return 'unix';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOwner ($item) {
|
function getOwner ($item) {
|
||||||
|
|||||||
Reference in New Issue
Block a user