Opened 8 years ago
Closed 8 years ago
#2710 closed defect (bug) (fixed)
Forums: "Plugin Contributor" badge is displayed instead of "Plugin Author"
Reported by: | SergeyBiryukov | Owned by: | ocean90 |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Support Forums | Keywords: | has-patch commit |
Cc: |
Description
Background: #2701
[5286] and [5287] updated the queries for plugin authors and contributors to use the new Plugin Directory WP tables.
Looking at the code (and having confirmed that on a local install), "Plugin Author" should be displayed for those with commit access, and "Plugin Contributor" should be displayed for everyone else listed in the plugin's readme.txt
.
However, in some cases "Plugin Contributor" is displayed instead of "Plugin Author":
https://wordpress.org/support/topic/google-rich-snippets-and-easy-digital-downloads/#post-9008725
Maybe the plugin_committers
taxonomy is not properly populated for some plugins?
Attachments (3)
Change History (21)
#3
@
8 years ago
I'm not sure [5307] solved this issue, but it addressed something that was an issue (the contributors array cache had a cache group name conflict with the plugin directory).
In the cases mentioned in the ticket, the cache for the authors (when only the contributor badge was showing as a fallback) or both caches (when neither badge appeared) had somehow gotten set with an empty array. Temporarily disabling the wp_cache_(get|set)()
resulted in the proper authors and contributors.
I'm leaving the ticket open for now to see if the issue crops up again.
#5
@
8 years ago
I'm not sure [5307] solved this issue, but it addressed something that was an issue (the contributors array cache had a cache group name conflict with the plugin directory).
I'm not sure that's the case - all cache groups have the blog_id included in the resulting memcache key, unless it's marked as a global cache group (which it isn't). For example, key = 'my-super-plugin'; group = 'plugin-contributors-slugs';
will have a resulting memcache_key of 419:plugin-contributors-slugs:my-super-plugin
.
In the cases mentioned in the ticket, the cache for the authors (when only the contributor badge was showing as a fallback) or both caches (when neither badge appeared) had somehow gotten set with an empty array. Temporarily disabling the wp_cache_(get|set)() resulted in the proper authors and contributors.
This was the case with #2718 as well.
I think a more likely scenario is that this is being called with invalid data at some point and caching that bad state.
This ticket was mentioned in Slack in #meta by sergey. View the logs.
8 years ago
This ticket was mentioned in Slack in #forums by sergey. View the logs.
8 years ago
This ticket was mentioned in Slack in #forums by macmanx. View the logs.
8 years ago
#9
@
8 years ago
Seeing some more reports on Slack of plugin authors and contributors no longer being recognized as such and not being able to resolve topics:
#10
follow-up:
↓ 11
@
8 years ago
Looking at [5286], it changed the format of $compat_object
for plugins, but didn't change the cache group.
Previously, $this->plugin
didn't have an ID
field, so it might be possible that $this->plugin->ID
in ::get_authors()
and ::get_contributors()
is empty for plugins that still have previous values in cache.
Clearing the plugin-objects
cache group or changing its name in ::get_object_by_slug_and_type()
should resolve this.
On a related note, is there a reason why we're using direct queries instead of WP_Query
?
#11
in reply to:
↑ 10
;
follow-up:
↓ 12
@
8 years ago
Replying to SergeyBiryukov:
Previously,
$this->plugin
didn't have anID
field, so it might be possible that$this->plugin->ID
in::get_authors()
and::get_contributors()
is empty for plugins that still have previous values in cache.
That in turn would lead to an empty array being cached for the affected plugins in plugin-authors-slugs
and plugin-contributors-slugs
cache groups, so I guess clearing just plugin-objects
won't be enough.
#12
in reply to:
↑ 11
;
follow-up:
↓ 13
@
8 years ago
Replying to SergeyBiryukov:
Seeing some more reports on Slack of plugin authors and contributors no longer being recognized as such and not being able to resolve topics:
https://wordpress.slack.com/archives/C02QB8GMM/p1491923589415860
https://wordpress.slack.com/archives/C02RQC6RW/p1491929341352940
https://wordpress.slack.com/archives/C02RQC6RW/p1491948136951086
The last of these appear to be that the user doesn't have commit access to the plugin and wasn't listed as a contributor in the readme.
Replying to SergeyBiryukov:
Previously,
$this->plugin
didn't have anID
field, so it might be possible that$this->plugin->ID
in::get_authors()
and::get_contributors()
is empty for plugins that still have previous values in cache.
That in turn would lead to an empty array being cached for the affected plugins in
plugin-authors-slugs
andplugin-contributors-slugs
cache groups, so I guess clearing justplugin-objects
won't be enough.
This is all true, though should only have been an issue for the 24 hours after the committed changes in [5286]. The caches for the group plugin-objects
are set to expire after 24 hours. The caches for plugin-authors-slugs
and plugin-contributors-slugs
after only one hour.
#13
in reply to:
↑ 12
@
8 years ago
Replying to coffee2code:
The last of these appear to be that the user doesn't have commit access to the plugin and wasn't listed as a contributor in the readme.
That's only for one of the four mentioned plugins, the other three do have that username in readme.txt
. The user appears to be properly recognized now: https://wordpress.org/support/topic/modify-post-type-slug/#post-9016194
This is all true, though should only have been an issue for the 24 hours after the committed changes in [5286]. The caches for the group
plugin-objects
are set to expire after 24 hours. The caches forplugin-authors-slugs
andplugin-contributors-slugs
after only one hour.
Yeah, I've seen DAY_IN_SECONDS
on the former, but didn't know how the dotorg cache backend handles expiration.
Haven't seen any new reports since yesterday, I guess the issue should have resolved itself by now.
This ticket was mentioned in Slack in #forums by erricgunawan. View the logs.
8 years ago
This ticket was mentioned in Slack in #meta by macmanx. View the logs.
8 years ago
#17
@
8 years ago
- Keywords has-patch commit added
Replying to coffee2code:
In the cases mentioned in the ticket, the cache for the authors (when only the contributor badge was showing as a fallback) or both caches (when neither badge appeared) had somehow gotten set with an empty array.
Found the culprit: [5287] switched User_Badges::get_authors()
and ::get_contributors()
to use the corresponding methods from \WordPressdotorg\Forums\(Plugin|Theme)
, but it doesn't account for the fact that ::get_badge_class()
is also called in some contexts where the plugin or theme object is not set up:
- When viewing "Plugins and Hacks", "Themes and Template", "Reviews" forums directly.
- In Spam/Pending/Archived moderator views.
- On a single user's "Replies Created" page.
This causes notices due to $this->plugin
being empty and pollutes the cache with an empty array:
Notice: Trying to get property of non-object in support-forums/inc/class-directory-compat.php on line 855 Notice: Trying to get property of non-object in support-forums/inc/class-directory-compat.php on line 889
On a related note, [5287] references a non-existing \WordPressdotorg\Forums\Theme
class for themes, which results in "Theme Author" badges not being displayed at all, see an example for Stargazer theme.
2710.patch fixes both issues.
Hmm, and now the badge is not displayed in that topic at all.
It's displayed for another plugin of the same author though, so it's inconsistent:
https://wordpress.org/support/topic/toolbar-display/#post-8980799