diff --git a/includes/schema.php b/includes/schema.php index e50a481..4ea3075 100644 --- a/includes/schema.php +++ b/includes/schema.php @@ -253,10 +253,11 @@ function migration_1_2_0() { $query = "INSERT INTO {$wpdb->prefix}pterotype_objects (activitypub_id, url) VALUES"; // build values foreach( $ids_to_urls as $activitypub_id => $url ) { - $query = $query . $wpdb->prepare( " (%s, %s) ", $activitypub_id, $url ); + $query = $query . $wpdb->prepare( " (%s, %s),", $activitypub_id, $url ); } - $query = $query . "ON DUPLICATE KEY UPDATE url=VALUES(url);"; - $wpdb->query( $query ); + $query = substr( $query, 0, -1 ); + $query = $query . " ON DUPLICATE KEY UPDATE url=VALUES(url)"; + $res = $wpdb->query( $query ); // Compact existing objects so we only store 1 copy of each object foreach( $objects as $row ) { $object = \json_decode( $row->object, true ); @@ -287,7 +288,8 @@ function migration_1_2_0() { $wpdb->update( "{$wpdb->prefix}pterotype_objects", array( 'object' => wp_json_encode( $updated ) ), - array( 'activitypub_id', $row->activitypub_id ) + array( 'activitypub_id' => $row->activitypub_id ), + '%s', '%s' ); } } diff --git a/pterotype.php b/pterotype.php index 6bd395d..f3b11cc 100644 --- a/pterotype.php +++ b/pterotype.php @@ -12,7 +12,7 @@ License URI: https://github.com/jdormit/blob/master/LICENSE require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/init.php'; -define( 'PTEROTYPE_VERSION', '1.1.2' ); +define( 'PTEROTYPE_VERSION', '1.2.0' ); define( 'PTEROTYPE_BLOG_ACTOR_SLUG', '-blog' ); define( 'PTEROTYPE_BLOG_ACTOR_USERNAME', 'blog' );