Deserate - Joomla! Forum - community, help and support


i getting error , after doing research found should contact host server. did , getting error.
fatal error: call member function get() on non-object in /home/heapwe5/public_html/proofs/libraries/joomla/cache/cache.php on line 191

they restored site yet still error. have tried answer them , getting no where..i desperate help.

here cache file. running joomla 1.7.3.

<?php
/**
* @package joomla.platform
* @subpackage cache
*
* @copyright copyright (c) 2005 - 2012 open source matters, inc. rights reserved.
* @license gnu general public license version 2 or later; see license
*/

defined('jpath_platform') or die;

//register storage class loader
jloader::register('jcachestorage', dirname(__file__) . '/storage.php');

//register controller class loader
jloader::register('jcachecontroller', dirname(__file__) . '/controller.php');

// must public here allow overloading.

/**
* joomla! cache base object
*
* @package joomla.platform
* @subpackage cache
* @since 11.1
*/
class jcache extends jobject
{
/**
* @var object storage handler
* @since 11.1
*/
public static $_handler = array();

/**
* @var array options
* @since 11.1
*/
public $_options;

/**
* constructor
*
* @param array $options options
*
* @since 11.1
*/
public function __construct($options)
{
$conf = jfactory::getconfig();

$this->_options = array(
'cachebase' => $conf->get('cache_path', jpath_cache),
'lifetime' => (int) $conf->get('cachetime'),
'language' => $conf->get('language', 'en-gb'),
'storage' => $conf->get('cache_handler', ''),
'defaultgroup' => 'default',
'locking' => true,
'locktime' => 15,
'checktime' => true,
'caching' => ($conf->get('caching') >= 1) ? true : false);

// overwrite default options given options
foreach ($options $option => $value)
{
if (isset($options[$option]) && $options[$option] !== '')
{
$this->_options[$option] = $options[$option];
}
}

if (empty($this->_options['storage']))
{
$this->_options['caching'] = false;
}
}

/**
* returns reference cache adapter object, creating it
*
* @param string $type cache object type instantiate
* @param array $options array of options
*
* @return jcache jcache object
*
* @since 11.1
*/
public static function getinstance($type = 'output', $options = array())
{
return jcachecontroller::getinstance($type, $options);
}

/**
* storage handlers
*
* @return array array of available storage handlers
*
* @since 11.1
*/
public static function getstores()
{
jimport('joomla.filesystem.folder');
$handlers = jfolder::files(dirname(__file__) . '/storage', '.php');

$names = array();
foreach ($handlers $handler)
{
$name = substr($handler, 0, strrpos($handler, '.'));
$class = 'jcachestorage' . $name;

if (!class_exists($class))
{
include_once dirname(__file__) . '/storage/' . $name . '.php';
}

if (call_user_func_array(array(trim($class), 'test'), array()))
{
$names[] = $name;
}
}

return $names;
}

/**
* set caching enabled state
*
* @param boolean $enabled true enable caching
*
* @return void
*
* @since 11.1
*/
public function setcaching($enabled)
{
$this->_options['caching'] = $enabled;
}

/**
* caching state
*
* @return boolean caching state
*
* @since 11.1
*/
public function getcaching()
{
return $this->_options['caching'];
}

/**
* set cache lifetime
*
* @param integer $lt cache lifetime
*
* @return void
*
* @since 11.1
*/
public function setlifetime($lt)
{
$this->_options['lifetime'] = $lt;
}

/**
* cached data id , group
*
* @param string $id cache data id
* @param string $group cache data group
*
* @return mixed boolean false on failure or cached data string
*
* @since 11.1
*/
public function get($id, $group = null)
{
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// storage
$handler = $this->_getstorage();
if (!($handler instanceof exception) && $this->_options['caching'])
{
return $handler->get($id, $group, $this->_options['checktime']);
}
return false;
}

/**
* list of cached data
*
* @return mixed boolean false on failure or object list of cache groups , data
*
* @since 11.1
*/
public function getall()
{
// storage
$handler = $this->_getstorage();
if (!($handler instanceof exception) && $this->_options['caching'])
{
return $handler->getall();
}
return false;
}

/**
* store cached data id , group
*
* @param mixed $data data store
* @param string $id cache data id
* @param string $group cache data group
*
* @return boolean true if cache stored
*
* @since 11.1
*/
public function store($data, $id, $group = null)
{
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// storage , store cached data
$handler = $this->_getstorage();
if (!($handler instanceof exception) && $this->_options['caching'])
{
$handler->_lifetime = $this->_options['lifetime'];
return $handler->store($id, $group, $data);
}
return false;
}

/**
* remove cached data entry id , group
*
* @param string $id cache data id
* @param string $group cache data group
*
* @return boolean true on success, false otherwise
*
* @since 11.1
*/
public function remove($id, $group = null)
{
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// storage
$handler = $this->_getstorage();
if (!($handler instanceof exception))
{
return $handler->remove($id, $group);
}
return false;
}

/**
* clean cache group given mode.
*
* group mode : cleans cache in group
* notgroup mode : cleans cache not in group
*
* @param string $group cache data group
* @param string $mode mode cleaning cache [group|notgroup]
*
* @return boolean true on success, false otherwise
*
* @since 11.1
*/
public function clean($group = null, $mode = 'group')
{
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// storage handler
$handler = $this->_getstorage();
if (!($handler instanceof exception))
{
return $handler->clean($group, $mode);
}
return false;
}

/**
* garbage collect expired cache data
*
* @return boolean true on success, false otherwise.
*
* @since 11.1
*/
public function gc()
{
// storage handler
$handler = $this->_getstorage();
if (!($handler instanceof exception))
{
return $handler->gc();
}
return false;
}

/**
* set lock flag on cached item
*
* @param string $id cache data id
* @param string $group cache data group
* @param string $locktime default locktime locking cache.
*
* @return object properties lock , locklooped
*
* @since 11.1
*/
public function lock($id, $group = null, $locktime = null)
{
$returning = new stdclass;
$returning->locklooped = false;
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// default locktime
$locktime = ($locktime) ? $locktime : $this->_options['locktime'];

// allow storage handlers perform locking on own
// note drivers lock need unlock or unlocking fail because of false $id
$handler = $this->_getstorage();
if (!($handler instanceof exception) && $this->_options['locking'] == true && $this->_options['caching'] == true)
{
$locked = $handler->lock($id, $group, $locktime);
if ($locked !== false)
{
return $locked;
}
}

// fallback
$curentlifetime = $this->_options['lifetime'];

// set lifetime locktime storing in children
$this->_options['lifetime'] = $locktime;

$looptime = $locktime * 10;
$id2 = $id . '_lock';

if ($this->_options['locking'] == true && $this->_options['caching'] == true)
{
$data_lock = $this->get($id2, $group);

}
else
{
$data_lock = false;
$returning->locked = false;
}

if ($data_lock !== false)
{
$lock_counter = 0;

// loop until find lock has been released.
// implies data other thread has finished
while ($data_lock !== false)
{

if ($lock_counter > $looptime)
{
$returning->locked = false;
$returning->locklooped = true;
break;
}

usleep(100);
$data_lock = $this->get($id2, $group);
$lock_counter++;
}
}

if ($this->_options['locking'] == true && $this->_options['caching'] == true)
{
$returning->locked = $this->store(1, $id2, $group);
}

// revert lifetime previous one
$this->_options['lifetime'] = $curentlifetime;

return $returning;
}

/**
* unset lock flag on cached item
*
* @param string $id cache data id
* @param string $group cache data group
*
* @return boolean true on success, false otherwise.
*
* @since 11.1
*/
public function unlock($id, $group = null)
{
$unlock = false;
// default group
$group = ($group) ? $group : $this->_options['defaultgroup'];

// allow handlers perform unlocking on own
$handler = $this->_getstorage();
if (!($handler instanceof exception) && $this->_options['caching'])
{
$unlocked = $handler->unlock($id, $group);
if ($unlocked !== false)
{
return $unlocked;
}
}

// fallback
if ($this->_options['caching'])
{
$unlock = $this->remove($id . '_lock', $group);
}

return $unlock;
}

/**
* cache storage handler
*
* @return jcachestorage jcachestorage object
*
* @since 11.1
*/
public function &_getstorage()
{
$hash = md5(serialize($this->_options));

if (isset(self::$_handler[$hash]))
{
return self::$_handler[$hash];
}

self::$_handler[$hash] = jcachestorage::getinstance($this->_options['storage'], $this->_options);

return self::$_handler[$hash];
}

/**
* perform workarounds on retrieved cached data
*
* @param string $data cached data
* @param array $options array of options
*
* @return string body of cached data
*
* @since 11.1
*/
public static function getworkarounds($data, $options = array())
{
// initialise variables.
$app = jfactory::getapplication();
$document = jfactory::getdocument();
$body = null;

// document head out of cache.
if (isset($options['mergehead']) && $options['mergehead'] == 1 && isset($data['head']) && !empty($data['head']))
{
$document->mergeheaddata($data['head']);
}
elseif (isset($data['head']) && method_exists($document, 'setheaddata'))
{
$document->setheaddata($data['head']);
}

// if pathway buffer set in cache data, it.
if (isset($data['pathway']) && is_array($data['pathway']))
{
// push pathway data pathway object.
$pathway = $app->getpathway();
$pathway->setpathway($data['pathway']);
}

// @todo check if following needed, seems should in page cache
// if module buffer set in cache data, it.
if (isset($data['module']) && is_array($data['module']))
{
// iterate through module positions , push them document buffer.
foreach ($data['module'] $name => $contents)
{
$document->setbuffer($contents, 'module', $name);
}
}

if (isset($data['body']))
{
// following code searches token in cached page , replaces the
// proper token.
$token = jsession::getformtoken();
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
$replacement = '<input type="hidden" name="' . $token . '" value="1" />';
$data['body'] = preg_replace($search, $replacement, $data['body']);
$body = $data['body'];
}

// document body out of cache.
return $body;
}

/**
* create workarounded data cached
*
* @param string $data cached data
* @param array $options array of options
*
* @return string data cached
*
* @since 11.1
*/
public static function setworkarounds($data, $options = array())
{
$loptions = array();
$loptions['nopathway'] = 0;
$loptions['nohead'] = 0;
$loptions['nomodules'] = 0;
$loptions['modulemode'] = 0;

if (isset($options['nopathway']))
{
$loptions['nopathway'] = $options['nopathway'];
}

if (isset($options['nohead']))
{
$loptions['nohead'] = $options['nohead'];
}

if (isset($options['nomodules']))
{
$loptions['nomodules'] = $options['nomodules'];
}

if (isset($options['modulemode']))
{
$loptions['modulemode'] = $options['modulemode'];
}

// initialise variables.
$app = jfactory::getapplication();
$document = jfactory::getdocument();

// modules buffer before component execution.
$buffer1 = $document->getbuffer();
if (!is_array($buffer1))
{
$buffer1 = array();
}

// make sure module buffer array.
if (!isset($buffer1['module']) || !is_array($buffer1['module']))
{
$buffer1['module'] = array();
}

// view body data
$cached['body'] = $data;

// document head data
if ($loptions['nohead'] != 1 && method_exists($document, 'getheaddata'))
{

if ($loptions['modulemode'] == 1)
{
$headnow = $document->getheaddata();
$unset = array('title', 'description', 'link', 'links', 'metatags');

foreach ($unset $un)
{
unset($headnow[$un]);
unset($options['headerbefore'][$un]);
}

$cached['head'] = array();

// store module has added
foreach ($headnow $now => $value)
{
$newvalue = array_diff_assoc($headnow[$now], isset($options['headerbefore'][$now]) ? $options['headerbefore'][$now] : array());
if (!empty($newvalue))
{
$cached['head'][$now] = $newvalue;
}
}

}
else
{
$cached['head'] = $document->getheaddata();
}
}

// pathway data
if ($app->issite() && $loptions['nopathway'] != 1)
{
$pathway = $app->getpathway();
$cached['pathway'] = isset($data['pathway']) ? $data['pathway'] : $pathway->getpathway();
}

if ($loptions['nomodules'] != 1)
{
// @todo check if following needed, seems should in page cache
// module buffer after component execution.
$buffer2 = $document->getbuffer();
if (!is_array($buffer2))
{
$buffer2 = array();
}

// make sure module buffer array.
if (!isset($buffer2['module']) || !is_array($buffer2['module']))
{
$buffer2['module'] = array();
}

// compare second module buffer against first buffer.
$cached['module'] = array_diff_assoc($buffer2['module'], $buffer1['module']);
}

return $cached;
}

/**
* create safe id cached data url parameters set plugins , framework
*
* @return string md5 encoded cacheid
*
* @since 11.1
*/
public static function makeid()
{
$app = jfactory::getapplication();
// url parameters set plugins
$registeredurlparams = $app->get('registeredurlparams');

if (empty($registeredurlparams))
{
/*
$registeredurlparams = new stdclass;
$registeredurlparams->itemid = 'int';
$registeredurlparams->catid = 'int';
$registeredurlparams->id = 'int';
*/

return md5(serialize(jrequest::geturi())); // provided backwards compatibility - not safe!!!!
}
// platform defaults
$registeredurlparams->format = 'word';
$registeredurlparams->option = 'word';
$registeredurlparams->view = 'word';
$registeredurlparams->layout = 'word';
$registeredurlparams->tpl = 'cmd';
$registeredurlparams->id = 'int';

$safeuriaddon = new stdclass;

foreach ($registeredurlparams $key => $value)
{
$safeuriaddon->$key = jrequest::getvar($key, null, 'default', $value);
}

return md5(serialize($safeuriaddon));
}

/**
* add directory jcache should search handlers. may
* either pass string or array of directories.
*
* @param string $path path search.
*
* @return array array directory elements
*
* @since 11.1
*/
public static function addincludepath($path = '')
{
static $paths;

if (!isset($paths))
{
$paths = array();
}
if (!empty($path) && !in_array($path, $paths))
{
jimport('joomla.filesystem.path');
array_unshift($paths, jpath::clean($path));
}
return $paths;
}
}

i hope can me! thanks

joomla 1.7.3 have reached end of life. nothing fixed in version now.

upgrade joomla 2.5.6

havre cleared joomla cache after restore?





Comments