File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ Significance: minor
2
+ Type: added
3
+
4
+ Adds support for virtual deletes and restores, allowing objects to be removed from the fediverse without being deleted locally.
Original file line number Diff line number Diff line change @@ -207,4 +207,19 @@ public static function bury( $url ) {
207
207
208
208
\update_option ( 'activitypub_tombstone_urls ' , $ urls );
209
209
}
210
+
211
+ /**
212
+ * Remove a URL from the local tombstone registry.
213
+ *
214
+ * Removes a URL from the local tombstone URL registry.
215
+ * The URL is normalized before comparison to ensure consistent matching.
216
+ * This marks the URL as no longer tombstoned for future local checks.
217
+ *
218
+ * @param string $url The URL to remove from the tombstone registry.
219
+ */
220
+ public static function remove ( $ url ) {
221
+ $ urls = \get_option ( 'activitypub_tombstone_urls ' , array () );
222
+ $ urls = \array_diff ( $ urls , array ( normalize_url ( $ url ) ) );
223
+ \update_option ( 'activitypub_tombstone_urls ' , $ urls );
224
+ }
210
225
}
Original file line number Diff line number Diff line change @@ -162,4 +162,24 @@ public function test_exists_local() {
162
162
163
163
\delete_option ( 'activitypub_tombstone_urls ' );
164
164
}
165
+
166
+ /**
167
+ * Tests that the remove method removes a URL from the tombstone list,
168
+ * so that exists_local returns false after removing.
169
+ *
170
+ * @covers ::remove
171
+ */
172
+ public function test_remove () {
173
+ $ url = 'https://fake.test/object/123 ' ;
174
+
175
+ Tombstone::bury ( $ url );
176
+
177
+ $ response = Tombstone::exists_local ( $ url );
178
+ $ this ->assertTrue ( $ response );
179
+
180
+ Tombstone::remove ( $ url );
181
+
182
+ $ response = Tombstone::exists_local ( $ url );
183
+ $ this ->assertFalse ( $ response );
184
+ }
165
185
}
You can’t perform that action at this time.
0 commit comments