-
Notifications
You must be signed in to change notification settings - Fork 82
Add/User Delete activities #552
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
Draft
mediaformat
wants to merge
52
commits into
Automattic:trunk
Choose a base branch
from
mediaformat:add/ServerActivities
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
bcf29e1
Profiles: update followers when profile fields change
mattwiebe e3a78fb
use static
mattwiebe af3e61c
only try to merge mention inboxes when valid
mattwiebe 3785cee
Add Server Class, known_inboxes method
mediaformat d64ed73
Add a server dispatch activity
mediaformat 565a6ca
Add a delete wp user action
mediaformat 9e8065a
lint:fix
mediaformat 4d83e1a
Merge branch 'master' into add/ServerActivities
pfefferle 7543884
Add blog user followers to known inboxes
mediaformat 05b4ebf
public function
mediaformat 2bfb930
update send_server_activity
mediaformat 6c548bc
update delete schedulers
mediaformat 41f05ef
get temporary key for deleted user
mediaformat f101daf
Merge branch 'master' into add/ServerActivities
mediaformat 87d32cb
Merge branch 'master' into add/ServerActivities
mediaformat 06a023e
Rename to Application class
mediaformat 5090e84
Merge branch 'master' into add/ServerActivities
mediaformat 8499aa4
Merge branch 'master' into add/ServerActivities
pfefferle 96b29a3
Merge branch 'master' into add/ServerActivities
pfefferle 76771aa
Merge branch 'master' into add/ServerActivities
pfefferle fcbfa74
Fix PHP errors and lint issues
mattwiebe ca3d1bc
Update includes/class-scheduler.php
mediaformat e894bc6
Rename action and function
mediaformat 1aa30ed
Use get_all_followers for inboxes
mediaformat fb0f679
schedule_actor_delete
mediaformat 61951f7
has_cap activitypub
mediaformat 4cef50d
activitypub_send_actor_delete_activity
mediaformat 6c1fa00
remove Application class
mediaformat 01b4d09
private key already stored
mediaformat 22a664e
clean up user, delete signature options key
mediaformat aa448d3
get signing keys from options for actor delete activity
mediaformat f9fee8c
Send Delete activity to shared_inboxes
mediaformat 2df226e
set temp signature option
mediaformat d1e0074
cleanup
mediaformat bf50942
phpcs
mediaformat c781662
phpcbf
mediaformat 39fffc7
Merge branch 'master' into add/ServerActivities
pfefferle 7af4eb1
Merge branch 'master' into add/ServerActivities
pfefferle c9477d7
Merge branch 'master' into add/ServerActivities
pfefferle dc88d91
Merge branch 'master' into add/ServerActivities
pfefferle b84286e
init cli
pfefferle 0de423a
add http gone class
pfefferle 2f33377
add http gone
pfefferle 39e6e71
rewrite dispatcher a bit
pfefferle 520c3fb
mark as federated
pfefferle 962e6dd
cleanups
pfefferle 2730907
remove lagacy code
pfefferle 295d5bc
fix instance of check
pfefferle 4fcf151
better $user handling
pfefferle f319cac
better support of system users
pfefferle 62714a5
better description
pfefferle 84dbdc4
Merge branch 'master' into add/ServerActivities
pfefferle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?php | ||
namespace Activitypub; | ||
|
||
use WP_CLI; | ||
use WP_CLI_Command; | ||
|
||
/** | ||
* WP-CLI commands | ||
* | ||
* @package Activitypub | ||
*/ | ||
class Cli extends WP_CLI_Command { | ||
/** | ||
* See the Plugin Meta-Informations | ||
* | ||
* ## OPTIONS | ||
* | ||
* [--Name] | ||
* The Plugin Name | ||
* | ||
* [--PluginURI] | ||
* The Plugin URI | ||
* | ||
* [--Version] | ||
* The Plugin Version | ||
* | ||
* [--Description] | ||
* The Plugin Description | ||
* | ||
* [--Author] | ||
* The Plugin Author | ||
* | ||
* [--AuthorURI] | ||
* The Plugin Author URI | ||
* | ||
* [--TextDomain] | ||
* The Plugin Text Domain | ||
* | ||
* [--DomainPath] | ||
* The Plugin Domain Path | ||
* | ||
* [--Network] | ||
* The Plugin Network | ||
* | ||
* [--RequiresWP] | ||
* The Plugin Requires at least | ||
* | ||
* [--RequiresPHP] | ||
* The Plugin Requires PHP | ||
* | ||
* [--UpdateURI] | ||
* The Plugin Update URI | ||
* | ||
* See: https://developer.wordpress.org/reference/functions/get_plugin_data/#return | ||
* | ||
* ## EXAMPLES | ||
* | ||
* $ wp webmention meta | ||
* | ||
* $ wp webmention meta --Version | ||
* Version: 1.0.0 | ||
* | ||
* @param array|null $args The arguments. | ||
* @param array|null $assoc_args The associative arguments. | ||
* | ||
* @return void | ||
*/ | ||
public function meta( $args, $assoc_args ) { | ||
$plugin_data = get_plugin_meta(); | ||
|
||
if ( $assoc_args ) { | ||
$plugin_data = array_intersect_key( $plugin_data, $assoc_args ); | ||
} else { | ||
WP_CLI::line( __( "ActivityPub Plugin Meta:\n", 'activitypub' ) ); | ||
} | ||
|
||
foreach ( $plugin_data as $key => $value ) { | ||
WP_CLI::line( $key . ': ' . $value ); | ||
} | ||
} | ||
|
||
/** | ||
* Remove the blog from the Fediverse. | ||
* | ||
* ## EXAMPLES | ||
* | ||
* $ wp activitypub self-destruct | ||
* | ||
* @subcommand self-destruct | ||
* | ||
* @param array|null $args The arguments. | ||
* @param array|null $assoc_args The associative arguments. | ||
* | ||
* @return void | ||
*/ | ||
public function self_destruct( $args, $assoc_args ) { | ||
$question = __( 'We are in the process of deleting your blog from the Fediverse. This action could be irreversible, so are you sure you want to continue?', 'activitypub' ); | ||
WP_CLI::confirm( WP_CLI::colorize( "%r{$question}%n" ), $assoc_args = array() ); | ||
|
||
WP_CLI::success( __( 'Deleting your Blog from the Fediverse...', 'activitypub' ) ); | ||
|
||
// Deactivate the ActivityPub Plugin after the deletion. | ||
WP_CLI::runcommand( 'plugin deactivate activitypub' ); | ||
} | ||
|
||
/** | ||
* Delete or Update a User. | ||
* | ||
* ## OPTIONS | ||
* | ||
* <action> | ||
* : The action to perform. Either `delete` or `update`. | ||
* --- | ||
* options: | ||
* - delete | ||
* - update | ||
* --- | ||
* | ||
* <id> | ||
* : The id of the registered WordPress user. | ||
* | ||
* ## EXAMPLES | ||
* | ||
* $ wp activitypub user delete 1 | ||
* | ||
* @synopsis <action> <id> | ||
* | ||
* @param array|null $args The arguments. | ||
* @param array|null $assoc_args The associative arguments. | ||
* | ||
* @return void | ||
*/ | ||
public function user( $args, $assoc_args ) { | ||
// @todo add code | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Activitypub; | ||
|
||
use WP_Query; | ||
|
||
/** | ||
* Send HTTP 410 for deleted Posts/Pages and Authors | ||
* | ||
* @author Matthias Pfefferle | ||
*/ | ||
class Http_Gone { | ||
/** | ||
* Initialize Deleted Posts Plugin | ||
*/ | ||
public static function init() { | ||
add_action( 'template_redirect', array( static::class, 'handle_410' ), 99 ); | ||
} | ||
|
||
public static function handle_410() { | ||
$is_410 = false; | ||
|
||
if ( ! is_404() ) { | ||
return; | ||
} | ||
|
||
global $wp_query; | ||
|
||
// Check Post Slug | ||
if ( ! empty( $wp_query->query['pagename'] ) ) { | ||
$query = new WP_Query( | ||
array( | ||
'pagename' => $wp_query->query['pagename'] . '__trashed', | ||
'post_status' => 'trash', | ||
) | ||
); | ||
|
||
if ( $query->get_posts() ) { | ||
$is_410 = true; | ||
} | ||
} elseif ( ! empty( $wp_query->query['name'] ) ) { | ||
$query = new WP_Query( | ||
array( | ||
'name' => $wp_query->query['name'] . '__trashed', | ||
'post_status' => 'trash', | ||
) | ||
); | ||
|
||
if ( $query->get_posts() ) { | ||
$is_410 = true; | ||
} | ||
} elseif ( ! empty( $wp_query->query['author_name'] ) ) { | ||
// Check if author is deleted | ||
$is_410 = true; | ||
} else { | ||
return; | ||
} | ||
|
||
// Return 410 if trashed post exists | ||
if ( $is_410 ) { | ||
status_header( 410 ); | ||
// check if theme has a 410.php template | ||
$template_410 = get_query_template( 410 ); | ||
// return 410 template | ||
if ( $template_410 ) { | ||
load_template( $template_410 ); | ||
exit; | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.