From 35128f533a5177cc76b364bfe423fd3ba2cf21fe Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 22 Sep 2015 17:34:41 +0200 Subject: [PATCH 1/2] moved files and directory destruction at the end of destructor, after XmlReaders desctruction, to avoid them to lock the temporary files. --- SpreadsheetReader_XLSX.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/SpreadsheetReader_XLSX.php b/SpreadsheetReader_XLSX.php index 9cf8d12..a17934c 100644 --- a/SpreadsheetReader_XLSX.php +++ b/SpreadsheetReader_XLSX.php @@ -321,19 +321,6 @@ public function __construct($Filepath, array $Options = null) */ public function __destruct() { - foreach ($this -> TempFiles as $TempFile) - { - @unlink($TempFile); - } - - // Better safe than sorry - shouldn't try deleting '.' or '/', or '..'. - if (strlen($this -> TempDir) > 2) - { - @rmdir($this -> TempDir.'xl'.DIRECTORY_SEPARATOR.'worksheets'); - @rmdir($this -> TempDir.'xl'); - @rmdir($this -> TempDir); - } - if ($this -> Worksheet && $this -> Worksheet instanceof XMLReader) { $this -> Worksheet -> close(); @@ -356,6 +343,19 @@ public function __destruct() { unset($this -> WorkbookXML); } + + foreach ($this -> TempFiles as $TempFile) + { + @unlink($TempFile); + } + + // Better safe than sorry - shouldn't try deleting '.' or '/', or '..'. + if (strlen($this -> TempDir) > 2) + { + @rmdir($this -> TempDir.'xl'.DIRECTORY_SEPARATOR.'worksheets'); + @rmdir($this -> TempDir.'xl'); + @rmdir($this -> TempDir); + } } /** From 557e6a323756cbeac7c61bc8c3d54d2e832daa3a Mon Sep 17 00:00:00 2001 From: Pascal Masschelier Date: Tue, 22 Sep 2015 19:17:28 +0200 Subject: [PATCH 2/2] change name in composer.json to allow composer to fetch it as pa-m/spreadsheet-reader --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0e64a78..a692086 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "nuovo/spreadsheet-reader", + "name": "pa-m/spreadsheet-reader", "description": "Spreadsheet reader library for Excel, OpenOffice and structured text files", "keywords": ["spreadsheet", "xls", "xlsx", "ods", "csv", "excel", "openoffice"], "homepage": "https://github.com/nuovo/spreadsheet-reader",