Skip to content

Commit

Permalink
Merge pull request #42 from OPUS4/4.7.2
Browse files Browse the repository at this point in the history
4.7.2
  • Loading branch information
j3nsch authored Apr 24, 2023
2 parents 63aff0b + 14900b5 commit 6babd4e
Show file tree
Hide file tree
Showing 21 changed files with 178 additions and 203 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,39 @@ on:
jobs:
build:

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

strategy:
matrix:
php-versions: ['7.1', '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

- name: Check files
run: ant lint

- name: Start MySQL
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
- name: Prepare workspace
run: ant prepare-workspace

- name: Prepare
run: ant prepare-workspace prepare-config lint -DdbUserPassword=root -DdbAdminPassword=root && export APPLICATION_PATH=. && php vendor/opus4-repo/framework/db/createdb.php
- name: Prepare database
run: bash vendor/bin/opus4db --adminpwd root --userpwd root --sqlpwd root

- name: Tests
run: php composer.phar test
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ nbproject

# Build files
build
test/config.ini
database.ini*

# Other
**/.DS_Store
/.phpunit.result.cache
16 changes: 7 additions & 9 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ bin/install-composer.sh
bin/composer update
SCRIPT

$database = <<SCRIPT
/vagrant/vendor/opus4-repo/framework/bin/prepare-database.sh --admin_pwd root --user_pwd root
$workspace = <<SCRIPT
cd /vagrant
ant prepare-workspace
SCRIPT

$opus = <<SCRIPT
cd /vagrant
ant prepare-workspace prepare-config -DdbUserPassword=root -DdbAdminPassword=root
export APPLICATION_PATH=/vagrant
php vendor/opus4-repo/framework/db/createdb.php
$database = <<SCRIPT
/vagrant/vendor/bin/opus4db --adminpwd root --userpwd root --sqlpwd root
SCRIPT

$environment = <<SCRIPT
Expand All @@ -59,12 +57,12 @@ 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
config.vm.provision "Create workspace...", type: "shell", privileged: false, inline: $workspace
config.vm.provision "Create database...", type: "shell", inline: $database
config.vm.provision "Configure OPUS 4...", type: "shell", privileged: false, inline: $opus
config.vm.provision "Setup environment...", type: "shell", inline: $environment
config.vm.provision "Information", type: "shell", privileged: false, run: "always", inline: $help
end
21 changes: 0 additions & 21 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
<project name="opus4-import">

<property environment="env" />
<property name="bindir" value="${basedir}/vendor/bin" />

<!-- Properties for configuration files (tests/config.ini) used for testing. -->
<property name="dbName" value="opusdb" />
<property name="dbUserName" value="opus4" />
<property name="dbUserPassword" value="" />
<property name="dbAdminName" value="opus4admin" />
<property name="dbAdminPassword" value="" />

<target name="clean">
<delete dir="${basedir}/build/logs" />
Expand All @@ -35,19 +27,6 @@
<mkdir dir="${basedir}/build/workspace/files" />
</target>

<target name="prepare-config">
<copy file="${basedir}/test/config.ini.template" toFile="${basedir}/test/config.ini" filtering="true"
overwrite="true">
<filterset>
<filter token="db.user.name" value="${dbUserName}" />
<filter token="db.user.password" value="${dbUserPassword}" />
<filter token="db.admin.name" value="${dbAdminName}" />
<filter token="db.admin.password" value="${dbAdminPassword}" />
<filter token="db.name" value="${dbName}" />
</filterset>
</copy>
</target>

<target name="lint">
<apply executable="php" dir="${basedir}" failonerror="on" logerror="on">
<arg line="-l"/>
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
"ext-fileinfo": "*",
"ext-libxml": "*",
"ext-zip": "*",
"opus4-repo/opus4-common": "dev-master",
"opus4-repo/framework": "dev-master"
"opus4-repo/opus4-common": "^4.8",
"opus4-repo/opus4-job": "^4.8"
},
"require-dev": {
"phpunit/phpunit": "6.*",
"laminas/laminas-coding-standard": "<2.3",
"phpmetrics/phpmetrics": "2.7.4"
"phpunit/phpunit": "<9",
"opus4-repo/codesniffer": "dev-laminas",
"phpmetrics/phpmetrics": "2.7.4",
"opus4-repo/framework": "^4.8"
},
"config": {
"allow-plugins": {
Expand Down Expand Up @@ -51,7 +52,7 @@
"prepare": "mkdir -p build",
"test": "phpunit --colors=always --log-junit build/phpunit.xml",
"test-coverage": "phpunit --log-junit build/phpunit.xml --colors=always --coverage-html build/coverage/ --coverage-clover build/coverage/clover.xml",
"cs-check": "phpcs -n",
"cs-check": "phpcs -n -p",
"cs-report": "phpcs -n --report=checkstyle --report-file=build/checkstyle.xml",
"cs-fix": "phpcbf"
}
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>
18 changes: 9 additions & 9 deletions src/AbstractPackageReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,20 @@
* 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;

use Exception;
use Opus\Common\Log;
use Opus\Common\Model\ModelException;
use Opus\Common\Security\SecurityException;
use Opus\Import\Sword\ImportCollection;
use Opus\Import\Xml\MetadataImportInvalidXmlException;
use Opus\Import\Xml\MetadataImportSkippedDocumentsException;
use Opus\Security\SecurityException;
use Zend_Exception;

use function file_get_contents;
use function is_dir;
Expand All @@ -54,20 +50,24 @@
use const DIRECTORY_SEPARATOR;

/**
* @package Opus\Import
* 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 6babd4e

Please sign in to comment.