mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 11:43:40 +00:00
[advancedcontentfilter] Clear rule cache anytime rules are changed in the database
- This was preventing updated rules from being applied immediately as the cached rules were still in effect
This commit is contained in:
parent
b141416b51
commit
217643f67d
1 changed files with 6 additions and 0 deletions
|
@ -361,6 +361,8 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
||||||
|
|
||||||
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => DBA::lastInsertId()]);
|
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => DBA::lastInsertId()]);
|
||||||
|
|
||||||
|
DI::cache()->delete('rules_' . local_user());
|
||||||
|
|
||||||
return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]);
|
return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,6 +392,8 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
||||||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DI::cache()->delete('rules_' . local_user());
|
||||||
|
|
||||||
return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]);
|
return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +415,8 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request,
|
||||||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DI::cache()->delete('rules_' . local_user());
|
||||||
|
|
||||||
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
|
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue