-
Notifications
You must be signed in to change notification settings - Fork 382
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
Test AMP compatibility of entire site #1183
Commits on May 30, 2018
-
Begin testing of site urls, starting with helper method.
Define get_post_permalinks(). This gets permalinks for public posts, other than attachments. Another helper function can call AMP_Validation_Manager::validate_url() for each of these permalinks.
Configuration menu - View commit details
-
Copy full SHA for 305c28b - Browse repository at this point
Copy the full SHA 305c28bView commit details -
Change helper method to output IDs, for use with existing method.
validate_queued_posts_on_frontend() uses IDs, which are stored in $posts_pending_frontend_validation. So simply return IDs from the helper function.
Configuration menu - View commit details
-
Copy full SHA for 9e9df92 - Browse repository at this point
Copy the full SHA 9e9df92View commit details -
Change method name in test, assign $post_ids.
Before, $post_ids wasn't assigned as an array(). This addresses a failed Travis build.
Configuration menu - View commit details
-
Copy full SHA for fd50993 - Browse repository at this point
Copy the full SHA fd50993View commit details -
Query for the latest posts, instead of by ID.
Querying for ID was simply to make testing easier. So remove that, and fall back to the default 'orderby' => 'date'.
Configuration menu - View commit details
-
Copy full SHA for 1324044 - Browse repository at this point
Copy the full SHA 1324044View commit details -
Change helper method to get post permalinks.
This class is not going to use this method anymore: validate_queued_posts_on_frontend(). So this will need the permalinks, not IDs.
Configuration menu - View commit details
-
Copy full SHA for 3c4db61 - Browse repository at this point
Copy the full SHA 3c4db61View commit details -
Add a method to get links for public terms.
For example, http://example.org/?cat=2 This includes categories and tags, and any more that are registered. But it excludes post_format links.
Configuration menu - View commit details
-
Copy full SHA for bbfafa4 - Browse repository at this point
Copy the full SHA bbfafa4View commit details -
Also get links for post_format terms.
Before, I had unset() these from the array. But as Weston pointed out, post_format terms can have archive links.
Configuration menu - View commit details
-
Copy full SHA for db54a53 - Browse repository at this point
Copy the full SHA db54a53View commit details -
Begin to apply review suggestion for get_taxonomy_links().
Add a $taxonomy parameter, to only get the terms for a given taxonomy.
Configuration menu - View commit details
-
Copy full SHA for 6713ff3 - Browse repository at this point
Copy the full SHA 6713ff3View commit details -
Add an $offset parameter to get_taxonomy_links().
As Weston mentioned, this helps to get the links in batches. Also, simplify the test.
Configuration menu - View commit details
-
Copy full SHA for 2655310 - Browse repository at this point
Copy the full SHA 2655310View commit details -
Configuration menu - View commit details
-
Copy full SHA for 32ab635 - Browse repository at this point
Copy the full SHA 32ab635View commit details
Commits on May 31, 2018
-
Pass 'fields' => 'ids' to WP_Query().
Props 10up Engineering Best Practices. The prevents the need to use wp_list_pluck() to get the ids.
Configuration menu - View commit details
-
Copy full SHA for 1a862c7 - Browse repository at this point
Copy the full SHA 1a862c7View commit details -
Allow paging through posts in get_post_permalinks().
A similar change to the one Weston proposed for get_taxonomy_links(). Get permalinks by post types, and allow paging through them. This will allow iteration, in a way similar to that in get_taxonomy_links().
Configuration menu - View commit details
-
Copy full SHA for c250bd5 - Browse repository at this point
Copy the full SHA c250bd5View commit details -
Add a method to crawl the entire site.
Iterate over all of the terms and posts from the existing helper methods. @todo: consider self::BATCH_SIZE, and whether the validation requests should be throttled, or somehow prevented from timing out WP.
Configuration menu - View commit details
-
Copy full SHA for 71f7543 - Browse repository at this point
Copy the full SHA 71f7543View commit details -
Address Travis error by using full class name, not self::
In PHP 5.3, there was: Fatal error: Cannot access self:: when no class scope is active. https://travis-ci.org/Automattic/amp-wp/jobs/386045157. This looks to be because self isn't available inside the function in 5.3. Another option might be to add $self to use(). But this seems simpler, if it works.
Configuration menu - View commit details
-
Copy full SHA for 4aade51 - Browse repository at this point
Copy the full SHA 4aade51View commit details -
Force theme support of 'amp' on validation requests.
This will enable crawling the site in Native AMP. This seems simpler than registering Paired Mode support, and adding template_dir. But it's still an open discussion as to whether it should only be Native AMP. If this already finds theme support, it doesn't change it.
Configuration menu - View commit details
-
Copy full SHA for 584ffea - Browse repository at this point
Copy the full SHA 584ffeaView commit details -
Add an 'amp' query arg if it's in Paired Mode.
In the validate_url() helper function, find if it's in Paired Mode. If so, set the $url to the amp endpoint.
Configuration menu - View commit details
-
Copy full SHA for ae4371c - Browse repository at this point
Copy the full SHA ae4371cView commit details
Commits on Jun 1, 2018
-
Begin WP-CLI script to crawl the site.
This mainly calls the existing helper function. But it also passes it $wp_cli_progress. This advances the progress bar, after each post type or taxonomy validation completes.
Configuration menu - View commit details
-
Copy full SHA for 7b67efe - Browse repository at this point
Copy the full SHA 7b67efeView commit details -
Display the number of validation issues in the sucess message:
Success: 196 URLs were crawled, and 196 have AMP validation issue(s). Query for the validation error posts. And output the number found.
Configuration menu - View commit details
-
Copy full SHA for 15ec0ed - Browse repository at this point
Copy the full SHA 15ec0edView commit details -
Site crawling script: output 'more detail' link.
This drives to the page: Invalid AMP Pages (URLs) Also, output a message at the beginning: Crawling the entire site to test for AMP validity. This might take a while...
Configuration menu - View commit details
-
Copy full SHA for 1ef10a7 - Browse repository at this point
Copy the full SHA 1ef10a7View commit details
Commits on Jul 12, 2018
-
Update PR for latest changes to validator, merge develop.
3 assertions failed, so fix these both in the tested class and the PHPUnit class.
Configuration menu - View commit details
-
Copy full SHA for ba08f3d - Browse repository at this point
Copy the full SHA ba08f3dView commit details -
Register a WP-CLI command: wp amp validate-site
On Weston's suggestion. Before, running the validation required: wp eval-file bin/validate-site.php.
Configuration menu - View commit details
-
Copy full SHA for bfe37a8 - Browse repository at this point
Copy the full SHA bfe37a8View commit details -
Call the WP-CLI tick() method for every URL validated.
This has a much better display of the activity. On Weston's suggestion. Create a new method to count all of the URLs to be validated. This should only be used for WP-CLI, as it uses 'posts_per_page' => -1
Configuration menu - View commit details
-
Copy full SHA for 3d9a01c - Browse repository at this point
Copy the full SHA 3d9a01cView commit details -
Remove 'This might take a while...'
There's now more accurate feedback in the progress bar, and it'll be clear that this will probably take more than a minute.
Configuration menu - View commit details
-
Copy full SHA for c586c24 - Browse repository at this point
Copy the full SHA c586c24View commit details -
Only report unaccepted validation errors.
If a script is enqueued on all pages, and the user has accepted that error, there's probably no need to report all of the URLs that have that issue.
Configuration menu - View commit details
-
Copy full SHA for 128ca9c - Browse repository at this point
Copy the full SHA 128ca9cView commit details -
Remove the return value of validate_entire_site_urls().
This stores the URLs in a property, so there's no need to also return that property.
Configuration menu - View commit details
-
Copy full SHA for 441044f - Browse repository at this point
Copy the full SHA 441044fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 875d4ee - Browse repository at this point
Copy the full SHA 875d4eeView commit details -
Remove function that forced AMP theme support.
This isn't needed, as validate_url() can add the AMP query arg if needed.
Configuration menu - View commit details
-
Copy full SHA for 4e8c00c - Browse repository at this point
Copy the full SHA 4e8c00cView commit details -
Go back to displaying total errors,
regardless of whether they were accepted. This is just to be able to demo this work. It probably still makes more sense to only show errors that weren't accepted.
Configuration menu - View commit details
-
Copy full SHA for c4b8f5f - Browse repository at this point
Copy the full SHA c4b8f5fView commit details -
Remove wrapping in add_query_arg()
validate_url() can already simulate theme support. So there's no need to do this before.
Configuration menu - View commit details
-
Copy full SHA for c28e5ee - Browse repository at this point
Copy the full SHA c28e5eeView commit details -
Fix the progress bar, by making counts more accurate.
Before, this didn't account for 'attachment' posts. It needs a special WP_Query, as their post_status is usually inherit.
Configuration menu - View commit details
-
Copy full SHA for b6393cc - Browse repository at this point
Copy the full SHA b6393ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for c638e7e - Browse repository at this point
Copy the full SHA c638e7eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad43100 - Browse repository at this point
Copy the full SHA ad43100View commit details -
Output a count of unaccepted errors.
Before, this simply counted all of the errors. But there could be an accepted script removal, and this could result in errors being reported for the entire site. So also output the number of unaccepted errors.
Configuration menu - View commit details
-
Copy full SHA for 5af8dc9 - Browse repository at this point
Copy the full SHA 5af8dc9View commit details
Commits on Jul 13, 2018
-
Stop storing the validated URLs in a property.
AMP_Site_Validation::$site_invalid_urls stored these. But this doesn't seem to be needed. A WP_Query() could later find any invalid URLs.
Configuration menu - View commit details
-
Copy full SHA for adcb901 - Browse repository at this point
Copy the full SHA adcb901View commit details -
Make count_posts_and_terms() private.
This passes 'posts_per_page' => -1 to WP_Query. It's a performance risk, and is only intended for use in the WP-CLI command.
Configuration menu - View commit details
-
Copy full SHA for 9d11439 - Browse repository at this point
Copy the full SHA 9d11439View commit details
Commits on Aug 2, 2018
-
Add more DocBlock descriptions, and update descriptions.
Configuration menu - View commit details
-
Copy full SHA for 5e19020 - Browse repository at this point
Copy the full SHA 5e19020View commit details -
This should have an argument of an array, not a string.
Configuration menu - View commit details
-
Copy full SHA for f4e6bfd - Browse repository at this point
Copy the full SHA f4e6bfdView commit details
Commits on Aug 3, 2018
-
Make function static, and other documentation changes
crawl_site() needs to be static, as it's called statically, and there isn't yet a meants of bootstrapping.
Configuration menu - View commit details
-
Copy full SHA for 8e1b031 - Browse repository at this point
Copy the full SHA 8e1b031View commit details -
Configuration menu - View commit details
-
Copy full SHA for a4c1f7a - Browse repository at this point
Copy the full SHA a4c1f7aView commit details -
Add to DocBlock, remove needless empty line.
Add a description about how to run the command. And remove an extra empty line.
Configuration menu - View commit details
-
Copy full SHA for ce2b044 - Browse repository at this point
Copy the full SHA ce2b044View commit details
Commits on Aug 11, 2018
-
Remove 'posts_per_page' => -1 from WP_Query arguments
As Weston suggested, this passes 'orderby' => 'ID' to WP_Query(), so it's alright if another post is added during the query. Also, this increments the offset each query.
Configuration menu - View commit details
-
Copy full SHA for cd1d09e - Browse repository at this point
Copy the full SHA cd1d09eView commit details
Commits on Aug 12, 2018
-
All of the created posts had a term of 'Uncategorizes' added. Before, 'Uncategorized' wasn't countent in the term query, because there were no posts. So create a new term to add to all of the posts, and count it. So 'Uncategorized' won't be part of the term query, as it has no posts associated with it.
Configuration menu - View commit details
-
Copy full SHA for edfdd65 - Browse repository at this point
Copy the full SHA edfdd65View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19f4feb - Browse repository at this point
Copy the full SHA 19f4febView commit details -
Configuration menu - View commit details
-
Copy full SHA for e34ebda - Browse repository at this point
Copy the full SHA e34ebdaView commit details
Commits on Aug 14, 2018
-
Remove extra conditional block to call tick()
Instead of having this conditional block in 2 places, simply place it at the top. It was going to run either way, and this is simpler.
Configuration menu - View commit details
-
Copy full SHA for 57411c6 - Browse repository at this point
Copy the full SHA 57411c6View commit details -
Improve documentation, remove duplicated code.
Improve the DocBlocks and inline documentation. Also, remove a duplicated line.
Configuration menu - View commit details
-
Copy full SHA for 6802175 - Browse repository at this point
Copy the full SHA 6802175View commit details
Commits on Aug 15, 2018
-
Add a way to force crawling non-AMP-enabled URLs
If the property is true, force counting and crawling non-AMP-enabled URLs. The default behavior is to skip any URLs that are explicitly opted-out of AMP. Like if you uncheck 'Enable AMP' in the post editor.
Configuration menu - View commit details
-
Copy full SHA for a53bb45 - Browse repository at this point
Copy the full SHA a53bb45View commit details -
Exclude taxonomy templates if the user has unchecked them
Like the previous commit a53bb45, but for taxonomies. This applies to default taxonomies and custom taxonomies.
Configuration menu - View commit details
-
Copy full SHA for d44cde9 - Browse repository at this point
Copy the full SHA d44cde9View commit details -
Add a flag to force validation of the entire site (but not yet implem…
…ented) Add a flag --force-validate-all If it's added to the command wp amp validate-site, This will validate all URLs, regardless of whether a user has opted-out of the template, like by unchecking 'Categories' in 'AMP Settings' > 'Supported Templates'.
Configuration menu - View commit details
-
Copy full SHA for 71f4fcb - Browse repository at this point
Copy the full SHA 71f4fcbView commit details -
Allow crawling templates the user has unchecked in 'Supported Templates'
In 'AMP Settings,' users can uncheck certain templates. And this had blocked validation of them, as is_amp_endpoint() returned false and they were redirected. So if the user passes the flag to the WP-CLI command, add a query var. This forces all endpoints to be AMP endpoints, to allow validation. Still, is_amp_endpoint might not be the right place to make this change.
Configuration menu - View commit details
-
Copy full SHA for ff3a5c0 - Browse repository at this point
Copy the full SHA ff3a5c0View commit details -
If there are no AMP-enabled taxonomies, don't count them.
Before, there was an issue when $amp_enabled_taxonomies was an empty array(). Then, the WP_Term_Query() returned terms from all taxonomies. So simply don't run the query if there are no AMP-enabled taxonomies.
Configuration menu - View commit details
-
Copy full SHA for d378a37 - Browse repository at this point
Copy the full SHA d378a37View commit details -
Add an argument --include to the WP-CLI command.
On Weston's suggestion, this can have whitelisted conditionals. For example, --include=is_tag,is_author.
Configuration menu - View commit details
-
Copy full SHA for 4f8b3e9 - Browse repository at this point
Copy the full SHA 4f8b3e9View commit details
Commits on Aug 16, 2018
-
Implement the --include argument for taxonomies and posts
If the --include argument doesn't include the taxonomy conditional, like is_category, don't validate it. For posts, if there's an include argument that does no include is_singular, don't allow any posts.
Configuration menu - View commit details
-
Copy full SHA for 4ea25bf - Browse repository at this point
Copy the full SHA 4ea25bfView commit details -
Validate author pages, including with include=is_author
Also, set $force_crawl_urls if there's an include argument. You could pass a conditional to include that has AMP disabled now. Like if you use the command: wp amp validate-site include=is_author But 'Author' could be unchecked in 'AMP Settings' > 'Supported Templates' In that case, this would need to force validation of that URL, as the URL would otherwise redirect to the non-AMP URL.
Configuration menu - View commit details
-
Copy full SHA for dadab10 - Browse repository at this point
Copy the full SHA dadab10View commit details -
Also, decompose duplicated logic into is_template_supported().
Configuration menu - View commit details
-
Copy full SHA for c687ea0 - Browse repository at this point
Copy the full SHA c687ea0View commit details -
If there are no URLs to crawl, call WP_CLI:error()
This is most likely if all of the templates in Supported Templates are unchecked. Add a message that passing --force-validation to the command could help.
Configuration menu - View commit details
-
Copy full SHA for 09fa083 - Browse repository at this point
Copy the full SHA 09fa083View commit details -
Configuration menu - View commit details
-
Copy full SHA for eadb61c - Browse repository at this point
Copy the full SHA eadb61cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e8717fd - Browse repository at this point
Copy the full SHA e8717fdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 13a0cc7 - Browse repository at this point
Copy the full SHA 13a0cc7View commit details -
Configuration menu - View commit details
-
Copy full SHA for f054f13 - Browse repository at this point
Copy the full SHA f054f13View commit details -
Refactor get_author_page_urls() to use round-robin validation
As Alberto and Weston suggested, the site crawling could validate one URL of each template at a time. This prevents validating possibly thousands of posts or pages before getting to other URLs. So this accepts an $offset argument. 0 gets the first user, and 1 the second... The optional second parameter sets a number to return. So in the round-robin validation, this could be 1.
Configuration menu - View commit details
-
Copy full SHA for be32dcf - Browse repository at this point
Copy the full SHA be32dcfView commit details -
Refactor validate_entire_site_url() to use round-robin validation
As Alberto and Weston suggested, this validates one URL of each type at a time, up to a limit of maximum URLs to validate.
Configuration menu - View commit details
-
Copy full SHA for ff8d365 - Browse repository at this point
Copy the full SHA ff8d365View commit details
Commits on Aug 17, 2018
-
Apply the maximum URL property to count_urls_to_validate()
This shouldn't count over the maximum URL number, as they won't be validated.
Configuration menu - View commit details
-
Copy full SHA for 1387c5b - Browse repository at this point
Copy the full SHA 1387c5bView commit details -
Add a --max-url-count argument
Thanks to Alberto's suggestion This sets the maximum number of URLs that are validated for each type. For example, if it's 10, this validates 10 categories, 10 tags, etc...
Configuration menu - View commit details
-
Copy full SHA for 41cffdc - Browse repository at this point
Copy the full SHA 41cffdcView commit details -
Account for the homepage in the --include argument
If there's an argument and is_home is not in it, don't validate the homepage. Also, only validate it specifically if the user has selected Your homepage displays > Your latest posts.
Configuration menu - View commit details
-
Copy full SHA for 0202432 - Browse repository at this point
Copy the full SHA 0202432View commit details -
Refactor validate_urls() to validate a single URL
Because validation is round-robin, only validating a single URL at a time,
Configuration menu - View commit details
-
Copy full SHA for bff8fc7 - Browse repository at this point
Copy the full SHA bff8fc7View commit details -
Display the validity by template type, like category: 15/16
This is probably more useful to know than simply how many total URLs are valid.
Configuration menu - View commit details
-
Copy full SHA for 5d0d464 - Browse repository at this point
Copy the full SHA 5d0d464View commit details
Commits on Aug 21, 2018
-
Get the date template, and validate it
Use a simply mock query string, like: https://example.com/?year=2018
Configuration menu - View commit details
-
Copy full SHA for 86cd224 - Browse repository at this point
Copy the full SHA 86cd224View commit details -
Remove default value in get_taxonomy_links()
There was always an argument for $number, so there's no need for a default value in the definition. Also, improve inline documentation.
Configuration menu - View commit details
-
Copy full SHA for c31fa0e - Browse repository at this point
Copy the full SHA c31fa0eView commit details -
Remove exclusion of attachments from tests, other documentations
The test still passes when testing attachments. Also, other minor changes, and documentation improvements.
Configuration menu - View commit details
-
Copy full SHA for be8d552 - Browse repository at this point
Copy the full SHA be8d552View commit details -
Test removing the array_merge() call (will probably revert)
A unit test is failing, so test removing the array_merge() call.
Configuration menu - View commit details
-
Copy full SHA for 3dac2fd - Browse repository at this point
Copy the full SHA 3dac2fdView commit details -
Revert "Test removing the array_merge() call (will probably revert)"
This reverts commit 3dac2fd.
Configuration menu - View commit details
-
Copy full SHA for fe8eab3 - Browse repository at this point
Copy the full SHA fe8eab3View commit details -
Configuration menu - View commit details
-
Copy full SHA for b741f01 - Browse repository at this point
Copy the full SHA b741f01View commit details -
Account for the date page in the initial count
In count_urls_to_validate(), this should count the example date page, as it's being validated.
Configuration menu - View commit details
-
Copy full SHA for 4cf9e9d - Browse repository at this point
Copy the full SHA 4cf9e9dView commit details -
If there are no matched templates from --include, output error.
Before, the error message suggested that this was an issue in the /wp-admin UI. But this outputs a message that's more accurate for this case.
Configuration menu - View commit details
-
Copy full SHA for 907facd - Browse repository at this point
Copy the full SHA 907facdView commit details
Commits on Aug 23, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 52ff854 - Browse repository at this point
Copy the full SHA 52ff854View commit details
Commits on Aug 24, 2018
-
Configuration menu - View commit details
-
Copy full SHA for ab9c2d9 - Browse repository at this point
Copy the full SHA ab9c2d9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f8f40b - Browse repository at this point
Copy the full SHA 1f8f40bView commit details -
Configuration menu - View commit details
-
Copy full SHA for aca16f4 - Browse repository at this point
Copy the full SHA aca16f4View commit details -
Ignore auto-sanitization when looking for unaccepted errors
Show URL count and validity rate as two columns, as opposed to single ratio column.
Configuration menu - View commit details
-
Copy full SHA for 2637fb8 - Browse repository at this point
Copy the full SHA 2637fb8View commit details -
In Classic Mode, call WP_CLI::error() if the --force flag isn't present
On Weston's suggestion, as this would not be able to validate any URL without the --force flag.
Configuration menu - View commit details
-
Copy full SHA for da22efc - Browse repository at this point
Copy the full SHA da22efcView commit details -
Allow validating the site in 'Classic' mode
As Weston suggested, if in Classic mode and --force is passed, force theme support in the crawled URLs. This is now done in read_theme_support(), thought there might be a better way.
Configuration menu - View commit details
-
Copy full SHA for bfadbe2 - Browse repository at this point
Copy the full SHA bfadbe2View commit details
Commits on Aug 28, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 30f7522 - Browse repository at this point
Copy the full SHA 30f7522View commit details -
Configuration menu - View commit details
-
Copy full SHA for e1760aa - Browse repository at this point
Copy the full SHA e1760aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad7e0e2 - Browse repository at this point
Copy the full SHA ad7e0e2View commit details -
Fix classic mode site validation by forcing native mode
* Only show admin URL to review results if theme support initially present. * Skip showing table if no results obtained.
Configuration menu - View commit details
-
Copy full SHA for 7a52751 - Browse repository at this point
Copy the full SHA 7a52751View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8e2d028 - Browse repository at this point
Copy the full SHA 8e2d028View commit details
Commits on Aug 29, 2018
-
Unconditionally initialize validation manager w/ registered post type…
… and taxonomy * Hide the admin menu links for invalid URLs and validation errors by default in classic mode. * Invoking `wp amp validate-site` will cause the post type and taxonomy to be populated. * When in classic mode, show links to invalid pages and validation errors with template mode as opposed to in admin menu. * When viewing the admin screens for the post type and taxonomy, show the admin menu links for both.
Configuration menu - View commit details
-
Copy full SHA for edcb23a - Browse repository at this point
Copy the full SHA edcb23aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e9bf1b - Browse repository at this point
Copy the full SHA 0e9bf1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for a83a569 - Browse repository at this point
Copy the full SHA a83a569View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19ead16 - Browse repository at this point
Copy the full SHA 19ead16View commit details