Skip to content

Commit 6babd4e

Browse files
authored
Merge pull request #42 from OPUS4/4.7.2
4.7.2
2 parents 63aff0b + 14900b5 commit 6babd4e

21 files changed

+178
-203
lines changed

.github/workflows/php.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,39 @@ on:
99
jobs:
1010
build:
1111

12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
13+
14+
strategy:
15+
matrix:
16+
php-versions: ['7.1', '8.1']
17+
18+
name: PHP ${{ matrix.php-versions }} Test
1319

1420
steps:
15-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
1622

17-
- name: Setup PHP 7.1
23+
- name: Setup PHP ${{ matrix.php-versions }}
1824
uses: shivammathur/setup-php@v2
1925
with:
20-
php-version: '7.1'
26+
php-version: ${{ matrix.php-versions }}
27+
28+
- name: Check PHP Version
29+
run: php -v
2130

2231
- name: Install Composer and Dependencies
2332
run: curl -s http://getcomposer.org/installer | php && php composer.phar self-update && php composer.phar install
2433

34+
- name: Check files
35+
run: ant lint
36+
2537
- name: Start MySQL
2638
run: sudo systemctl start mysql.service
2739

28-
- name: Prepare database
29-
run: bash vendor/opus4-repo/framework/bin/prepare-database.sh --admin_pwd root --user_pwd root
40+
- name: Prepare workspace
41+
run: ant prepare-workspace
3042

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

3446
- name: Tests
3547
run: php composer.phar test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ nbproject
1414

1515
# Build files
1616
build
17-
test/config.ini
17+
database.ini*
1818

1919
# Other
2020
**/.DS_Store
21+
/.phpunit.result.cache

Vagrantfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ bin/install-composer.sh
2929
bin/composer update
3030
SCRIPT
3131

32-
$database = <<SCRIPT
33-
/vagrant/vendor/opus4-repo/framework/bin/prepare-database.sh --admin_pwd root --user_pwd root
32+
$workspace = <<SCRIPT
33+
cd /vagrant
34+
ant prepare-workspace
3435
SCRIPT
3536

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

4341
$environment = <<SCRIPT
@@ -59,12 +57,12 @@ echo "'composer cs-fix' to automatically fix basic style problems"
5957
SCRIPT
6058

6159
Vagrant.configure("2") do |config|
62-
config.vm.box = "bento/ubuntu-20.04"
60+
config.vm.box = "bento/ubuntu-22.04"
6361

6462
config.vm.provision "Install required software...", type: "shell", inline: $software
6563
config.vm.provision "Install Composer dependencies...", type: "shell", privileged: false, inline: $composer
64+
config.vm.provision "Create workspace...", type: "shell", privileged: false, inline: $workspace
6665
config.vm.provision "Create database...", type: "shell", inline: $database
67-
config.vm.provision "Configure OPUS 4...", type: "shell", privileged: false, inline: $opus
6866
config.vm.provision "Setup environment...", type: "shell", inline: $environment
6967
config.vm.provision "Information", type: "shell", privileged: false, run: "always", inline: $help
7068
end

build.xml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
<project name="opus4-import">
33

44
<property environment="env" />
5-
<property name="bindir" value="${basedir}/vendor/bin" />
6-
7-
<!-- Properties for configuration files (tests/config.ini) used for testing. -->
8-
<property name="dbName" value="opusdb" />
9-
<property name="dbUserName" value="opus4" />
10-
<property name="dbUserPassword" value="" />
11-
<property name="dbAdminName" value="opus4admin" />
12-
<property name="dbAdminPassword" value="" />
135

146
<target name="clean">
157
<delete dir="${basedir}/build/logs" />
@@ -35,19 +27,6 @@
3527
<mkdir dir="${basedir}/build/workspace/files" />
3628
</target>
3729

38-
<target name="prepare-config">
39-
<copy file="${basedir}/test/config.ini.template" toFile="${basedir}/test/config.ini" filtering="true"
40-
overwrite="true">
41-
<filterset>
42-
<filter token="db.user.name" value="${dbUserName}" />
43-
<filter token="db.user.password" value="${dbUserPassword}" />
44-
<filter token="db.admin.name" value="${dbAdminName}" />
45-
<filter token="db.admin.password" value="${dbAdminPassword}" />
46-
<filter token="db.name" value="${dbName}" />
47-
</filterset>
48-
</copy>
49-
</target>
50-
5130
<target name="lint">
5231
<apply executable="php" dir="${basedir}" failonerror="on" logerror="on">
5332
<arg line="-l"/>

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
"ext-fileinfo": "*",
1414
"ext-libxml": "*",
1515
"ext-zip": "*",
16-
"opus4-repo/opus4-common": "dev-master",
17-
"opus4-repo/framework": "dev-master"
16+
"opus4-repo/opus4-common": "^4.8",
17+
"opus4-repo/opus4-job": "^4.8"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "6.*",
21-
"laminas/laminas-coding-standard": "<2.3",
22-
"phpmetrics/phpmetrics": "2.7.4"
20+
"phpunit/phpunit": "<9",
21+
"opus4-repo/codesniffer": "dev-laminas",
22+
"phpmetrics/phpmetrics": "2.7.4",
23+
"opus4-repo/framework": "^4.8"
2324
},
2425
"config": {
2526
"allow-plugins": {
@@ -51,7 +52,7 @@
5152
"prepare": "mkdir -p build",
5253
"test": "phpunit --colors=always --log-junit build/phpunit.xml",
5354
"test-coverage": "phpunit --log-junit build/phpunit.xml --colors=always --coverage-html build/coverage/ --coverage-clover build/coverage/clover.xml",
54-
"cs-check": "phpcs -n",
55+
"cs-check": "phpcs -n -p",
5556
"cs-report": "phpcs -n --report=checkstyle --report-file=build/checkstyle.xml",
5657
"cs-fix": "phpcbf"
5758
}

phpcs.xml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
<?xml version="1.0"?>
22
<ruleset name="OPUS 4 coding standard">
3-
<rule ref="./vendor/laminas/laminas-coding-standard/src/LaminasCodingStandard/ruleset.xml" />
3+
<rule ref="./vendor/opus4-repo/codesniffer/src/ruleset.xml" />
44
<file>src</file>
55
<file>test</file>
6-
7-
<!-- Loosening the Laminas coding style to allow our customary annotations. -->
8-
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
9-
<properties>
10-
<property name="forbiddenAnnotations" type="array">
11-
<element value="@api"/>
12-
<element value="@created"/>
13-
<element value="@subpackage"/>
14-
<element value="@version"/>
15-
<element value="@expectedException"/>
16-
<element value="@expectedExceptionCode"/>
17-
<element value="@expectedExceptionMessage"/>
18-
<element value="@expectedExceptionMessageRegExp"/>
19-
</property>
20-
</properties>
21-
</rule>
22-
23-
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue">
24-
<type>warning</type>
25-
</rule>
26-
276
</ruleset>

src/AbstractPackageReader.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@
2525
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
2626
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2727
*
28-
* @copyright Copyright (c) 2016
28+
* @copyright Copyright (c) 2016, OPUS 4 development team
2929
* @license http://www.gnu.org/licenses/gpl.html General Public License
30-
*
31-
* Reads an OPUS import package containing one or more documents and imports
32-
* the documents.
33-
*
34-
* Currently ZIP and TAR files are supported by extending classes.
3530
*/
3631

3732
namespace Opus\Import;
3833

3934
use Exception;
4035
use Opus\Common\Log;
4136
use Opus\Common\Model\ModelException;
37+
use Opus\Common\Security\SecurityException;
4238
use Opus\Import\Sword\ImportCollection;
4339
use Opus\Import\Xml\MetadataImportInvalidXmlException;
4440
use Opus\Import\Xml\MetadataImportSkippedDocumentsException;
45-
use Opus\Security\SecurityException;
41+
use Zend_Exception;
4642

4743
use function file_get_contents;
4844
use function is_dir;
@@ -54,20 +50,24 @@
5450
use const DIRECTORY_SEPARATOR;
5551

5652
/**
57-
* @package Opus\Import
53+
* Reads an OPUS import package containing one or more documents and imports
54+
* the documents.
55+
*
56+
* Currently ZIP and TAR files are supported by extending classes.
5857
*/
5958
abstract class AbstractPackageReader
6059
{
6160
const METADATA_FILENAME = 'opus.xml';
6261

6362
const EXTRACTION_DIR_NAME = 'extracted';
6463

64+
/** @var AdditionalEnrichments */
6565
private $additionalEnrichments;
6666

6767
/**
6868
* Sets additional enrichments that will be added to every imported document.
6969
*
70-
* @param array $additionalEnrichments
70+
* @param AdditionalEnrichments $additionalEnrichments
7171
*/
7272
public function setAdditionalEnrichments($additionalEnrichments)
7373
{

src/CsvImporter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,13 @@ class CsvImporter
111111
const ENRICHMENT_RELEVANCE = 31;
112112
const FILENAME = 32;
113113

114+
/** @var array */
114115
private $seriesIdsMap = [];
116+
117+
/** @var string */
115118
private $fulltextDir;
119+
120+
/** @var string */
116121
private $guestRole;
117122

118123
/**

src/ImportStatusDocument.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
2626
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2727
*
28-
* @copyright Copyright (c) 2016-2022
28+
* @copyright Copyright (c) 2016, OPUS 4 development team
2929
* @license http://www.gnu.org/licenses/gpl.html General Public License
3030
*/
3131

@@ -38,6 +38,7 @@
3838
*/
3939
class ImportStatusDocument
4040
{
41+
/** @var array */
4142
private $docs = [];
4243

4344
/**

0 commit comments

Comments
 (0)