diff --git a/activitypub.php b/activitypub.php index 338181e..8133880 100644 --- a/activitypub.php +++ b/activitypub.php @@ -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'); ?> diff --git a/inc/init.php b/inc/init.php new file mode 100644 index 0000000..801265d --- /dev/null +++ b/inc/init.php @@ -0,0 +1,14 @@ + diff --git a/inc/outbox.php b/inc/outbox.php index 7058206..a9e93c6 100644 --- a/inc/outbox.php +++ b/inc/outbox.php @@ -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 + ); + " + ); +} ?>