Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@gitlost
Copy link
Contributor

@gitlost gitlost commented Oct 2, 2017

Fixes #25
Fixes #43

For discussion.

Skips rather than fails when PDF thumbnails are not available or when images such as SVGs are encountered.

Some re-factoring is involved re changing process_regeneration() to take extra args $successes, $errors, $skips rather than return a boolean success/fail, and bailing at various stages incrementing one of them.

But the main functionality change is checking the return values of WP core functions re #43, and acting accordingly.

Utils\report_batch_operation_results() has been cloned and adapted locally to add a $skips arg and to report errors as failures in the return string, which is probably good elsewhere but would lead to breaking tests probably and maybe BC concerns (though can we assume its value isn't being parsed in command pipes?). Anyway it might make sense to change the Utils version instead.

A default behaviour test media-regenerate.feature:3 has been added. Also tests for SVG media-regenerate.feature:847, PDF with/without thumbnails media-regenerate.feature:988 etc, audio/video with/without cover art media-regenerate.feature:1125 etc, and all together media-regenerate.feature:1222.

Edit should add that test audio and video files have temporarily been put on my server pending upload to wp-cli.org.

.travis.yml Outdated
- php: 5.6
env: WP_VERSION=3.9
- php: 5.6
env: WP_VERSION=4.2
Copy link
Member

Choose a reason for hiding this comment

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

This will be overwritten the next time we run wp scaffold package-tests.

Rather than run the entire test suite for these versions, can we use a Scenario Outline to run the same tests against multiple WP versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, much better solution, will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately I can't see how to do this currently, without adding a new "Given a WP version X install" type step, so I'll just leave the extra WP versions for the mo, at least until just before merge.

Copy link
Member

Choose a reason for hiding this comment

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

Here's how I'd test behavior on a specific WP version:

Given a WP install
And I run `wp core download --version=<version> --force`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah very good, will do.

@danielbachhuber
Copy link
Member

For discussion.

Is there specific feedback you're looking for?

There's a lot of code churn, so it's difficult to comment on the diff directly. However, my historic opinion of this code is that it's been a mess, so I welcome the work cleaning it up. I feel reasonably confident in the test coverage around the functionality, so not terribly concerned about breakage.

Edit should add that test audio and video files have temporarily been put on my server pending upload to wp-cli.org.

You can upload them and then they will magically be available: https://github.com/wp-cli/wp-cli.github.com/tree/master/behat-data

}

Utils\report_batch_operation_results( 'image', 'regenerate', count( $images->posts ), $successes, $errors );
self::report_batch_operation_results( 'image', 'regenerate', $count, $successes, $errors, $skips );
Copy link
Member

Choose a reason for hiding this comment

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

Rather than fork this utility, let's instead add a $skips parameter to Utils\report_batch_operation_results(). We can pass the $skips value through, and it will display if WP-CLI is up to date (or degrade gracefully if not).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll open a PR on wp-cli for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gitlost
Copy link
Contributor Author

gitlost commented Oct 4, 2017

Is there specific feedback you're looking for?

Apart from that given, just whether the behaviour as here implemented was what was expected/desired. But looking back over the discussion in issue #25, I suppose it is.

@danielbachhuber danielbachhuber added this to the 1.1.1 milestone Oct 12, 2017
@danielbachhuber danielbachhuber merged commit 630747d into master Oct 12, 2017
@danielbachhuber danielbachhuber deleted the issue_43 branch October 12, 2017 13:16
danielbachhuber added a commit that referenced this pull request Nov 18, 2022
Skip non-thumbnailed PDFS & other images rather than fail. Check retu…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.