Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mfelczak/bepress#28 Add OJS 3.3 support #29

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

ewhanson
Copy link
Collaborator

@ewhanson ewhanson commented Aug 5, 2022

No description provided.

@ewhanson
Copy link
Collaborator Author

ewhanson commented Aug 5, 2022

Hi @mfelczak, this is ready for review. Could you have a look. I've tested it with both PHP 7.4 and PHP 8.0. Thanks!

@ewhanson
Copy link
Collaborator Author

ewhanson commented Aug 5, 2022

Hey @jonasraoni, would you be able to do a quick review of this? Thanks!

locale/en_US/locale.po Outdated Show resolved Hide resolved
// FIXME: This attaches the associated user to the request and is a workaround for no users being present
// when running CLI tools. This assumes that given the username supplied should be used as the
// authenticated user. To revisit later.
Registry::set('user', $editor);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this workaround and a setContext() to the NativeImportExportPlugin, perhaps we should move this into the ImportExportPlugin later 🤔

index.php Outdated Show resolved Hide resolved
index.php Show resolved Hide resolved

foreach ($importArticles as $entry) {
$articlePath = $issuePath . '/' . $entry;
if (!is_dir($articlePath) || preg_match('/^\./', $entry)) continue;
if (!is_dir($articlePath) || preg_match('/^\./', $entry) || !$entry) continue;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to fix the loop with an extra variable (e.g. for ($importArticles = []; $path = readdir($articleHandle); $importArticles[] = $path);), but that's just my preference 😁

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preg_match('/^\./', $entry) could ignore a good folder (e.g. .xxx), but if I remember well this plugin expects folders to be numbered, right? Then perhaps it's better to check if the entry is a valid number, otherwise emit a warning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to fix the loop with an extra variable (e.g. for ($importArticles = []; $path = readdir($articleHandle); $importArticles[] = $path);), but that's just my preference 😁

@jonasraoni, just curious: what would that look like in this case? That's not a pattern I've typically used.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you've added the !$entry to cover the case of readdir() returning false in the last iteration, if that's not the purpose, then ignore my comment =]

what would that look like in this case?

I've left a piece of untested code in the comment to fix the loop, that should probably be applied to the other places.
In fact, here I would replace the readdir() by the FilesystemIterator, which will skip the dot folders automatically \o/

BepressImportDom.inc.php Outdated Show resolved Hide resolved
BepressImportDom.inc.php Outdated Show resolved Hide resolved
BepressImportDom.inc.php Outdated Show resolved Hide resolved

/** @var GenreDAO $genreDao */
$genreDao = DAORegistry::getDAO('GenreDAO');
$genre = $genreDao->getByKey('SUBMISSION', $this->_journal->getId());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be cached out of the loop.

BepressImportDom.inc.php Outdated Show resolved Hide resolved
Copy link

@jonasraoni jonasraoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ewhanson, with the exception of this comment: https://github.com/mfelczak/bepress/pull/29/files#r939505772, the others are just near useless notes 😁

@ewhanson ewhanson merged commit a679ba6 into mfelczak:stable-3_3_0 Aug 9, 2022
@ewhanson ewhanson deleted the stable-3_3_0 branch August 9, 2022 21:34
@ewhanson ewhanson mentioned this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants