[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 effectpull/1157/head
parent
b141416b51
commit
217643f67d
|
@ -361,6 +361,8 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
|||
|
||||
$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]);
|
||||
}
|
||||
|
||||
|
@ -390,6 +392,8 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
|||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue