mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #60590 from nextcloud/chore/cleanup
chore: cleanup useless files from repo
This commit is contained in:
commit
8bd37d0ab1
12 changed files with 0 additions and 964 deletions
99
.github/workflows/node-test-handlebars.yml
vendored
99
.github/workflows/node-test-handlebars.yml
vendored
|
|
@ -1,99 +0,0 @@
|
|||
# This workflow is provided via the organization template repository
|
||||
#
|
||||
# https://github.com/nextcloud/.github
|
||||
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
name: Node handlebars tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: node-tests-handlebars-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest-low
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
outputs:
|
||||
src: ${{ steps.changes.outputs.src }}
|
||||
|
||||
steps:
|
||||
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
||||
id: changes
|
||||
continue-on-error: true
|
||||
with:
|
||||
filters: |
|
||||
src:
|
||||
- '.github/workflows/**'
|
||||
- '**/__tests__/**'
|
||||
- '**/__mocks__/**'
|
||||
- 'apps/*/src/**'
|
||||
- 'apps/*/appinfo/info.xml'
|
||||
- 'core/src/**'
|
||||
- 'package.json'
|
||||
- '**/package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- '**.js'
|
||||
- '**.ts'
|
||||
- '**.vue'
|
||||
|
||||
handlebars:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changes]
|
||||
if: needs.changes.outputs.src != 'false'
|
||||
|
||||
env:
|
||||
CYPRESS_INSTALL_BINARY: 0
|
||||
PUPPETEER_SKIP_DOWNLOAD: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Read package.json node and npm engines version
|
||||
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
|
||||
id: versions
|
||||
with:
|
||||
fallbackNode: '^24'
|
||||
fallbackNpm: '^11.3'
|
||||
|
||||
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: ${{ steps.versions.outputs.nodeVersion }}
|
||||
|
||||
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
|
||||
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run compile
|
||||
run: ./build/compile-handlebars-templates.sh
|
||||
|
||||
summary:
|
||||
permissions:
|
||||
contents: none
|
||||
runs-on: ubuntu-latest-low
|
||||
needs: [changes, handlebars]
|
||||
|
||||
if: always()
|
||||
|
||||
name: test-summary
|
||||
|
||||
steps:
|
||||
- name: Summary status
|
||||
run: if ${{ needs.changes.outputs.src != 'false' && needs.handlebars.result != 'success' }}; then exit 1; fi
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
REPODIR=`git rev-parse --show-toplevel`
|
||||
|
||||
cd $REPODIR
|
||||
|
||||
# Settings
|
||||
node node_modules/handlebars/bin/handlebars -n OC.Settings.Templates apps/settings/js/templates -f apps/settings/js/templates.js
|
||||
|
||||
# Files external
|
||||
node node_modules/handlebars/bin/handlebars -n OCA.Files_External.Templates apps/files_external/js/templates -f apps/files_external/js/templates.js
|
||||
|
||||
if [[ $(git diff --name-only) ]]; then
|
||||
echo "Please submit your compiled handlebars templates"
|
||||
echo
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All up to date! Carry on :D"
|
||||
exit 0
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
echo 'Clover file is missing' . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$cloverFile = $argv[1];
|
||||
|
||||
$doc = simplexml_load_file($cloverFile);
|
||||
|
||||
$metrics = [];
|
||||
foreach ($doc->project->metrics->attributes() as $k => $v) {
|
||||
$metrics[$k] = $v->__toString();
|
||||
}
|
||||
|
||||
$c0 = $metrics['coveredmethods'] / $metrics['methods'];
|
||||
$c1 = $metrics['coveredelements'] / $metrics['elements'];
|
||||
$c2 = $metrics['coveredstatements'] / $metrics['statements'];
|
||||
|
||||
echo $c0 . PHP_EOL;
|
||||
echo $c1 . PHP_EOL;
|
||||
echo $c2 . PHP_EOL;
|
||||
|
||||
$percent = (int)($c2 * 100);
|
||||
$color = 'red';
|
||||
if ($percent >= 50) {
|
||||
$color = 'yellow';
|
||||
}
|
||||
if ($percent >= 75) {
|
||||
$color = 'green';
|
||||
}
|
||||
$content = file_get_contents("https://img.shields.io/badge/coverage-$percent%-$color.svg");
|
||||
file_put_contents('coverage.svg', $content);
|
||||
} catch (Exception $ex) {
|
||||
echo $ex->getMessage() . PHP_EOL;
|
||||
$content = file_get_contents('https://img.shields.io/badge/coverage-ERROR-red.svg');
|
||||
file_put_contents('coverage.svg', $content);
|
||||
}
|
||||
Binary file not shown.
|
|
@ -1,2 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2015 ownCloud, Inc.
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
|
@ -1,478 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
class Licenses {
|
||||
protected $paths = [];
|
||||
protected $mailMap = [];
|
||||
protected $checkFiles = [];
|
||||
public $authors = [];
|
||||
|
||||
public function __construct() {
|
||||
$this->licenseText = <<<EOD
|
||||
/**
|
||||
@COPYRIGHT@
|
||||
*
|
||||
@AUTHORS@
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
EOD;
|
||||
$this->licenseTextLegacy = <<<EOD
|
||||
/**
|
||||
@COPYRIGHT@
|
||||
*
|
||||
@AUTHORS@
|
||||
*
|
||||
* @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/>
|
||||
*
|
||||
*/
|
||||
EOD;
|
||||
$this->licenseTextLegacy = str_replace('@YEAR@', date('Y'), $this->licenseTextLegacy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|string[] $folder
|
||||
* @param string|bool $gitRoot
|
||||
*/
|
||||
public function exec($folder, $gitRoot = false) {
|
||||
if (is_array($folder)) {
|
||||
foreach ($folder as $f) {
|
||||
$this->exec($f, $gitRoot);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($gitRoot !== false && substr($gitRoot, -1) !== '/') {
|
||||
$gitRoot .= '/';
|
||||
}
|
||||
|
||||
if (is_file($folder)) {
|
||||
$this->handleFile($folder, $gitRoot);
|
||||
$this->printFilesToCheck();
|
||||
return;
|
||||
}
|
||||
|
||||
$excludes = array_map(function ($item) use ($folder) {
|
||||
return $folder . '/' . $item;
|
||||
}, ['vendor', '3rdparty', '.git', 'l10n', 'templates', 'composer', 'js', 'node_modules']);
|
||||
|
||||
$iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
|
||||
$iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($folder, $excludes) {
|
||||
/** @var SplFileInfo $item */
|
||||
foreach ($excludes as $exclude) {
|
||||
if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$iterator = new RecursiveIteratorIterator($iterator);
|
||||
$iterator = new RegexIterator($iterator, '/^.+\.(js|php)$/i');
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
/** @var SplFileInfo $file */
|
||||
$this->handleFile($file, $gitRoot);
|
||||
}
|
||||
|
||||
$this->printFilesToCheck();
|
||||
}
|
||||
|
||||
public function writeAuthorsFile() {
|
||||
ksort($this->authors);
|
||||
$template = 'Nextcloud is written by:
|
||||
@AUTHORS@
|
||||
|
||||
With help from many libraries and frameworks including:
|
||||
Open Collaboration Services
|
||||
SabreDAV
|
||||
jQuery
|
||||
…
|
||||
';
|
||||
$authors = implode(PHP_EOL, array_map(function ($author) {
|
||||
return ' - ' . $author;
|
||||
}, $this->authors));
|
||||
$template = str_replace('@AUTHORS@', $authors, $template);
|
||||
file_put_contents(__DIR__ . '/../AUTHORS', $template);
|
||||
}
|
||||
|
||||
public function handleFile($path, $gitRoot) {
|
||||
$isPhp = preg_match('/^.+\.php$/i', $path);
|
||||
|
||||
$source = file_get_contents($path);
|
||||
if ($this->isMITLicensed($source)) {
|
||||
echo "MIT licensed file: $path" . PHP_EOL;
|
||||
return;
|
||||
}
|
||||
$copyrightNotices = $this->getCopyrightNotices($path, $source);
|
||||
$authors = $this->getAuthors($path, $gitRoot);
|
||||
if ($this->isOwnCloudLicensed($source)) {
|
||||
$license = str_replace('@AUTHORS@', $authors, $this->licenseTextLegacy);
|
||||
$this->checkCopyrightState($path, $gitRoot);
|
||||
} else {
|
||||
$license = str_replace('@AUTHORS@', $authors, $this->licenseText);
|
||||
}
|
||||
|
||||
if ($copyrightNotices === '') {
|
||||
$creator = $this->getCreatorCopyright($path, $gitRoot);
|
||||
$license = str_replace('@COPYRIGHT@', $creator, $license);
|
||||
} else {
|
||||
$license = str_replace('@COPYRIGHT@', $copyrightNotices, $license);
|
||||
}
|
||||
|
||||
[$source, $isStrict] = $this->eatOldLicense($source);
|
||||
|
||||
if ($isPhp) {
|
||||
if ($isStrict) {
|
||||
$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;
|
||||
}
|
||||
} else {
|
||||
$source = $license . PHP_EOL . PHP_EOL . $source;
|
||||
}
|
||||
|
||||
file_put_contents($path, $source);
|
||||
echo "License updated: $path" . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
* @return bool
|
||||
*/
|
||||
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 isOwnCloudLicensed($source) {
|
||||
$lines = explode(PHP_EOL, $source);
|
||||
while (!empty($lines)) {
|
||||
$line = $lines[0];
|
||||
array_shift($lines);
|
||||
if (strpos($line, 'ownCloud, Inc') !== false || strpos($line, 'ownCloud GmbH') !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
private function eatOldLicense($source) {
|
||||
$lines = explode(PHP_EOL, $source);
|
||||
$isStrict = false;
|
||||
|
||||
$index = 0;
|
||||
while (!empty($lines) && array_key_exists($index, $lines)) {
|
||||
$line = $lines[$index];
|
||||
|
||||
if (trim($line) === '<?php') {
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping if the line contains important js keywords
|
||||
if (strpos($line, 'eslint-') !== false
|
||||
|| strpos($line, 'globals') !== false
|
||||
|| strpos($line, 'const') !== false
|
||||
|| strpos($line, 'import') !== false) {
|
||||
$index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($line, '<?php declare(strict_types') !== false) {
|
||||
$isStrict = true;
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, 'declare (strict_types') !== false) {
|
||||
$isStrict = true;
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, 'declare(strict_types') !== false) {
|
||||
$isStrict = true;
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, '/**') !== false) {
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
// If we reach the end of the copyright header (and it's not a one-line comment /* xxx */)
|
||||
if (strpos($line, '*/') !== false && strpos($line, '/*') !== false) {
|
||||
array_splice($lines, $index, 1);
|
||||
break;
|
||||
}
|
||||
if (strpos($line, '*') !== false) {
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
if (trim($line) === '') {
|
||||
array_splice($lines, $index, 1);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return [implode(PHP_EOL, $lines), $isStrict];
|
||||
}
|
||||
|
||||
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) {
|
||||
return $lineByLine[(int)$line - 1];
|
||||
}, explode(PHP_EOL, $licenseHeaderCopyrightAtLines));
|
||||
}
|
||||
|
||||
return implode(PHP_EOL, $copyrightNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if all lines where changed after the Nextcloud fork.
|
||||
* That's not a guarantee that we can switch to AGPLv3 or later,
|
||||
* but a good indicator that we should have a look at the file
|
||||
*
|
||||
* @param $path
|
||||
* @param $gitRoot
|
||||
*/
|
||||
private function checkCopyrightState($path, $gitRoot) {
|
||||
// This was the date the Nextcloud fork was created
|
||||
$deadline = new DateTime('06/06/2016');
|
||||
$deadlineTimestamp = $deadline->getTimestamp();
|
||||
|
||||
$buildDir = getcwd();
|
||||
if ($gitRoot) {
|
||||
chdir($gitRoot);
|
||||
$path = substr($path, strlen($gitRoot));
|
||||
}
|
||||
$out = shell_exec("git --no-pager blame --line-porcelain $path | sed -n 's/^author-time //p'");
|
||||
if ($gitRoot) {
|
||||
chdir($buildDir);
|
||||
}
|
||||
$timestampChanges = explode(PHP_EOL, $out);
|
||||
$timestampChanges = array_slice($timestampChanges, 0, count($timestampChanges) - 1);
|
||||
foreach ($timestampChanges as $timestamp) {
|
||||
if ((int)$timestamp < $deadlineTimestamp) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//all changes after the deadline
|
||||
$this->checkFiles[] = $path;
|
||||
}
|
||||
|
||||
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 "\n";
|
||||
foreach ($this->checkFiles as $file) {
|
||||
print $file . PHP_EOL;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
private function filterAuthors($authors = []) {
|
||||
$authors = array_filter($authors, function ($author) {
|
||||
return !in_array($author, [
|
||||
'',
|
||||
'Not Committed Yet <not.committed.yet>',
|
||||
'Jenkins for ownCloud <owncloud-bot@tmit.eu>',
|
||||
'Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>',
|
||||
]);
|
||||
});
|
||||
|
||||
// Strip out dependabot
|
||||
$authors = array_filter($authors, function ($author) {
|
||||
return strpos($author, 'dependabot') === false;
|
||||
});
|
||||
|
||||
return $authors;
|
||||
}
|
||||
|
||||
private function getCreatorCopyright($file, $gitRoot) {
|
||||
$buildDir = getcwd();
|
||||
|
||||
if ($gitRoot) {
|
||||
chdir($gitRoot);
|
||||
$file = substr($file, strlen($gitRoot));
|
||||
}
|
||||
|
||||
$year = trim(shell_exec('date +%Y -d "$(git log --format=%aD ../apps/files/lib/Controller/ViewController.php | tail -1)"'));
|
||||
$blame = shell_exec("git blame --line-porcelain $file | sed -n 's/^author //p;s/^author-mail //p' | sed 'N;s/\\n/ /'");
|
||||
$authors = explode(PHP_EOL, $blame);
|
||||
|
||||
if ($gitRoot) {
|
||||
chdir($buildDir);
|
||||
}
|
||||
|
||||
$authors = $this->filterAuthors($authors);
|
||||
|
||||
if ($gitRoot) {
|
||||
$authors = array_map([$this, 'checkCoreMailMap'], $authors);
|
||||
$authors = array_unique($authors);
|
||||
}
|
||||
|
||||
$creator = array_key_exists(0, $authors)
|
||||
? $this->fixInvalidEmail($authors[0])
|
||||
: '';
|
||||
return " * @copyright Copyright (c) $year $creator";
|
||||
}
|
||||
|
||||
private function getAuthors($file, $gitRoot) {
|
||||
// only add authors that changed code and not the license header
|
||||
$licenseHeaderEndsAtLine = trim(shell_exec("grep -n '*/' $file | head -n 1 | cut -d ':' -f 1"));
|
||||
$buildDir = getcwd();
|
||||
|
||||
if ($gitRoot) {
|
||||
chdir($gitRoot);
|
||||
$file = substr($file, strlen($gitRoot));
|
||||
}
|
||||
$out = shell_exec("git blame --line-porcelain -L $licenseHeaderEndsAtLine, $file | sed -n 's/^author //p;s/^author-mail //p' | sed 'N;s/\\n/ /' | sort -f | uniq");
|
||||
|
||||
if ($gitRoot) {
|
||||
chdir($buildDir);
|
||||
}
|
||||
|
||||
$authors = explode(PHP_EOL, $out);
|
||||
$authors = $this->filterAuthors($authors);
|
||||
|
||||
if ($gitRoot) {
|
||||
$authors = array_map([$this, 'checkCoreMailMap'], $authors);
|
||||
$authors = array_unique($authors);
|
||||
}
|
||||
|
||||
$authors = array_map(function ($author) {
|
||||
$author = $this->fixInvalidEmail($author);
|
||||
$this->authors[$author] = $author;
|
||||
return " * @author $author";
|
||||
}, $authors);
|
||||
|
||||
return implode(PHP_EOL, $authors);
|
||||
}
|
||||
|
||||
private function checkCoreMailMap($author) {
|
||||
if (empty($this->mailMap)) {
|
||||
$content = file_get_contents(__DIR__ . '/../.mailmap');
|
||||
$entries = explode("\n", $content);
|
||||
foreach ($entries as $entry) {
|
||||
if (strpos($entry, '> ') === false) {
|
||||
$this->mailMap[$entry] = $entry;
|
||||
} else {
|
||||
[$use, $actual] = explode('> ', $entry);
|
||||
$this->mailMap[$actual] = $use . '>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->mailMap[$author])) {
|
||||
return $this->mailMap[$author];
|
||||
}
|
||||
return $author;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return $author;
|
||||
}
|
||||
}
|
||||
|
||||
$licenses = new Licenses;
|
||||
if (isset($argv[1])) {
|
||||
$licenses->exec($argv[1], isset($argv[2]) ? $argv[1] : false);
|
||||
} else {
|
||||
$licenses->exec([
|
||||
'../apps/admin_audit',
|
||||
'../apps/cloud_federation_api',
|
||||
'../apps/comments',
|
||||
'../apps/contactsinteraction',
|
||||
'../apps/dashboard',
|
||||
'../apps/dav',
|
||||
'../apps/encryption',
|
||||
'../apps/federatedfilesharing',
|
||||
'../apps/federation',
|
||||
'../apps/files',
|
||||
'../apps/files_external',
|
||||
'../apps/files_sharing',
|
||||
'../apps/files_trashbin',
|
||||
'../apps/files_versions',
|
||||
'../apps/lookup_server_connector',
|
||||
'../apps/oauth2',
|
||||
'../apps/provisioning_api',
|
||||
'../apps/settings',
|
||||
'../apps/sharebymail',
|
||||
'../apps/systemtags',
|
||||
'../apps/testing',
|
||||
'../apps/theming',
|
||||
'../apps/twofactor_backupcodes',
|
||||
'../apps/updatenotification',
|
||||
'../apps/user_ldap',
|
||||
'../apps/user_status',
|
||||
'../apps/weather_status',
|
||||
'../apps/workflowengine',
|
||||
'../build/integration/features/bootstrap',
|
||||
'../core',
|
||||
'../lib',
|
||||
'../ocs',
|
||||
'../console.php',
|
||||
'../cron.php',
|
||||
'../index.php',
|
||||
'../public.php',
|
||||
'../remote.php',
|
||||
'../status.php',
|
||||
'../version.php',
|
||||
]);
|
||||
$licenses->writeAuthorsFile();
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
echo "========================="
|
||||
echo "= List of changed files ="
|
||||
echo "========================="
|
||||
git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA
|
||||
echo "========================="
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | wc -l) -eq 0 ]] && echo "No files are modified => merge commit" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep ".json" | grep -v "package.json" | grep -c -v "package-lock.json") -gt 0 ]] && echo "JSON files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".sh") -gt 0 ]] && echo "bash files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".yml") -gt 0 ]] && echo "YML files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".xml") -gt 0 ]] && echo "info.xml files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".php$") -gt 0 ]] && echo "PHP files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "^tests/") -gt 0 ]] && echo "PHP test files are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "/tests/") -gt 0 ]] && echo "PHP test files of an app are modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "3rdparty") -gt 0 ]] && echo "3rdparty is modified" && exit 0
|
||||
|
||||
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "apps/theming/css") -gt 0 ]] && echo "theming css is modified" && exit 0
|
||||
|
||||
exit 1
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
function get_swift_token() {
|
||||
KEYSTONE_OUT=$(curl -s 'http://dockswift:5000/v2.0/tokens' -H 'Content-Type: application/json' -d '{"auth":{"passwordCredentials":{"username":"swift","password":"swift"},"tenantName":"service"}}')
|
||||
if (echo "$KEYSTONE_OUT" | grep -q 'object-store')
|
||||
then
|
||||
SWIFT_ENDPOINT=$(echo "$KEYSTONE_OUT" | php -r "echo array_values(array_filter(json_decode(file_get_contents('php://stdin'),true)['access']['serviceCatalog'], function(\$endpoint){return \$endpoint['type']==='object-store';}))[0]['endpoints'][0]['publicURL'];")
|
||||
SWIFT_TOKEN=$(echo "$KEYSTONE_OUT" | php -r "echo json_decode(file_get_contents('php://stdin'),true)['access']['token']['id'];")
|
||||
return 0
|
||||
else
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$OBJECT_STORE" == "s3" ]; then
|
||||
echo "Waiting for minio to be ready"
|
||||
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://minio:9000)" != "403" ]]; do sleep 5; done' || (
|
||||
echo "Failed to wait for minio to be ready" && exit 1
|
||||
)
|
||||
fi
|
||||
if [ "$OBJECT_STORE" == "swift" ]; then
|
||||
echo "waiting for keystone"
|
||||
until get_swift_token
|
||||
do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "waiting for object store at $SWIFT_ENDPOINT"
|
||||
|
||||
until curl -s -H "X-Auth-Token: $SWIFT_TOKEN" "$SWIFT_ENDPOINT"
|
||||
do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "creating container"
|
||||
|
||||
sleep 2
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
sleep 2
|
||||
|
||||
respCode=$(curl -s -o /dev/null -w "%{http_code}" -X PUT -H "X-Auth-Token: $SWIFT_TOKEN" "$SWIFT_ENDPOINT/nextcloud")
|
||||
|
||||
if [ "$respCode" == "201" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "creating test file"
|
||||
|
||||
i=0
|
||||
while [ 1 ]
|
||||
do
|
||||
sleep 2
|
||||
|
||||
respCode=$(curl -s -o /dev/null -w "%{http_code}" -X PUT -H "X-Auth-Token: $SWIFT_TOKEN" -H "Content-Type: text/html; charset=UTF-8" -d "Hello world" "$SWIFT_ENDPOINT/nextcloud/helloworld.txt")
|
||||
|
||||
if [ "$respCode" == "201" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
i=$((i + 1))
|
||||
if [ "$i" == "20" ]
|
||||
then
|
||||
exit -1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "deleting test file"
|
||||
curl -s -o /dev/null -w "%{http_code}\n" -X DELETE -H "X-Auth-Token: $SWIFT_TOKEN" "$SWIFT_ENDPOINT/nextcloud/helloworld.txt"
|
||||
fi
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
#
|
||||
# This script start a docker container to test the files_external tests
|
||||
# against. It will also change the files_external config to use the docker
|
||||
# container as testing environment. This is reverted in the stop step.W
|
||||
#
|
||||
# Set environment variable DEBUG to print config file
|
||||
#
|
||||
# @author Morris Jobke
|
||||
# @author Robin McCorkell
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "No docker executable found - skipped docker setup"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "Docker executable found - setup docker"
|
||||
|
||||
|
||||
docker_image=xenopathic/ceph-keystone
|
||||
|
||||
echo "Fetch recent ${docker_image} docker image"
|
||||
docker pull ${docker_image}
|
||||
|
||||
# retrieve current folder to place the config in the parent folder
|
||||
thisFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# create readiness notification socket
|
||||
notify_sock=$(readlink -f "$thisFolder"/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock)
|
||||
rm -f "$notify_sock" # in case an unfinished test left one behind
|
||||
mkfifo "$notify_sock"
|
||||
|
||||
port=5034
|
||||
|
||||
user=test
|
||||
pass=testing
|
||||
tenant=testenant
|
||||
region=testregion
|
||||
service=testceph
|
||||
|
||||
container=`docker run -d \
|
||||
-e KEYSTONE_PUBLIC_PORT=${port} \
|
||||
-e KEYSTONE_ADMIN_USER=${user} \
|
||||
-e KEYSTONE_ADMIN_PASS=${pass} \
|
||||
-e KEYSTONE_ADMIN_TENANT=${tenant} \
|
||||
-e KEYSTONE_ENDPOINT_REGION=${region} \
|
||||
-e KEYSTONE_SERVICE=${service} \
|
||||
-e OSD_SIZE=300 \
|
||||
-v "$notify_sock":/run/notifyme.sock \
|
||||
--privileged \
|
||||
${docker_image}`
|
||||
|
||||
host=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "$container")
|
||||
|
||||
|
||||
echo "${docker_image} container: $container"
|
||||
|
||||
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
|
||||
echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
|
||||
|
||||
echo -n "Waiting for ceph initialization"
|
||||
ready=$(timeout 600 cat "$notify_sock")
|
||||
if [[ $ready != 'READY=1' ]]; then
|
||||
echo "[ERROR] Waited 600 seconds, no response" >&2
|
||||
docker logs $container
|
||||
exit 1
|
||||
fi
|
||||
if ! "$thisFolder"/wait-for-connection ${host} 80 600; then
|
||||
echo "[ERROR] Waited 600 seconds, no response" >&2
|
||||
docker logs $container
|
||||
exit 1
|
||||
fi
|
||||
echo "Waiting another 15 seconds"
|
||||
sleep 15
|
||||
|
||||
cat > $thisFolder/swift.config.php <<DELIM
|
||||
<?php
|
||||
\$CONFIG = array (
|
||||
'objectstore' => array(
|
||||
'class' => 'OC\\Files\\ObjectStore\\Swift',
|
||||
'arguments' => array(
|
||||
'username' => '$user',
|
||||
'password' => '$pass',
|
||||
'container' => 'owncloud-autotest$EXECUTOR_NUMBER',
|
||||
'objectPrefix' => 'autotest$EXECUTOR_NUMBER:oid:urn:',
|
||||
'autocreate' => true,
|
||||
'region' => '$region',
|
||||
'url' => 'http://$host:$port/v2.0',
|
||||
'tenantName' => '$tenant',
|
||||
'serviceName' => '$service',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
DELIM
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
echo "############## DEBUG info ###############"
|
||||
echo "### Docker info"
|
||||
docker info
|
||||
echo "### Docker images"
|
||||
docker images
|
||||
echo "### current mountpoints"
|
||||
mount
|
||||
echo "### contents of $thisFolder/swift.config.php"
|
||||
cat $thisFolder/swift.config.php
|
||||
echo "### contents of $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift"
|
||||
cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
|
||||
echo "### docker logs"
|
||||
docker logs $container
|
||||
echo "############## DEBUG info end ###########"
|
||||
fi
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
#
|
||||
# This script stops the docker container the files_external tests were run
|
||||
# against. It will also revert the config changes done in start step.
|
||||
#
|
||||
# @author Morris Jobke
|
||||
# @author Robin McCorkell
|
||||
# @copyright 2015 ownCloud
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "No docker executable found - skipped docker stop"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "Docker executable found - stop and remove docker containers"
|
||||
|
||||
# retrieve current folder to remove the config from the parent folder
|
||||
thisFolder=`echo $0 | replace "stop-swift-ceph.sh" ""`
|
||||
|
||||
if [ -z "$thisFolder" ]; then
|
||||
thisFolder="."
|
||||
fi;
|
||||
|
||||
if [ -e $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift ]; then
|
||||
# stopping and removing docker containers
|
||||
for container in `cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift`; do
|
||||
if [ -n "$DEBUG" ]; then
|
||||
docker logs $container
|
||||
fi
|
||||
echo "Stopping and removing docker container $container"
|
||||
# kills running container and removes it
|
||||
docker stop $container
|
||||
docker rm -f $container
|
||||
done;
|
||||
fi;
|
||||
|
||||
# cleanup
|
||||
rm -rf $thisFolder/swift.config.php
|
||||
rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
|
||||
rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
$timeout = 60;
|
||||
|
||||
switch ($argc) {
|
||||
case 4:
|
||||
$timeout = (float)$argv[3];
|
||||
case 3:
|
||||
$host = $argv[1];
|
||||
$port = (int)$argv[2];
|
||||
break;
|
||||
default:
|
||||
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if ($timeout < 0) {
|
||||
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||
exit(2);
|
||||
}
|
||||
if ($port < 1) {
|
||||
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||
if ($socketTimeout > $timeout) {
|
||||
$socketTimeout = $timeout;
|
||||
}
|
||||
|
||||
$stopTime = time() + $timeout;
|
||||
do {
|
||||
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||
if ($sock !== false) {
|
||||
fclose($sock);
|
||||
fwrite(STDOUT, "\n");
|
||||
exit(0);
|
||||
}
|
||||
sleep(1);
|
||||
fwrite(STDOUT, '.');
|
||||
} while (time() < $stopTime);
|
||||
|
||||
fwrite(STDOUT, "\n");
|
||||
exit(1);
|
||||
Loading…
Reference in a new issue