C4::Installer provides a way to update the kohaversion syspref. Now that
C4::Context caches syspref values, any updated value through C4::Installer
is not being seen.
This patch adds a method to C4::Context to allow you to clean that
cache. Then, it calls that method when the kohaversion syspref is changed.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
return defined($it)? C4::Boolean::true_p($it): undef;
}
+=head3 clear_syspref_cache
+
+ C4::Context->clear_syspref_cache();
+
+ cleans the internal cache of sysprefs. Please call this method if
+ you update the systempreferences table. Otherwise, your new changes
+ will not be seen by this process.
+
+=cut
+
+sub clear_syspref_cache {
+ %sysprefs = ();
+}
+
# AUTOLOAD
# This implements C4::Config->foo, and simply returns
# C4::Context->config("foo"), as described in the documentation for
my $finish=$self->{'dbh'}->prepare("INSERT into systempreferences (variable,value,explanation) values ('Version',?,'The Koha database version. WARNING: Do not change this value manually, it is maintained by the webinstaller')");
$finish->execute($kohaversion);
}
+ C4::Context->clear_syspref_cache();
}
=head2 load_sql