예제 #1
0
파일: license.php 프로젝트: kenwi/core
            if (trim($line) === '') {
                array_shift($lines);
                continue;
            }
            break;
        }
        return implode(PHP_EOL, $lines);
    }
    private function getAuthors($file)
    {
        // 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"));
        $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");
        $authors = explode(PHP_EOL, $out);
        $authors = array_filter($authors, function ($author) {
            return !in_array($author, ['', 'Not Committed Yet <not.committed.yet>', 'Jenkins for ownCloud <*****@*****.**>']);
        });
        $authors = array_map(function ($author) {
            $this->authors[$author] = $author;
            return " * @author {$author}";
        }, $authors);
        return implode(PHP_EOL, $authors);
    }
}
$licenses = new Licenses();
if (isset($argv[1])) {
    $licenses->exec($argv[1]);
} else {
    $licenses->exec(['../apps/dav', '../apps/encryption', '../apps/federation', '../apps/files', '../apps/files_external', '../apps/files_sharing', '../apps/files_trashbin', '../apps/files_versions', '../apps/provisioning_api', '../apps/user_ldap', '../core', '../lib', '../ocs', '../settings', '../console.php', '../cron.php', '../index.php', '../public.php', '../remote.php', '../status.php', '../version.php']);
    $licenses->writeAuthorsFile();
}
예제 #2
0
            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 {
                    list($use, $actual) = explode('> ', $entry);
                    $this->mailMap[$actual] = $use . '>';
                }
            }
        }
        if (isset($this->mailMap[$author])) {
            return $this->mailMap[$author];
        }
        return $author;
    }
}
$licenses = new Licenses();
if (isset($argv[1])) {
    $licenses->exec($argv[1], isset($argv[2]) ? $argv[1] : false);
} else {
    $licenses->exec(['../apps/comments', '../apps/dav', '../apps/encryption', '../apps/federatedfilesharing', '../apps/federation', '../apps/files', '../apps/files_external', '../apps/files_sharing', '../apps/files_trashbin', '../apps/files_versions', '../apps/provisioning_api', '../apps/systemtags', '../apps/testing', '../apps/updatenotification', '../apps/user_ldap', '../core', '../lib', '../ocs', '../ocs-provider', '../settings', '../console.php', '../cron.php', '../index.php', '../public.php', '../remote.php', '../status.php', '../version.php']);
    $licenses->writeAuthorsFile();
}