mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Cache DBVerify table info for 15 mins (unless debug is active) - speed up admin dashboard.
This commit is contained in:
@@ -207,6 +207,7 @@ class system_tools
|
|||||||
|
|
||||||
if(isset($_POST['verify_sql']) || varset($_GET['mode'])=='verify_sql')
|
if(isset($_POST['verify_sql']) || varset($_GET['mode'])=='verify_sql')
|
||||||
{
|
{
|
||||||
|
e107::getCache()->clear('Dbverify',true);
|
||||||
require_once(e_HANDLER."db_verify_class.php");
|
require_once(e_HANDLER."db_verify_class.php");
|
||||||
$dbv = new db_verify;
|
$dbv = new db_verify;
|
||||||
$dbv->backUrl = e_SELF."?mode=verify_sql";
|
$dbv->backUrl = e_SELF."?mode=verify_sql";
|
||||||
|
@@ -46,24 +46,45 @@ class db_verify
|
|||||||
);
|
);
|
||||||
|
|
||||||
var $errors = array();
|
var $errors = array();
|
||||||
|
|
||||||
|
const cachetag = 'Dbverify';
|
||||||
/**
|
/**
|
||||||
* Setup
|
* Setup
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
$pref = e107::getPref();
|
|
||||||
$mes = e107::getMessage();
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');
|
$sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');
|
||||||
|
|
||||||
$this->backUrl = e_SELF;
|
$this->backUrl = e_SELF;
|
||||||
|
|
||||||
$core_data = file_get_contents(e_CORE.'sql/core_sql.php');
|
if(!deftrue('e_DEBUG') && $tmp = e107::getCache()->retrieve(self::cachetag, 15, true, true))
|
||||||
$this->tables['core'] = $this->getTables($core_data);
|
{
|
||||||
|
$this->tables = e107::unserialize($tmp);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tables = $this->load();
|
||||||
|
$data = e107::serialize($this->tables,'json');
|
||||||
|
e107::getCache()->set(self::cachetag,$data, true, true, true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function load()
|
||||||
|
{
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
$core_data = file_get_contents(e_CORE.'sql/core_sql.php');
|
||||||
|
$ret['core'] = $this->getTables($core_data);
|
||||||
|
|
||||||
$this->sqlLanguageTables = $this->getSqlLanguages();
|
$this->sqlLanguageTables = $this->getSqlLanguages();
|
||||||
if(varset($pref['e_sql_list']))
|
if(!empty($pref['e_sql_list']))
|
||||||
{
|
{
|
||||||
foreach($pref['e_sql_list'] as $path => $file)
|
foreach($pref['e_sql_list'] as $path => $file)
|
||||||
{
|
{
|
||||||
@@ -73,8 +94,8 @@ class db_verify
|
|||||||
$id = str_replace('_sql','',$file);
|
$id = str_replace('_sql','',$file);
|
||||||
$data = file_get_contents($filename);
|
$data = file_get_contents($filename);
|
||||||
$this->currentTable = $id;
|
$this->currentTable = $id;
|
||||||
$this->tables[$id] = $this->getTables($data);
|
$ret[$id] = $this->getTables($data);
|
||||||
unset($data);
|
unset($data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -83,10 +104,10 @@ class db_verify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Routine for checking and rendering results.
|
* Main Routine for checking and rendering results.
|
||||||
|
Reference in New Issue
Block a user