Skip to content

Commit

Permalink
Merge pull request #25 from mmattel/Fix_for_non_Windows_Fileservers
Browse files Browse the repository at this point in the history
Fix for allfinfo and parsStat for non Windows Fileservers
  • Loading branch information
icewind1991 committed Apr 10, 2015
2 parents e36beec + 286024d commit 4f5d9db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public function parseStat($output) {
$size = 0;
foreach ($output as $line) {
list($name, $value) = explode(':', $line, 2);
// A line = explode statement may not fill all array elements
// properly. May happen when accessing non Windows Fileservers
$words = explode(':', $line, 2);
$name = isset($words[0]) ? $words[0] : '';
$value = isset($words[1]) ? $words[1] : '';
$value = trim($value);
if ($name === 'write_time') {
$mtime = strtotime($value);
Expand Down
6 changes: 6 additions & 0 deletions src/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ public function dir($path) {
public function stat($path) {
$escapedPath = $this->escapePath($path);
$output = $this->execute('allinfo ' . $escapedPath);
// Windows and non Windows Fileserver may respond different
// to the allinfo command for directories. If the result is a single
// line = error line, redo it with a different allinfo parameter
if ($escapedPath == '""' && count($output) < 2) {
$output = $this->execute('allinfo ' . '"."');
}
if (count($output) < 3) {
$this->parseOutput($output, $path);
}
Expand Down

0 comments on commit 4f5d9db

Please sign in to comment.