Skip to content

Commit

Permalink
Update for OJS 3.3 filesystem changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Jan 28, 2021
1 parent e3308c4 commit add29e5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions PlagiarismPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function callback($hookName, $args) {
if (!($groupId = array_search($contextName, $groupList))) {
// No folder group found for the context; create one.
$groupId = $ithenticate->createGroup($contextName);
if (!$groupId) {
if (!$groupId) {
error_log('Could not create folder group for context ' . $contextName . ' on iThenticate.');
return false;
}
Expand All @@ -98,17 +98,21 @@ public function callback($hookName, $args) {
return false;
}

$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFiles = $submissionFileDao->getBySubmissionId($submission->getId());
$submissionFiles = Services::get('submissionFile')->getMany([
'submissionIds' => [$submission->getId()],
]);

$authors = $publication->getData('authors');
$author = array_shift($authors);
foreach ($submissionFiles as $submissionFile) {
$file = Services::get('file')->get($submissionFile->getData('fileId'));
error_log('Name: ' . $submissionFile->getLocalizedData('name'));
if (!$ithenticate->submitDocument(
$submissionFile->getLocalizedName(),
$submissionFile->getLocalizedData('name'),
$author->getLocalizedGivenName(),
$author->getLocalizedFamilyName(),
$submissionFile->getOriginalFileName(),
file_get_contents($submissionFile->getFilePath()),
$submissionFile->getLocalizedData('name'),
Services::get('file')->fs->read($file->path),
$folderId
)) {
error_log('Could not submit ' . $submissionFile->getFilePath() . ' to iThenticate.');
Expand Down

0 comments on commit add29e5

Please sign in to comment.