pterotype/inc/likes.php

29 lines
802 B
PHP
Raw Normal View History

<?php
namespace likes;
2018-09-04 02:10:36 +00:00
function create_like( $actor_id, $object_id ) {
global $wpdb;
return $wpdb->insert(
2018-09-19 15:16:41 +00:00
'pterotype_activitypub_likes', array( 'actor_id' => $actor_id, 'object_id' => $object_id )
2018-09-04 02:10:36 +00:00
);
}
function create_likes_table() {
global $wpdb;
$wpdb->query(
"
2018-09-19 15:16:41 +00:00
CREATE TABLE IF NOT EXISTS pterotype_activitypub_likes (
2018-09-19 12:54:07 +00:00
actor_id INT UNSIGNED NOT NULL,
object_id INT UNSIGNED NOT NULL,
PRIMARY KEY (actor_id, object_id),
FOREIGN KEY likes_actor_fk(actor_id)
2018-09-19 15:16:41 +00:00
REFERENCES pterotype_activitypub_actors(id),
2018-09-19 12:54:07 +00:00
FOREIGN KEY likes_object_fk(object_id)
2018-09-19 15:16:41 +00:00
REFERENCES pterotype_activitypub_objects(id)
2018-09-19 12:54:07 +00:00
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
"
);
}
?>