Merge remote-tracking branch 'upstream/develop' into api-lists-missing

This commit is contained in:
Michael 2021-05-13 22:01:19 +00:00
commit 6eb3874646
3 changed files with 65 additions and 56 deletions

View File

@ -11,4 +11,53 @@ steps:
- name: Check default
image: friendicaci/transifex
commands:
- /check-messages.sh
- /check-messages.sh
---
kind: pipeline
type: docker
name: php7.3-lint
steps:
- name: Test
image: php:7.3
commands:
- ./bin/composer.phar run lint
---
kind: pipeline
type: docker
name: php7.4-lint
steps:
- name: Test
image: php:7.4
commands:
- ./bin/composer.phar run lint
---
kind: pipeline
type: docker
name: php8.0-lint
steps:
- name: Test
image: php:8.0
commands:
- ./bin/composer.phar run lint
---
kind: pipeline
type: docker
name: php-cs check
trigger:
event:
- pull_request
steps:
- name: Install dependencies
image: composer
commands:
- ./bin/composer.phar run cs:install
- name: Run coding standards check
image: friendicaci/php-cs
commands:
- export CHANGED_FILES="$(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | grep ^A | cut -f2)"
- /check-php-cs.sh

View File

@ -1,42 +0,0 @@
name: Lint
on: pull_request
jobs:
php-linters:
name: php${{ matrix.php-versions }} lint
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: bin/composer.phar run lint
php-cs-fixer:
name: php-cs check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get changed files
id: changes
uses: jitterbit/get-changed-files@v1
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: 7.2
coverage: none
- name: Install dependencies
run: bin/composer.phar run cs:install
- name: Run coding standards check
run: |
if ! echo "${{ steps.changes.outputs.added }}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${{ steps.changes.outputs.added }}"); else EXTRA_ARGS=''; fi
bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --diff --diff-format=udiff --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS}
shell: bash

View File

@ -1441,19 +1441,19 @@ class DFRN
/**
* Fetch the author data from head or entry items
*
* @param object $xpath XPath object
* @param object $context In which context should the data be searched
* @param array $importer Record of the importer user mixed with contact of the content
* @param string $element Element name from which the data is fetched
* @param bool $onlyfetch Should the data only be fetched or should it update the contact record as well
* @param string $xml optional, default empty
* @param \DOMXPath $xpath XPath object
* @param \DOMNode $context In which context should the data be searched
* @param array $importer Record of the importer user mixed with contact of the content
* @param string $element Element name from which the data is fetched
* @param bool $onlyfetch Should the data only be fetched or should it update the contact record as well
* @param string $xml optional, default empty
*
* @return array Relevant data of the author
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find good type-hints for all parameter
*/
private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "")
private static function fetchauthor(\DOMXPath $xpath, \DOMNode $context, $importer, $element, $onlyfetch, $xml = "")
{
$author = [];
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
@ -1609,12 +1609,14 @@ class DFRN
}
// "dfrn:birthday" contains the birthday converted to UTC
$birthday = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
if (strtotime($birthday) > time()) {
$bd_timestamp = strtotime($birthday);
$poco["bdyear"] = date("Y", $bd_timestamp);
$birthday = XML::getFirstNodeValue($xpath, $element . "/dfrn:birthday/text()", $context);
try {
$birthday_date = new \DateTime($birthday);
if ($birthday_date > new \DateTime()) {
$poco["bdyear"] = $birthday_date->format("Y");
}
} catch (\Exception $e) {
// Invalid birthday
}
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"