Skip to content

Commit

Permalink
adding update 011 for cache flush.
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Feb 2, 2022
1 parent c1c8234 commit 1c74156
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/base/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ function __construct() {
$this->display_name = 'Open Web Analytics';
$this->group = 'Base';
$this->author = 'Peter Adams';
$this->version = 10;
$this->version = 11;
$this->description = 'Base functionality for OWA.';
$this->config_required = false;
$this->required_schema_version = 10;
$this->required_schema_version = 11;
return parent::__construct();
}

Expand Down
50 changes: 50 additions & 0 deletions modules/base/updates/011.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

//
// Open Web Analytics - An Open Source Web Analytics Framework
//
// Copyright 2006 Peter Adams. All rights reserved.
//
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html
//

/**
* 011 Schema Update Class
*
*/

class owa_base_011_update extends owa_update {

var $schema_version = 11;

function up($force = true) {

$s = owa_coreAPI::serviceSingleton();
$file = OWA_MODULES_DIR . 'fileCache/classes/fileCache.php';
$class_info = array( 'owa_fileCache', $file, [] );
$s->setMapValue( 'object_cache_types', 'file', $class_info);

owa_coreAPI::setSetting('base', 'cache_objects', true);
owa_coreAPI::setSetting('base', 'cacheType', 'file');

$cache = owa_coreAPI::cacheSingleton();

if ( $cache->flush() ) {

owa_coreAPI::notice('Cache Flushed');
return true;

} else {
$this->e->notice('Could not flush cache.');
return false;
}

}

function down() {

return true;
}
}

?>
2 changes: 2 additions & 0 deletions modules/fileCache/classes/fileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ function flush() {
}
}
}

return true;
}

function setCacheDir($dir) {
Expand Down

0 comments on commit 1c74156

Please sign in to comment.