mirror of
https://github.com/friendica/friendica
synced 2025-04-20 06:30:10 +00:00
Use a centralized function to delete delayed entries
This commit is contained in:
parent
5a2fa2f81a
commit
6c8a4a2552
3 changed files with 28 additions and 25 deletions
|
@ -41,7 +41,12 @@ class Schedule extends BaseProfile
|
|||
if (empty($_REQUEST['delete'])) {
|
||||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
self::deleteSchedule($_REQUEST['delete']);
|
||||
|
||||
if (!DBA::exists('delayed-post', ['id' => $_REQUEST['delete'], 'uid' => local_user()])) {
|
||||
throw new HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
Post\Delayed::deleteById($_REQUEST['delete']);
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
@ -83,16 +88,4 @@ class Schedule extends BaseProfile
|
|||
|
||||
return $o;
|
||||
}
|
||||
|
||||
private static function deleteSchedule($id)
|
||||
{
|
||||
$condtion = ['id' => $id, 'uid' => local_user()];
|
||||
$post = DBA::selectFirst('delayed-post', ['id', 'wid'], $condtion);
|
||||
if (empty($post['id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DBA::delete('delayed-post', ['id' => $id, 'uid' => local_user()]);
|
||||
DBA::delete('workerqueue', ['id' => $post['wid']]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue