Centralize initialization; create outbox table
This commit is contained in:
parent
093c06e7e0
commit
d790c425ef
@ -3,8 +3,11 @@
|
||||
Plugin Name: ActivityPub
|
||||
*/
|
||||
require_once plugin_dir_path( __FILE__ ) . 'inc/api.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'inc/init.php';
|
||||
|
||||
add_action( 'rest_api_init', function() {
|
||||
\api\register_routes();
|
||||
} );
|
||||
function activitypub_init() {
|
||||
do_action( 'activitypub_init' );
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'activitypub_init');
|
||||
?>
|
||||
|
14
inc/init.php
Normal file
14
inc/init.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace init;
|
||||
|
||||
require_once plugin_dir_path( __FILE__ ) . '/outbox.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . '/api.php';
|
||||
|
||||
add_action( 'rest_api_init', function() {
|
||||
\api\register_routes();
|
||||
} );
|
||||
|
||||
add_action( 'activitypub_init', function() {
|
||||
\outbox\create_outbox_table();
|
||||
} );
|
||||
?>
|
@ -10,4 +10,18 @@ When an Activity is received (i.e. POSTed) to an Actor's outbox, the server must
|
||||
target inbox.
|
||||
3. Perform side effects as necessary
|
||||
*/
|
||||
namespace outbox;
|
||||
|
||||
function create_outbox_table() {
|
||||
global $wpdb;
|
||||
$wpdb->Query(
|
||||
"
|
||||
CREATE TABLE IF NOT EXISTS activitypub_outbox (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
actor VARCHAR(128) NOT NULL,
|
||||
activity TEXT NOT NULL
|
||||
);
|
||||
"
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user