Commit b6959892 authored by David Zeuthen's avatar David Zeuthen

provide a way to force a reload of all caches etc.

parent 45f52acb
......@@ -325,23 +325,8 @@ again:
}
if (config_changed) {
/* purge existing policy files */
_pk_debug ("purging policy files");
if (pk_context->priv_cache != NULL) {
polkit_policy_cache_unref (pk_context->priv_cache);
pk_context->priv_cache = NULL;
}
/* Purge existing old config file */
_pk_debug ("purging configuration file");
if (pk_context->config != NULL) {
polkit_config_unref (pk_context->config);
pk_context->config = NULL;
}
polkit_context_force_reload (pk_context);
/* Purge authorization entries from the cache */
_polkit_authorization_db_invalidate_cache (pk_context->authdb);
if (pk_context->config_changed_cb != NULL) {
pk_context->config_changed_cb (pk_context,
pk_context->config_changed_user_data);
......@@ -349,6 +334,41 @@ again:
}
}
/**
* polkit_context_force_reload:
* @pk_context: context
*
* Force a reload.
*
* Note that there is no reason to call this method in response to a
* config changed callback.
*
* Since: 0.7
*/
void
polkit_context_force_reload (PolKitContext *pk_context)
{
kit_return_if_fail (pk_context != NULL);
/* purge existing policy files */
_pk_debug ("purging policy files");
if (pk_context->priv_cache != NULL) {
polkit_policy_cache_unref (pk_context->priv_cache);
pk_context->priv_cache = NULL;
}
/* Purge existing old config file */
_pk_debug ("purging configuration file");
if (pk_context->config != NULL) {
polkit_config_unref (pk_context->config);
pk_context->config = NULL;
}
/* Purge authorization entries from the cache */
_polkit_authorization_db_invalidate_cache (pk_context->authdb);
}
/**
* polkit_context_set_io_watch_functions:
* @pk_context: the context object
......
......@@ -154,6 +154,8 @@ polkit_bool_t polkit_context_init (PolKitContext
PolKitContext *polkit_context_ref (PolKitContext *pk_context);
void polkit_context_unref (PolKitContext *pk_context);
void polkit_context_force_reload (PolKitContext *pk_context);
void polkit_context_io_func (PolKitContext *pk_context, int fd);
PolKitPolicyCache *polkit_context_get_policy_cache (PolKitContext *pk_context);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment