Converted all existing uses of cache.
This commit is contained in:
parent
af705232a8
commit
ccff9c7014
31 changed files with 108 additions and 144 deletions
|
|
@ -12,7 +12,6 @@ package WebGUI::Operation::Cache;
|
|||
|
||||
use strict;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Form;
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ sub www_flushCache {
|
|||
return $session->privilege->adminOnly unless canView($session);
|
||||
|
||||
# Flush the cache
|
||||
WebGUI::Cache->new($session)->flush;
|
||||
$session->cache->flush;
|
||||
|
||||
return www_manageCache($session);
|
||||
}
|
||||
|
|
@ -110,20 +109,15 @@ provides an option to clear the cache.
|
|||
sub www_manageCache {
|
||||
my $session = shift;
|
||||
return $session->privilege->adminOnly unless canView($session);
|
||||
my $cache = WebGUI::Cache->new($session);
|
||||
my $flushURL = $session->url->page('op=flushCache');
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $output
|
||||
= '<table>'
|
||||
. '<tr><td align="right" class="tableHeader">'.$i18n->get('cache type').':</td><td class="tableData">'.ref($cache).'</td></tr>'
|
||||
. '<tr><td align="right" valign="top" class="tableHeader">'.$i18n->get('cache statistics').':</td><td class="tableData"><pre>'.$cache->stats.'</pre></td></tr>'
|
||||
. '<tr><td align="right" valign="top" class="tableHeader"> </td><td class="tableData">'
|
||||
. WebGUI::Form::button($session, {
|
||||
my $output =
|
||||
WebGUI::Form::formHeader($session);
|
||||
.WebGUI::Form::button($session, {
|
||||
value => $i18n->get("clear cache"),
|
||||
extras => qq{onclick="document.location.href='$flushURL';"},
|
||||
})
|
||||
. '</td></tr>'
|
||||
. '</table>'
|
||||
.WebGUI::Form::formFooter($session);
|
||||
;
|
||||
|
||||
return _submenu($session,$output);
|
||||
|
|
|
|||
|
|
@ -726,8 +726,7 @@ sub www_saveSettings {
|
|||
$session->db->write(
|
||||
"UPDATE userProfileData SET showMessageOnLoginSeen=0"
|
||||
);
|
||||
# Delete the user cache
|
||||
WebGUI::Cache->new( $session, [ "user" ] )->deleteChunk( [ "user" ] );
|
||||
$session->cache->flush;
|
||||
}
|
||||
|
||||
return www_editSettings($session, { errors => \@errors, message => $i18n->get("editSettings done") });
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ package WebGUI::Operation::Statistics;
|
|||
|
||||
use strict;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Workflow::Cron;
|
||||
use WebGUI::DateTime;
|
||||
|
|
@ -180,10 +179,10 @@ sub www_viewStatistics {
|
|||
my ($output, $data);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $url = "http://update.webgui.org/latest-version.txt";
|
||||
my $cache = WebGUI::Cache->new($session,$url,"URL");
|
||||
my $version = $cache->get;
|
||||
my $cache = $session->cache;
|
||||
my $version = $cache->get($url);
|
||||
if (not defined $version) {
|
||||
$version = $cache->setByHTTP($url,43200);
|
||||
$version = $cache->setByHttp($url, $url, 43200);
|
||||
}
|
||||
chomp $version;
|
||||
$output .= '<table>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue