Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/composer/solarium/solarium-tw-6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer committed Jun 22, 2023
2 parents 85e430d + bc68218 commit 8d85cc4
Show file tree
Hide file tree
Showing 134 changed files with 11,101 additions and 1,154 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/task-for-the-development-fund.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Task for the development fund
about: A working package which may be sponsored by the Kitodo e.V. development fund.
title: "[FUND] "
labels: development fund 2023
labels: development fund 2023
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The development was paid for by ...

## Testing and Review

If applicable, provide a working demo to help us review the changes. Alternatively, describe the tests that you ran to verify your changes and provide instructions so we can reproduce.
If applicable, provide a working demo to help us review the changes. Alternatively, describe the tests that you ran to verify your changes and provide instructions so we can reproduce your steps.

### Environment

Expand Down
16 changes: 16 additions & 0 deletions .github/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "CodeQL Configuration"

queries:
- uses: security-and-quality

query-filters:
- exclude:
problem.severity:
- note

paths-ignore:
- Resources/Public/JavaScript/OpenLayers
- Resources/Public/JavaScript/Toastify
- Resources/Public/JavaScript/jPlayer
- Resources/Public/JavaScript/jQuery
- Resources/Public/JavaScript/jQueryUI
11 changes: 0 additions & 11 deletions .github/codeql/config.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ rules:
- base: master
upstream: kitodo:master
mergeMethod: hardreset
- base: 1.x
upstream: kitodo:1.x
mergeMethod: hardreset
- base: 2.x
upstream: kitodo:2.x
mergeMethod: hardreset
- base: 3.2.x
upstream: kitodo:3.2.x
mergeMethod: hardreset
- base: 3.3.x
upstream: kitodo:3.3.x
mergeMethod: hardreset
- base: 4.x
upstream: kitodo:4.x
mergeMethod: hardreset
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
name: Static Code Analyzing and Security Scanning
name: Codacy.com

on:
# Trigger analysis when pushing in stable branches (which includes merging pull requests)
push:
branches: [master, 2.x, 3.2.x, 3.3.x, 4.x]
# Trigger analysis when a new release is drafted
release:
type: [created, edited]
branches: [ "master", "1.x", "2.x", "3.2.x", "3.3.x", "4.x" ]
pull_request:
branches: [ "master" ]

jobs:
sonarcloud:
name: SonarCloud Static Code Analyzer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

# Execute SonarCloud Scan
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
permissions:
contents: read

jobs:
codacy-security-scan:
name: Codacy Security Scan
permissions:
contents: read
security-events: write
actions: read
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -42,7 +31,6 @@ jobs:
with:
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: [ "master", "1.x", "2.x", "3.2.x", "3.3.x", "4.x" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "39 1 * * 1"

jobs:
analyze:
Expand All @@ -30,7 +28,7 @@ jobs:
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/config.yml
config-file: ./.github/codeql.yml

- name: Autobuild
uses: github/codeql-action/autobuild@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run the tests
name: Unit and Functional Testing

on:
push:
Expand Down
37 changes: 18 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
.buildpath
.cache
.idea/
.loadpath
.metadata
.project
.settings/
.vscode
.phpdoc
Build/Documentation/_build
Build/Documentation/venv
Build/Documentation/dbdocs/var
Build/Test/.env
composer.lock
Documentation-GENERATED-temp/
nbproject/
public/
var/
vendor/
/.buildpath
/.cache
/.idea/
/.loadpath
/.metadata
/.project
/.settings/
/.vscode
/.phpdoc
/Build/Documentation/_build
/Build/Documentation/venv
/Build/Documentation/dbdocs/var
/Build/Test/.env
/Documentation-GENERATED-temp/
/nbproject/
/public/
/var/
/vendor/
18 changes: 0 additions & 18 deletions .lgtm.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .whitesource

This file was deleted.

Binary file not shown.
Binary file not shown.
127 changes: 127 additions & 0 deletions Classes/Api/Orcid/Client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php

/**
* (c) Kitodo. Key to digital objects e.V. <[email protected]>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

namespace Kitodo\Dlf\Api\Orcid;

use Psr\Http\Message\RequestFactoryInterface;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* ORCID API Client class
*
* @author Beatrycze Volk <[email protected]>
* @package TYPO3
* @subpackage dlf
* @access public
**/
class Client
{
/**
* constants for API endpoint
**/
const HOSTNAME = 'orcid.org';
const VERSION = '3.0';

/**
* This holds the logger
*
* @var LogManager
* @access protected
*/
protected $logger;

/**
* The ORCID API endpoint
*
* @var string
**/
private $endpoint = 'record';

/**
* The ORCID API access level
*
* @var string
**/
private $level = 'pub';

/**
* The ORCID ID to search for
*
* @var string
**/
private $orcid = null;

/**
* The request object
*
* @var RequestFactoryInterface
**/
private $requestFactory = null;

/**
* Constructs a new instance
*
* @param string $orcid: the ORCID to search for
* @param RequestFactory $requestFactory a request object to inject
* @return void
**/
public function __construct($orcid, RequestFactory $requestFactory)
{
$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
$this->orcid = $orcid;
$this->requestFactory = $requestFactory;
}

/**
* Sets API endpoint
*
* @param string $endpoint the shortname of the endpoint
*
* @return void
*/
public function setEndpoint($endpoint) {
$this->endpoint = $endpoint;
}

/**
* Get the profile data
*
* @return object|bool
**/
public function getData()
{
$url = $this->getApiEndpoint();
try {
$response = $this->requestFactory->request($url);
} catch (\Exception $e) {
$this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
return false;
}
return $response->getBody()->getContents();
}

/**
* Creates the qualified API endpoint for retrieving the desired data
*
* @return string
**/
private function getApiEndpoint()
{
$url = 'https://' . $this->level . '.' . self::HOSTNAME;
$url .= '/v' . self::VERSION . '/';
$url .= $this->orcid;
$url .= '/' . $this->endpoint;
return $url;
}
}
Loading

0 comments on commit 8d85cc4

Please sign in to comment.