aboutsummaryrefslogtreecommitdiffstats
path: root/build/license.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/license.php')
-rw-r--r--build/license.php47
1 files changed, 17 insertions, 30 deletions
diff --git a/build/license.php b/build/license.php
index 94ef4e4b02c..bb6351181c6 100644
--- a/build/license.php
+++ b/build/license.php
@@ -1,22 +1,9 @@
<?php
+
/**
- * @author Thomas Müller
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
class Licenses {
@@ -71,7 +58,7 @@ EOD;
*
*/
EOD;
- $this->licenseTextLegacy = str_replace('@YEAR@', date("Y"), $this->licenseTextLegacy);
+ $this->licenseTextLegacy = str_replace('@YEAR@', date('Y'), $this->licenseTextLegacy);
}
/**
@@ -123,7 +110,7 @@ EOD;
public function writeAuthorsFile() {
ksort($this->authors);
- $template = "Nextcloud is written by:
+ $template = 'Nextcloud is written by:
@AUTHORS@
With help from many libraries and frameworks including:
@@ -131,12 +118,12 @@ With help from many libraries and frameworks including:
SabreDAV
jQuery
-";
+';
$authors = implode(PHP_EOL, array_map(function ($author) {
- return " - ".$author;
+ return ' - ' . $author;
}, $this->authors));
$template = str_replace('@AUTHORS@', $authors, $template);
- file_put_contents(__DIR__.'/../AUTHORS', $template);
+ file_put_contents(__DIR__ . '/../AUTHORS', $template);
}
public function handleFile($path, $gitRoot) {
@@ -167,9 +154,9 @@ With help from many libraries and frameworks including:
if ($isPhp) {
if ($isStrict) {
- $source = "<?php" . PHP_EOL . PHP_EOL . 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $license . PHP_EOL . $source;
+ $source = '<?php' . PHP_EOL . PHP_EOL . 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $license . PHP_EOL . $source;
} else {
- $source = "<?php" . PHP_EOL . $license . PHP_EOL . $source;
+ $source = '<?php' . PHP_EOL . $license . PHP_EOL . $source;
}
} else {
$source = $license . PHP_EOL . PHP_EOL . $source;
@@ -234,7 +221,7 @@ With help from many libraries and frameworks including:
$index++;
continue;
}
-
+
if (strpos($line, '<?php declare(strict_types') !== false) {
$isStrict = true;
array_splice($lines, $index, 1);
@@ -276,7 +263,7 @@ With help from many libraries and frameworks including:
private function getCopyrightNotices($path, $file) {
$licenseHeaderCopyrightAtLines = trim(shell_exec("grep -ni 'copyright' $path | cut -d ':' -f 1"));
$lineByLine = explode(PHP_EOL, $file);
-
+
$copyrightNotice = [];
if (trim($licenseHeaderCopyrightAtLines !== '')) {
$copyrightNotice = array_map(function ($line) use ($lineByLine) {
@@ -324,8 +311,8 @@ With help from many libraries and frameworks including:
private function printFilesToCheck() {
if (!empty($this->checkFiles)) {
print "\n";
- print "For following files all lines changed since the Nextcloud fork." . PHP_EOL;
- print "Please check if these files can be moved over to AGPLv3 or later" . PHP_EOL;
+ print 'For following files all lines changed since the Nextcloud fork.' . PHP_EOL;
+ print 'Please check if these files can be moved over to AGPLv3 or later' . PHP_EOL;
print "\n";
foreach ($this->checkFiles as $file) {
print $file . PHP_EOL;
@@ -369,7 +356,7 @@ With help from many libraries and frameworks including:
}
$authors = $this->filterAuthors($authors);
-
+
if ($gitRoot) {
$authors = array_map([$this, 'checkCoreMailMap'], $authors);
$authors = array_unique($authors);
@@ -436,7 +423,7 @@ With help from many libraries and frameworks including:
private function fixInvalidEmail($author) {
preg_match('/<(.*)>/', $author, $mailMatch);
if (count($mailMatch) === 2 && !filter_var($mailMatch[1], FILTER_VALIDATE_EMAIL)) {
- $author = str_replace('<'.$mailMatch[1].'>', '"'.$mailMatch[1].'"', $author);
+ $author = str_replace('<' . $mailMatch[1] . '>', '"' . $mailMatch[1] . '"', $author);
}
return $author;
}