those wanting to sort global.php back to original
search
Code:
($hook = vBulletinHook::fetch_hook('cache_templates')) ? eval($hook) : false;
below , delete
Code:
// now get all the templates we have specified
/**
* @author Dusty Burns (Trigunflame@charter.net)
* @copyright 2006-2007 Dusty Burns
* @package Vbulletin Template Cache
* @version 2.5.0.0
* @todo Add Shared Memory Support
*/
/*
* Is this actually necessary?
*
* Probably not, but right now I don't want hacks
* whos authors did not copy the define() for
* THIS_SCRIPT and change it; causing us to get
* the wrong cache and screwing the page up.
*
* This basically makes sure that THE_SCRIPT does
* correspond to the actual filename being requested.
*
* PS. You can change .php down below this to whatever
* file ext you use for Your PHP files: ie .php4,.php5
*/
if (THIS_SCRIPT == basename($vbulletin->script, '.php'))
{
// Cache Templates
$vbulletin->cache_templates = true;
/*
* It is nice to have some sort of function
* for locking while writing data. We could
* just use flock, but for the sake of
* conforming to how jelsoft does some things.
*
* Begin Generic Lock
*/
function tpl_cache_lock()
{
global $db;
$lock_attempts = 5;
while ($lock_attempts >= 1)
{
$result = $db->query_write(
'UPDATE ' . TABLE_PREFIX . 'adminutil SET ' .
'text = UNIX_TIMESTAMP() ' .
"WHERE title = 'datastorelock' " .
'AND text < UNIX_TIMESTAMP() - 15'
);
if ($db->affected_rows() > 0) { return true; } else { $lock_attempts--; sleep(1); }
}
return false;
}
function tpl_cache_unlock()
{
global $db;
$db->query_write(
'UPDATE ' . TABLE_PREFIX . 'adminutil ' .
"SET text = 0 WHERE title = 'datastorelock'"
);
}
/*
* End Generic Lock
*/
// Check Existance
$tpl_cache_name = DIR . '/template_cache/' . THIS_SCRIPT . '_' . STYLEID . '.php';
// Look For Cached File
if (@include($tpl_cache_name))
{
// Fake Cached Templates & Update Style
cache_templates(array(), $style['templatelist']);
}
// Write Cache
else
{
// Build Template Cache
cache_templates($globaltemplates, $style['templatelist']);
// Get File Lock
if (tpl_cache_lock())
{
$tpl_cache = "<?php\r\n" . '$vbulletin->templatecache = ' .
var_export($vbulletin->templatecache, true) . ';' . "\r\n?>";
// Debugging Purposes
if ($fp = @fopen($tpl_cache_name, 'w+'))
{
@fwrite($fp, $tpl_cache);
@fclose($fp);
unset($tpl_cache);
tpl_cache_unlock();
}
// Could Not Create File
else
{
tpl_cache_unlock();
exit("Could not cache template file. The template_cache dir must be writable (CHMOD 777).");
}
}
}
}
// Vbulletin Default
else
{
// now get all the templates we have specified
cache_templates($globaltemplates, $style['templatelist']);
}
unset($globaltemplates, $actiontemplates, $_get_edit_templates, $_templatedo);
replace with
Code:
// now get all the templates we have specified
cache_templates($globaltemplates, $style['templatelist']);
unset($globaltemplates, $actiontemplates, $_get_edit_templates, $_templatedo);
i believe thats original