Skip to content

Commit

Permalink
Merge pull request #39 from OPUS4/4.7.2-zf1f
Browse files Browse the repository at this point in the history
Kompatibilität mit PHP 8.1
  • Loading branch information
j3nsch authored Feb 3, 2023
2 parents e3ecf0f + a620a21 commit cd8c962
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 120 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
php-versions: ['7.1', '7.4', '8.1']

name: PHP ${{ matrix.php-versions }} Test

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP 7.1
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
php-version: ${{ matrix.php-versions }}

- name: Check PHP Version
run: php -v

- name: Install Composer and Dependencies
run: curl -s http://getcomposer.org/installer | php && php composer.phar self-update && php composer.phar install
Expand All @@ -26,7 +35,7 @@ jobs:
run: sudo systemctl start mysql.service

- name: Prepare database
run: bash vendor/opus4-repo/framework/bin/prepare-database.sh --admin_pwd root --user_pwd root
run: bash vendor/bin/opus4db --adminpwd root --userpwd root --sqlpwd root

- name: Prepare
run: ant prepare-workspace prepare-config lint -DdbUserPassword=root -DdbAdminPassword=root && export APPLICATION_PATH=. && php vendor/opus4-repo/framework/db/createdb.php
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ test/config.ini

# Other
**/.DS_Store
/.phpunit.result.cache
4 changes: 2 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bin/composer update
SCRIPT

$database = <<SCRIPT
/vagrant/vendor/opus4-repo/framework/bin/prepare-database.sh --admin_pwd root --user_pwd root
/vagrant/vendor/bin/opus4db --adminpwd root --userpwd root --sqlpwd root
SCRIPT

$opus = <<SCRIPT
Expand Down Expand Up @@ -59,7 +59,7 @@ echo "'composer cs-fix' to automatically fix basic style problems"
SCRIPT

Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.vm.box = "bento/ubuntu-22.04"

config.vm.provision "Install required software...", type: "shell", inline: $software
config.vm.provision "Install Composer dependencies...", type: "shell", privileged: false, inline: $composer
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"opus4-repo/opus4-job": "dev-main"
},
"require-dev": {
"phpunit/phpunit": "6.*",
"laminas/laminas-coding-standard": "<2.3",
"phpunit/phpunit": "<9",
"opus4-repo/codesniffer": "dev-laminas",
"phpmetrics/phpmetrics": "2.7.4",
"opus4-repo/framework": "4.7.2.x-dev"
},
Expand Down
23 changes: 1 addition & 22 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
<?xml version="1.0"?>
<ruleset name="OPUS 4 coding standard">
<rule ref="./vendor/laminas/laminas-coding-standard/src/LaminasCodingStandard/ruleset.xml" />
<rule ref="./vendor/opus4-repo/codesniffer/src/ruleset.xml" />
<file>src</file>
<file>test</file>

<!-- Loosening the Laminas coding style to allow our customary annotations. -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@api"/>
<element value="@created"/>
<element value="@subpackage"/>
<element value="@version"/>
<element value="@expectedException"/>
<element value="@expectedExceptionCode"/>
<element value="@expectedExceptionMessage"/>
<element value="@expectedExceptionMessageRegExp"/>
</property>
</properties>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue">
<type>warning</type>
</rule>

</ruleset>
17 changes: 10 additions & 7 deletions src/AbstractPackageReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright Copyright (c) 2016
* @copyright Copyright (c) 2016, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*
* Reads an OPUS import package containing one or more documents and imports
* the documents.
*
* Currently ZIP and TAR files are supported by extending classes.
*/

namespace Opus\Import;
Expand All @@ -43,6 +38,7 @@
use Opus\Import\Sword\ImportCollection;
use Opus\Import\Xml\MetadataImportInvalidXmlException;
use Opus\Import\Xml\MetadataImportSkippedDocumentsException;
use Zend_Exception;

use function file_get_contents;
use function is_dir;
Expand All @@ -53,18 +49,25 @@

use const DIRECTORY_SEPARATOR;

/**
* Reads an OPUS import package containing one or more documents and imports
* the documents.
*
* Currently ZIP and TAR files are supported by extending classes.
*/
abstract class AbstractPackageReader
{
const METADATA_FILENAME = 'opus.xml';

const EXTRACTION_DIR_NAME = 'extracted';

/** @var AdditionalEnrichments */
private $additionalEnrichments;

/**
* Sets additional enrichments that will be added to every imported document.
*
* @param array $additionalEnrichments
* @param AdditionalEnrichments $additionalEnrichments
*/
public function setAdditionalEnrichments($additionalEnrichments)
{
Expand Down
5 changes: 5 additions & 0 deletions src/CsvImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ class CsvImporter
const ENRICHMENT_RELEVANCE = 31;
const FILENAME = 32;

/** @var array */
private $seriesIdsMap = [];

/** @var string */
private $fulltextDir;

/** @var string */
private $guestRole;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/ImportStatusDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright Copyright (c) 2016-2022
* @copyright Copyright (c) 2016, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

Expand All @@ -38,6 +38,7 @@
*/
class ImportStatusDocument
{
/** @var array */
private $docs = [];

/**
Expand Down
Loading

0 comments on commit cd8c962

Please sign in to comment.