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

Bugfix: multisite token logic #51

Draft
wants to merge 117 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
639f785
Fix HTTP mocks not working after base url was renamed.
defunctl Dec 1, 2023
98a4bfb
Clean up test
defunctl Dec 1, 2023
550dc15
Add ability to mock a plugin is activated
defunctl Dec 1, 2023
c59a64c
WIP: refactor token auth for multisite using plugin
defunctl Dec 1, 2023
ce82145
Include slug in token disconnect logic
defunctl Dec 1, 2023
3346f9c
Refactor Authorized
defunctl Dec 2, 2023
a65371d
WIP: conditional token storage
defunctl Dec 4, 2023
d14edea
WIP: multisite logic refactor
defunctl Dec 6, 2023
46f3eb4
Add get_license_key function
defunctl Dec 6, 2023
521a8a0
Reset multisite config to original state after each test
defunctl Dec 6, 2023
0270487
Refactor get_domain() to take into consideration unique subsites when…
defunctl Dec 6, 2023
1e2f595
Remove token check, replace with main site check
defunctl Dec 6, 2023
4438ee2
Add Config::allows_network_licenses() and update Multisite_Main_Site.php
defunctl Dec 6, 2023
16ef300
Add a hash suffix to the main site URL when on multisite with network…
defunctl Dec 6, 2023
8d27445
Delete old pipeline steps
defunctl Dec 6, 2023
a9b95be
Add more helper functions
defunctl Dec 6, 2023
86325a0
Rename get_domain function
defunctl Dec 6, 2023
5a267e8
Move disconnect URL into its own method, add helper function
defunctl Dec 6, 2023
f1fad44
Allow getting the original domain name
defunctl Dec 6, 2023
92f883c
Get original domain for download args
defunctl Dec 6, 2023
a12acd1
Remove get_token, update get_authorization_token
defunctl Dec 6, 2023
7840ed2
Delete unneeded Authorized class
defunctl Dec 6, 2023
bb1b85d
Fix license manager caching
defunctl Dec 7, 2023
d558d26
Clean up functions, add is_user_authorized()
defunctl Dec 7, 2023
77e0e48
Add and adjust functions, first pass at multisite licensing documenta…
defunctl Dec 7, 2023
8e233f1
Rollback is_authorized() change, add a new function instead
defunctl Dec 7, 2023
5a5aee0
Fix warning
defunctl Dec 7, 2023
0f7e720
Refactor allows_multisite_license() to accept an already made resource
defunctl Dec 7, 2023
7dc8c71
Fix comment
defunctl Dec 7, 2023
2cef62a
Add set_license_key example
defunctl Dec 7, 2023
f334ac1
Fix set_license_key function
defunctl Dec 7, 2023
f4b9d9a
Remove stray ampersand
defunctl Dec 7, 2023
075bbe0
formatting
defunctl Dec 7, 2023
ba8721b
Attempt to allow network validation
defunctl Dec 7, 2023
eb95d51
Show the correct message based on network validation
defunctl Dec 7, 2023
158dff9
submit to network settings if on the network_admin
defunctl Dec 7, 2023
d6cbf16
Add is_license_valid() function
defunctl Dec 7, 2023
a0a528e
rename to validate_license, return entire response
defunctl Dec 7, 2023
aafab54
Don't return null on empty license, validate allows a null key
defunctl Dec 8, 2023
d204a79
Remove unused container property, add types
defunctl Dec 8, 2023
fe207d0
Add nullable type
defunctl Dec 8, 2023
a2e9b87
Use dependency injection for Ajax
defunctl Dec 8, 2023
019e264
ensure we are multisite aware when fetching the license key for the s…
defunctl Dec 8, 2023
b028d36
Fix bad return type
defunctl Dec 8, 2023
200afd4
Show default licensing messages if coming from the network admin
defunctl Dec 8, 2023
10abc3a
Store key status in network if required
defunctl Dec 8, 2023
c5d2d58
Update the license key valid cache after updating key locally
defunctl Dec 8, 2023
1b34a0a
Ensure key is network at network/local level when validating
defunctl Dec 8, 2023
9a161d7
Don't register settings during ajax requests
defunctl Dec 8, 2023
3ee1c73
Ensure to validate license key before storing when callback connecting
defunctl Dec 8, 2023
835c01e
Ensure key being checked is network aware during license validation
defunctl Dec 8, 2023
ae65a26
set_license_key() will properly update the validation state of the li…
defunctl Dec 8, 2023
e07e4b0
Merge branch 'feature/authorization-caching' into bugfix/multisite-to…
defunctl Jan 4, 2024
6093e45
Update base testcase to fix merge issue and use config::reset()
defunctl Jan 4, 2024
32a67b1
Merge branch 'fix/ESM-70-fatal-error-on-ticket-transfer' into bugfix/…
defunctl Jan 4, 2024
95006d7
Merge branch 'main' into bugfix/multisite-token-logic
defunctl Jan 4, 2024
deeda32
Merge branch 'feat/enable-auto-updates' into bugfix/multisite-token-l…
kadencewp Jan 8, 2024
6e17901
Use unique actions for each resource slug for token connect/disconnect
defunctl Jan 9, 2024
282fca3
Remove prefix from token connect/disconnect actions, we don't have th…
defunctl Jan 9, 2024
062fa1f
Bugfix: Ensure download_url property is not null before attempting to…
defunctl Jan 9, 2024
373f6a5
Add action to disconnect controller
defunctl Jan 9, 2024
4d8d99c
Properly fix Undefined property: stdClass::$download_url
defunctl Jan 9, 2024
6bd55c1
Merge branch 'bugfix/multisite-token-logic' into bugfix/token-connect…
defunctl Jan 9, 2024
93426a9
Refactor to use uplink_slug and no longer use WordPress's action quer…
defunctl Jan 9, 2024
20616d7
Formatting
defunctl Jan 9, 2024
3f2a0e6
Use a constant for the auth action
defunctl Jan 9, 2024
f77ede3
Add ActionManagerTest.php
defunctl Jan 9, 2024
fb9c439
Move assertion into single loop
defunctl Jan 9, 2024
da935ee
Use standard action format with prefix
defunctl Jan 9, 2024
3e5df6b
Update connect/disconnect hook name
defunctl Jan 9, 2024
00e750a
Fix action docblocks
defunctl Jan 9, 2024
15a41bc
call correct action in tests
defunctl Jan 9, 2024
a1fd036
Formatting
defunctl Jan 9, 2024
b70ad24
Fix spelling
defunctl Jan 9, 2024
95f44c9
Formatting
defunctl Jan 9, 2024
fd7a2c0
Merge pull request #59 from stellarwp/bugfix/token-connect-disconnect…
defunctl Jan 9, 2024
4557d04
Merge remote-tracking branch 'origin/bugfix/prevent-empty-class' into…
defunctl Jan 17, 2024
bf9880a
Merge remote-tracking branch 'origin/feat/allow-disabling-updates' in…
defunctl Jan 17, 2024
cf87f7c
Make authorized checks require a plugin slug
defunctl Jan 22, 2024
24445ff
Fix missing variable, update README.md
defunctl Jan 22, 2024
f24a385
Don't use slug for transient cache key
defunctl Jan 23, 2024
a6ceefa
Only use the token to make the cache key
defunctl Jan 23, 2024
bfebca6
Refactor token disconnect logic to also delete the authorization cache
defunctl Jan 23, 2024
138a834
Properly build a cache hash with just a token, don't use prefix in qu…
defunctl Jan 23, 2024
1c7e27d
Merge pull request #64 from stellarwp/feature/ms/authorized-check-to-…
defunctl Jan 23, 2024
f367e86
Merge branch 'main' into bugfix/multisite-token-logic
defunctl Feb 29, 2024
66d9b5e
Show WP info
defunctl Feb 29, 2024
c5f5461
use the correct env var to call slic
defunctl Feb 29, 2024
ec95ca3
Fix tests failing due to Unexpected incorrect usage notice for wp_add…
defunctl Feb 29, 2024
6a1ecc4
Bump actions/checkout versions, fix composer cache dir
defunctl Feb 29, 2024
213a1d7
Manually bring in updated tests matrix
defunctl Feb 29, 2024
d3374a8
Fix type error in filter_upgrader_pre_download
defunctl Mar 1, 2024
19dcdfa
Merge branch 'main' into bugfix/KAD-2308/updater-type-error
defunctl Mar 1, 2024
e84dc60
Merge branch 'bugfix/KAD-2308/updater-type-error' into bugfix/multisi…
defunctl Mar 1, 2024
1f8c277
Fix typo
defunctl Mar 1, 2024
6aa9ebe
Merge branch 'bugfix/KAD-2308/updater-type-error' into bugfix/multisi…
defunctl Mar 1, 2024
0d69fe0
Force type for delete_transient kadence zendesk ticket 610295
defunctl Jun 24, 2024
775b54f
Force set_transient type for good measure
defunctl Jun 24, 2024
d8b9855
Allow some HTML tags in notices, show error if nonce failed and lites…
defunctl Jun 24, 2024
d37e2bb
Fix allowed tags
defunctl Jun 24, 2024
81e6cb1
add filter
kadencewp Dec 2, 2024
0b471da
fix test
kadencewp Dec 2, 2024
370bd50
updates with more escaping and not showing a button unless it's TEC o…
kadencewp Dec 3, 2024
0e03db7
test update
kadencewp Dec 3, 2024
5c6e94d
Use require_once as a statement
defunctl Dec 3, 2024
64eda1e
Remove deprecated config, ignore require_once errors
defunctl Dec 3, 2024
8458885
Bump action versions
defunctl Dec 3, 2024
ac42ee4
Merge pull request #90 from stellarwp/chore/phpstan-updates
defunctl Dec 3, 2024
b7553a7
Merge branch 'bugfix/multisite-token-logic' into bugfix/missing-filter
defunctl Dec 3, 2024
0f8f4b8
Fix array
kadencewp Dec 3, 2024
007ca4b
Add test
kadencewp Dec 3, 2024
6983bea
fix string
kadencewp Dec 3, 2024
bb787f2
target..
kadencewp Dec 3, 2024
301a5d4
Merge pull request #89 from stellarwp/bugfix/missing-filter
kadencewp Dec 4, 2024
d134ede
Account for an empty siteurl in the database
kadencewp Dec 11, 2024
82d3e19
apply change
kadencewp Dec 11, 2024
f33e2d3
Merge pull request #93 from stellarwp/bugfix/empty-domain
kadencewp Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Uplink/Admin/Plugins_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ public function inject_info( $result, ?string $action = null, $args = null ) {
if ( ! $relevant ) {
return $result;
}
if ( apply_filters( 'stellarwp/uplink/' . $args->slug . '/prevent_update_check', false ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Just a line break!

Suggested change
if ( apply_filters( 'stellarwp/uplink/' . $args->slug . '/prevent_update_check', false ) ) {
if ( apply_filters( 'stellarwp/uplink/' . $args->slug . '/prevent_update_check', false ) ) {

return $result;
}

$plugin = $this->get_plugins()->offsetGet( $args->slug );

Expand Down
9 changes: 9 additions & 0 deletions src/Uplink/Resources/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public function check_for_updates( $transient, $force_fetch = false ) {
return $transient;
}

// Allow .org plugins to opt out of update checks.
if ( apply_filters( 'stellarwp/uplink/' . $this->get_slug() . '/prevent_update_check', false ) ) {
return $transient;
}

$status = $this->get_update_status( $force_fetch );
$status->last_check = time();
$status->checked_version = $this->get_installed_version();
Expand Down Expand Up @@ -81,6 +86,10 @@ public function check_for_updates( $transient, $force_fetch = false ) {
$this->container->get( Notice::class )->add_notice( Notice::EXPIRED_KEY, $this->get_slug() );
}
} else {
// Clean up any stale update info.
if ( isset( $transient->response[ $this->get_path() ] ) ) {
unset( $transient->response[ $this->get_path() ] );
}
/**
* If the plugin is up to date, we need to add it to the `no_update` property so that enable auto updates can appear correctly in the UI.
*
Expand Down
Loading