#wordpress 2019-09-08

2019-09-08 UTC
gRegorLove, jeremych_ and [jgmac1106] joined the channel
[pfefferle] joined the channel
#
GWG
Good morning, [pfefferle]
#
GWG
How goes the vacation?
#
[pfefferle]
it ended yesterday
#
[pfefferle]
so time to look at pull requests 😉
#
[pfefferle]
short brainstorming about anonymous avatars?
#
GWG
I would say as most webmentions won't have email I'm fine not storing the anonymous avatar in meta only loading it if there is no email
#
GWG
Based on your concern
#
[pfefferle]
do you understand/share my consern?
#
[pfefferle]
I like the idea with the mail! And we can improve on top of this!
#
[pfefferle]
should make the code a lot simpler and still improves the code
#
GWG
Yes, will update the avatar code with that goal
#
GWG
How about the other PRs?
#
[pfefferle]
i will change pcs one sec.
#
[pfefferle]
GWG some time to talk about code?
#
GWG
Yes, I have time now
#
[pfefferle]
I would make a 4.0.0… you changed a lot and at least the header thing breaks backwards compatibility
#
[pfefferle]
I just have a look at the attachment branch
#
GWG
Okay, I haven't written the readme as I figured I would wait till things were merged.
#
GWG
I think that I will have to send a PR after merge to bump versions
#
[pfefferle]
I will make some short changes to the merge request before I merge
#
[pfefferle]
I would love to remove the Masterminds\\HTML5 thing… because it is not used and otherwise I think we have to test if it will really work
#
[pfefferle]
ok for you?
#
[pfefferle]
I also changed the html_extract_urls to webmention_extract_urls
#
GWG
I use it, and it is used in php-mf2, where it does. But due testing requirements, will switch to a filter so it can be added
#
[pfefferle]
wait a moment
#
[pfefferle]
I made the changes and will commit first
#
GWG
I am not committing now
#
GWG
I won't change anything while we're talking
#
GWG
But my goal was, as php-mf2 recommends it, to use it if not bundled someone loads it even
#
GWG
Excuse me, to use if available
#
[pfefferle]
no problem, but I think it is not that easy to bundle it to wordpress currently (needs a dedicated plugin to add the mastermind) and we do not really test, if a version breaks it
#
GWG
Then the filter will do
#
GWG
pre_load_webmention_domdocument
#
GWG
if ! null, use, otherwise load the built in
#
[pfefferle]
or we add a filter the complete generator to a filter?
#
GWG
Too expensive a query
#
GWG
We'd be making anyone who wanted an alternative DOMDocument parse twice
#
GWG
Using DOMDocument for outgoing links should cut down on sending webmentions unnecessarily
#
GWG
I want to use DOMDocument for verification as well
#
GWG
Then pass it on to php-mf2 and the backup meta parsing so it doesn't have to be redone
#
GWG
The commentdata array will grow, but only fields in the new store function will make it to the meta table, everything else is temporary for transaction
#
[pfefferle]
found a last problem
#
GWG
Oh?
#
[pfefferle]
I will also remove the `webmention_public_post_types` function
#
[pfefferle]
it was stored in webmention.php but should be in functions.php
#
[pfefferle]
but I would love to add it to the template, because it does template stuff
#
GWG
I am confused... I called it to the template... you want it merged into the template?
#
[pfefferle]
yes, but it is a function, so it should be at least in the functions.php
#
[pfefferle]
and it mixes up a lot of logic
#
[pfefferle]
the name made me think it returns the public post types
#
[pfefferle]
but it prints html
#
[pfefferle]
ah, I see! the functions are only in the webmention.php, because there are the action calls
#
[pfefferle]
if we want to move them into a function I am also fine with it
#
GWG
You changed that last year, I think
#
GWG
But we can reorganize
#
GWG
So, you just want to rename?
#
[pfefferle]
I moved it directly to the template
#
GWG
Okay
#
[pfefferle]
have you seen my changes?
#
[pfefferle]
feedback?
#
GWG
I like them.
#
GWG
I think it simplifies
#
GWG
And I am always trying to simplify, even as I make things more complicated
#
[pfefferle]
but I have a problem generating the PO file
#
GWG
Overall you like the changes?
#
GWG
Wonder why?
#
GWG
I didn't try as I usually only do that during final version bump
#
GWG
But next, I have to figure out how to match URLs when retrieved using DOMDocument
#
GWG
That will likely be the next PR after these are merged.
#
[pfefferle]
pot file was broken
#
GWG
How?
#
GWG
Odd
#
GWG
If this is going to be 4.0 I think I have more to add before release
#
[pfefferle]
no pressure
#
[pfefferle]
this is only semantic versioning
#
GWG
No, but you know how long I have been wanting to do this
#
GWG
I decided that I am going to focus on it till I get done
#
[pfefferle]
and the header change breaks backwards compatibility, so it is a major
#
GWG
I kept getting sidetracked with other projects
#
[pfefferle]
yes, but release fast release often
#
[pfefferle]
I would love to release a new version with your current merge requests
#
GWG
Let me add the verification improvements if I can, then release 4.0
#
[pfefferle]
I would prefer to not add too many changes
#
GWG
That's the only other part I think would fit into a 4.0 before release
#
GWG
Okay
#
[pfefferle]
but let’s focus on the current merge request first
#
GWG
If you want to release, then I will work on this next part for 4.1
#
[pfefferle]
I fear to have too many changes that might cause issues and the more we add, the harder it is to find the cause
#
GWG
I think we may need to improve the readme for the current changes though
#
GWG
I can understand that
#
GWG
No idea. Assume no one caught it
#
GWG
Although you don't need backcompat now that the php version minimum is bumped
#
GWG
So it may be the reason for the function is gone
#
GWG
wp_parse_url was created for schemeless urls, if I remember correctly
#
[pfefferle]
I would love to set the wp_cache_get group to “webmention”
#
[pfefferle]
wmurl is a bit too generic
#
GWG
We might need more webmention caching
#
[pfefferle]
sure, but this is not the key… this is only the cache group
#
GWG
How about webmention_url_to_postid to match the function?
#
GWG
The key is the hashed url
#
GWG
So the group represents what these cached items are
#
[pfefferle]
what if we directly cache the boolean?
#
GWG
You mean, pings open?
#
GWG
The return of the function rather than the post id?
#
GWG
Unnecessary
#
GWG
WordPress caches the post using the same function
#
GWG
So, the ping status doesn't require an extra call to the database
#
GWG
Because any post retrieved during page load is already cached
#
GWG
The URL to post id relationship isn't
#
GWG
I checked through the chain of functions because I was looking at that issue from pubsubhubbub you referenced
#
[pfefferle]
like that?
#
GWG
It works, but caching if is_singular seems unnecessary, but the code works
#
[pfefferle]
it does not cache is_singular
#
[pfefferle]
it caches if headers are enabled/disabled by URL
#
GWG
I meant, the benefit is mostly only if it is not a post. On the other hand, if you have a persistent cache, then the cache for everything will have a benefit
#
[pfefferle]
and you save the pings_open call
#
GWG
I would say merge it.
#
[pfefferle]
but I also understand your cache
#
GWG
Pings open retrieves get_post and checks ping status
#
GWG
get post is cached by Core
#
GWG
That was my thought
#
[pfefferle]
ah! I see!
#
[pfefferle]
ok, but then I would add the caching to the webmention_url_to_postid
#
GWG
So, if there is a persistent cache, you save a database call, if there isn't, you don't
#
GWG
Agreed
#
[pfefferle]
wait a sec
#
GWG
It means it will always rerun if the return is 0, which means we aren't caching false results
#
[pfefferle]
it is the same code you used, only in another function!?!
#
[pfefferle]
why should we cache false results? what are false results?
#
GWG
I just realized it
#
GWG
0 is evaluated as false
#
[pfefferle]
yes, but when will there be false results?
#
[pfefferle]
is there a post with 0?
#
GWG
Maybe I am overthinking it now
#
[pfefferle]
i changed it to if ( false === $id ) {
#
GWG
That means we can distinguish between nothing in cache and a failed match in cache
#
[pfefferle]
I would also like to change `receive_mentions` to ``
#
[pfefferle]
show_header`
#
[pfefferle]
because it only checks if it should show the header
#
[pfefferle]
otherwise we have to change the WEBMENTION_ALWAYS_SHOW_HEADERS
#
[pfefferle]
or we have to move the WEBMENTION_ALWAYS_SHOW_HEADERS const to the header functions
#
GWG
Which I saw, and that is fine
#
[pfefferle]
it is fine to rename?
#
GWG
Yes, fine to rename
#
[pfefferle]
ok for you?
[pawel_madej] joined the channel
#
GWG
When do you declare post_id if is_singular?
#
GWG
Look at the should receive mentions function
#
GWG
It doesn't declare the variable
#
GWG
So if not an archive url, it will generate a notice
#
[pfefferle]
sorry, just removed the caching…
#
[pfefferle]
GWG remove is_singular check?
#
GWG
Add an else $post_id = get_the_ID
#
GWG
So if it is singular, the post id will populate the variable
#
[pfefferle]
but do we need it?
#
GWG
Yes.
#
[pfefferle]
can you add your thoughts directly to the code?
#
[pfefferle]
I commited all my changes
#
[pfefferle]
ah is see!
#
[pfefferle]
but can you add it?
#
[pfefferle]
if ( is_singular() ) {
#
[pfefferle]
$post_id = get_the_ID();
#
[pfefferle]
$post_id = webmention_url_to_postid( get_self_link() );
#
[pfefferle]
if ( ! $post_id ) {
#
[pfefferle]
return false;
#
[pfefferle]
if ( is_singular() ) {
#
[pfefferle]
$post_id = get_the_ID();
#
[pfefferle]
$post_id = webmention_url_to_postid( get_self_link() );
#
[pfefferle]
if ( ! $post_id ) {
#
[pfefferle]
return false;
#
GWG
Just added my comments
#
[pfefferle]
ok, then I re-commiz
#
[pfefferle]
wait a sec
#
[pfefferle]
but are we inside the loop?
#
[pfefferle]
GWG it should be get_queried_object_id() I think
#
GWG
I made a comment, had another idea
[Ramiro_Ruiz] joined the channel
#
[pfefferle]
yes, this also works!
#
[pfefferle]
so, finally
#
[pfefferle]
can you have a look at the final code?
#
[pfefferle]
with all changes?
#
[pfefferle]
have to eat something… will check back later… will merge this branch if you give your +1
#
[pfefferle]
and ping me if you changed the avatar thingy
#
[pfefferle]
then I will merge this too
#
GWG
It looks good
#
GWG
Can you merge this and I will send you a message when I do the avatar changes
#
GWG
And are you comfortable with the other PR?
#
[pfefferle]
the improve thing?
#
[pfefferle]
storage parameters?
jeremych_ joined the channel
#
[pfefferle]
I will review this later today
#
[pfefferle]
if I find the time
#
GWG
Yes
#
GWG
Understood
#
GWG
Moving forward
[fluffy], [jgmac1106], drkokandy, [Michael_Beckwit, KevlarmonkeyDisc, [KevinMarks] and [asuh] joined the channel
#
[asuh]
Happy to have closed 3 Github issues on Syndication Links repo 😄
#
GWG
Yay
#
GWG
I am happy pfefferle is back from vacation
#
GWG
So I can close PRs