Exclude the vendor folder in migration

Fixes #481
Fixes #586
This commit is contained in:
Andrew Siegman 2018-07-06 12:06:08 -07:00 committed by Adrien Crivelli
parent e0ed25d6b2
commit 043327bb7d
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 13 additions and 3 deletions

View File

@ -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) - 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) - 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 ## [1.3.1] - 2018-06-12

View File

@ -249,10 +249,14 @@ class Migrator
{ {
$patterns = [ $patterns = [
'/*.md', '/*.md',
'/*.php',
'/*.phtml',
'/*.txt', '/*.txt',
'/*.TXT', '/*.TXT',
'/*.php',
'/*.phpt',
'/*.php3',
'/*.php4',
'/*.php5',
'/*.phtml',
]; ];
$from = array_keys($this->getMapping()); $from = array_keys($this->getMapping());
@ -260,6 +264,11 @@ class Migrator
foreach ($patterns as $pattern) { foreach ($patterns as $pattern) {
foreach (glob($path . $pattern) as $file) { foreach (glob($path . $pattern) as $file) {
if (strpos($path, '/vendor/') !== false) {
echo $file . " skipped\n";
continue;
}
$original = file_get_contents($file); $original = file_get_contents($file);
$converted = str_replace($from, $to, $original); $converted = str_replace($from, $to, $original);