diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-17 13:58:46 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-26 13:38:40 +0300 |
commit | 653ad63e9b9e14c8000319da6adc1c74b69b6db1 (patch) | |
tree | a4fdae973dbf2aa61442c9abe87217dfc0c5c027 /build/license.php | |
parent | b2b61bdf161f04829424066226c58ae179a75a7d (diff) |
detect MIT licensed files and ignore them for now
Diffstat (limited to 'build/license.php')
-rw-r--r-- | build/license.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/build/license.php b/build/license.php index f7fd52d3977..a8d82b084e6 100644 --- a/build/license.php +++ b/build/license.php @@ -87,13 +87,30 @@ EOD; function handleFile($path) { $source = file_get_contents($path); + if ($this->isMITLicensed($source)) { + echo "MIT licensed file: $path" . PHP_EOL; + return; + } $source = $this->eatOldLicense($source); $authors = $this->getAuthors($path); $license = str_replace('@AUTHORS@', $authors, $this->licenseText); $source = "<?php" . PHP_EOL . $license . PHP_EOL . $source; file_put_contents($path,$source); - echo "License updated: $path\n"; + echo "License updated: $path" . PHP_EOL; + } + + private function isMITLicensed($source) { + $lines = explode(PHP_EOL, $source); + while(!empty($lines)) { + $line = $lines[0]; + array_shift($lines); + if (strpos($line, 'The MIT License') !== false) { + return true; + } + } + + return false; } private function eatOldLicense($source) { |