From 043327bb7dd4c4a8812c5b99b4ceb54647d77173 Mon Sep 17 00:00:00 2001 From: Andrew Siegman Date: Fri, 6 Jul 2018 12:06:08 -0700 Subject: [PATCH] Exclude the vendor folder in migration Fixes #481 Fixes #586 --- CHANGELOG.md | 3 ++- src/PhpSpreadsheet/Helper/Migrator.php | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edda25e2..58f117bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Xlsx reader crashed when reading a file with workbook protection - [#553](https://github.com/PHPOffice/PhpSpreadsheet/pull/553) - Cell formats with escaped spaces were causing incorrect date formatting - [#557](https://github.com/PHPOffice/PhpSpreadsheet/issues/557) -- Could not open CSV file containing HTML fragment - [##564](https://github.com/PHPOffice/PhpSpreadsheet/issues/564) +- Could not open CSV file containing HTML fragment - [#564](https://github.com/PHPOffice/PhpSpreadsheet/issues/564) +- Exclude the vendor folder in migration - [#481](https://github.com/PHPOffice/PhpSpreadsheet/issues/481) ## [1.3.1] - 2018-06-12 diff --git a/src/PhpSpreadsheet/Helper/Migrator.php b/src/PhpSpreadsheet/Helper/Migrator.php index b6d5f2a6..93686626 100644 --- a/src/PhpSpreadsheet/Helper/Migrator.php +++ b/src/PhpSpreadsheet/Helper/Migrator.php @@ -249,10 +249,14 @@ class Migrator { $patterns = [ '/*.md', - '/*.php', - '/*.phtml', '/*.txt', '/*.TXT', + '/*.php', + '/*.phpt', + '/*.php3', + '/*.php4', + '/*.php5', + '/*.phtml', ]; $from = array_keys($this->getMapping()); @@ -260,6 +264,11 @@ class Migrator foreach ($patterns as $pattern) { foreach (glob($path . $pattern) as $file) { + if (strpos($path, '/vendor/') !== false) { + echo $file . " skipped\n"; + + continue; + } $original = file_get_contents($file); $converted = str_replace($from, $to, $original);