Permalink
Browse files

Updating cache module, now uses namespaces.

  • Loading branch information...
1 parent d8f2225 commit f90f415e4ee01e5cec2aacbabd2ede2bf237c370 @reines reines committed Jan 14, 2012
Showing with 20 additions and 19 deletions.
  1. +3 −1 config.example.php
  2. +1 −1 extern.php
  3. +1 −1 footer.php
  4. +1 −1 header.php
  5. +2 −3 include/classes/lang.php
  6. +4 −4 include/common.php
  7. +3 −3 include/functions.php
  8. +1 −1 include/search_idx.php
  9. +3 −3 install.php
  10. +1 −1 modules/cache
View
@@ -13,7 +13,9 @@
'cache' => array(
'type' => 'File',
'dir' => PUN_ROOT.'cache/',
- 'serializer' => 'VarExport',
+ 'serializer' => array(
+ 'type' => 'VarExport',
+ ),
'suffix' => '.php',
),
'cookie' => array(
View
@@ -440,7 +440,7 @@ function output_html($feed)
}
$now = time();
- if (!isset($feed) || $feed === Flux_Cache::NOT_FOUND)
+ if (!isset($feed) || $feed === \fluxbb\cache\Cache::NOT_FOUND)
{
// Setup the feed
$feed = array(
View
@@ -69,7 +69,7 @@
if ($pun_config['o_quickjump'] == '1')
{
$quickjump = $cache->get('quickjump');
- if ($quickjump === Flux_Cache::NOT_FOUND)
+ if ($quickjump === \fluxbb\cache\Cache::NOT_FOUND)
{
$quickjump = array();
View
@@ -234,7 +234,7 @@ function process_form(the_form)
if ($pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2')
{
$num_reports = $cache->get('num_reports');
- if ($num_reports === Flux_Cache::NOT_FOUND)
+ if ($num_reports === \fluxbb\cache\Cache::NOT_FOUND)
{
$query = $db->select(array('num_reports' => 'COUNT(r.id) AS num_reports'), 'reports AS r');
$query->where = 'r.zapped IS NULL';
View
@@ -1,7 +1,6 @@
<?php
require_once PUN_ROOT.'modules/gettext/src/Gettext.php';
-require_once PUN_ROOT.'modules/cache/src/Cache.php';
class Flux_Lang
{
@@ -136,15 +135,15 @@ public function load($resource)
// TODO: Slash allowed? - I'd rather use that than an underscore
$trans_cache = $cache->get($this->lang.'_'.$resource);
- if ($trans_cache === Flux_Cache::NOT_FOUND)
+ if ($trans_cache === \fluxbb\cache\Cache::NOT_FOUND)
{
$trans_cache = Flux_Gettext::parse($filename);
// If this is not the default language, load that, too
if ($this->defaultLang != $this->lang)
{
$def_trans_cache = $cache->get($this->defaultLang.'_'.$resource);
- if ($def_trans_cache === Flux_Cache::NOT_FOUND)
+ if ($def_trans_cache === \fluxbb\cache\Cache::NOT_FOUND)
{
$def_trans_cache = Flux_Gettext::parse($default_filename);
View
@@ -95,8 +95,8 @@ function stripslashes_array($array)
$cookie_name = 'pun_cookie';
// Load the cache module
-require PUN_ROOT.'modules/cache/src/Cache.php';
-$cache = Flux_Cache::load($flux_config['cache']['type'], $flux_config['cache'], $flux_config['cache']['serializer']);
+require PUN_ROOT.'modules/cache/src/cache.php';
+$cache = \fluxbb\cache\Cache::load($flux_config['cache']['type'], $flux_config['cache'], $flux_config['cache']['serializer']['type'], $flux_config['cache']['serializer']);
// Define a few commonly used constants
define('PUN_UNVERIFIED', 0);
@@ -115,7 +115,7 @@ function stripslashes_array($array)
// Load cached config
$pun_config = $cache->get('config');
-if ($pun_config === Flux_Cache::NOT_FOUND)
+if ($pun_config === \fluxbb\cache\Cache::NOT_FOUND)
{
$pun_config = array();
@@ -175,7 +175,7 @@ function stripslashes_array($array)
// Load cached bans
$pun_bans = $cache->get('bans');
-if ($pun_bans === Flux_Cache::NOT_FOUND)
+if ($pun_bans === \fluxbb\cache\Cache::NOT_FOUND)
{
// Get the ban list from the DB
$query = $db->select(array('id' => 'b.id', 'username' => 'b.username', 'ip' => 'b.ip', 'email' => 'b.email', 'message' => 'b.message', 'expire' => 'b.expire', 'ban_creator' => 'b.ban_creator'), 'bans AS b');
View
@@ -15,7 +15,7 @@ function fetch_board_stats()
global $cache, $db;
$stats = $cache->get('boardstats');
- if ($stats === Flux_Cache::NOT_FOUND)
+ if ($stats === \fluxbb\cache\Cache::NOT_FOUND)
{
$stats = array();
@@ -1015,7 +1015,7 @@ function censor_words($text)
if (!isset($censors))
{
$censors = $cache->get('censors');
- if ($censors === Flux_Cache::NOT_FOUND)
+ if ($censors === \fluxbb\cache\Cache::NOT_FOUND)
{
$censors = array();
@@ -1063,7 +1063,7 @@ function get_title($user)
if ($pun_config['o_ranks'] == '1' && !isset($pun_ranks))
{
$pun_ranks = $cache->get('ranks');
- if ($pun_ranks === Flux_Cache::NOT_FOUND)
+ if ($pun_ranks === \fluxbb\cache\Cache::NOT_FOUND)
{
$pun_ranks = array();
View
@@ -88,7 +88,7 @@ function validate_search_word($word, $idx)
$cache_id = generate_stopwords_cache_id();
$stopwords = $cache->get('stopwords.'.$cache_id);
- if ($stopwords === Flux_Cache::NOT_FOUND)
+ if ($stopwords === \fluxbb\cache\Cache::NOT_FOUND)
{
$stopwords = array();
View
@@ -78,9 +78,9 @@ function stripslashes_array($array)
define('FORUM_CACHE_DIR', PUN_ROOT.'cache/');
// Load the cache module
-require PUN_ROOT.'modules/cache/src/Cache.php';
-$cache = Flux_Cache::load('File', array('dir' => FORUM_CACHE_DIR), 'VarExport'); // TODO: Move this config into config.php
-// TODO: according to the comment above - how do you want to move this to config when it doesn't exist? :)
+require PUN_ROOT.'modules/cache/src/cache.php';
+// Use a dummy cache since we don't know what cache type the user wants to use yet
+$cache = \fluxbb\cache\Cache::load('Dummy', array(), 'VarExport', array());
@franzliedke

franzliedke Apr 11, 2012

Owner

This isn't used anywhere in install.php as far as I can see (or are there functions that make use of the global $cache variable?). Can we delete it?

// Load the language system
require PUN_ROOT.'include/classes/lang.php';

0 comments on commit f90f415

Please sign in to comment.