mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Improved DB-Verify debug information and problem detection.
This commit is contained in:
@@ -575,7 +575,7 @@ function update_706_to_800($type='')
|
|||||||
);
|
);
|
||||||
|
|
||||||
// List of DB tables not required (includes a few from 0.6xx)
|
// List of DB tables not required (includes a few from 0.6xx)
|
||||||
$obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last', 'session', 'preset', 'tinymce');
|
$obs_tables = array('flood', 'stat_info', 'stat_counter', 'stat_last', 'session', 'preset', 'tinymce');
|
||||||
|
|
||||||
|
|
||||||
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
|
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
|
||||||
|
@@ -28,6 +28,8 @@ class db_verify
|
|||||||
var $results = array();
|
var $results = array();
|
||||||
var $indices = array(); // array(0) - Issue?
|
var $indices = array(); // array(0) - Issue?
|
||||||
var $fixList = array();
|
var $fixList = array();
|
||||||
|
private $currentTable = null;
|
||||||
|
private $internalError = false;
|
||||||
|
|
||||||
var $fieldTypes = array('time','timestamp','datetime','year','tinyblob','blob',
|
var $fieldTypes = array('time','timestamp','datetime','year','tinyblob','blob',
|
||||||
'mediumblob','longblob','tinytext','mediumtext','longtext','text','date');
|
'mediumblob','longblob','tinytext','mediumtext','longtext','text','date');
|
||||||
@@ -50,10 +52,8 @@ class db_verify
|
|||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
$ns = e107::getRender();
|
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$frm = e107::getForm();
|
|
||||||
|
|
||||||
$this->backUrl = e_SELF;
|
$this->backUrl = e_SELF;
|
||||||
|
|
||||||
@@ -70,6 +70,7 @@ 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->tables[$id] = $this->getTables($data);
|
$this->tables[$id] = $this->getTables($data);
|
||||||
unset($data);
|
unset($data);
|
||||||
}
|
}
|
||||||
@@ -112,10 +113,7 @@ class db_verify
|
|||||||
|
|
||||||
function runComparison($fileArray)
|
function runComparison($fileArray)
|
||||||
{
|
{
|
||||||
|
|
||||||
$ns = e107::getRender();
|
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$frm = e107::getForm();
|
|
||||||
|
|
||||||
foreach($fileArray as $tab)
|
foreach($fileArray as $tab)
|
||||||
{
|
{
|
||||||
@@ -133,13 +131,19 @@ class db_verify
|
|||||||
$this->renderResults();
|
$this->renderResults();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if($this->internalError === false)
|
||||||
{
|
{
|
||||||
$mes->addSuccess(DBLAN_111);
|
$mes->addSuccess(DBLAN_111);
|
||||||
$mes->addSuccess("<a class='btn btn-primary' href='".$this->backUrl."'>".LAN_BACK."</a>");
|
$mes->addSuccess("<a class='btn btn-primary' href='".$this->backUrl."'>".LAN_BACK."</a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//$debug = "<pre>".print_r($this->results,TRUE)."</pre>";
|
//$debug = "<pre>".print_r($this->results,TRUE)."</pre>";
|
||||||
//$mes->add($debug,E_MESSAGE_DEBUG);
|
//$mes->add($debug,E_MESSAGE_DEBUG);
|
||||||
//$text .= "<div class='buttons-bar center'>".$frm->admin_button('back', DBVLAN_17, 'back')."</div>";
|
//$text .= "<div class='buttons-bar center'>".$frm->admin_button('back', DBVLAN_17, 'back')."</div>";
|
||||||
$ns->tablerender("Okay",$mes->render().$text);
|
echo $mes->render();
|
||||||
|
// $ns->tablerender("Okay",$mes->render().$text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -195,9 +199,13 @@ class db_verify
|
|||||||
function compare($selection,$language='')
|
function compare($selection,$language='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->currentTable = $selection;
|
||||||
|
|
||||||
if(empty($this->tables[$selection]['tables']))
|
if(empty($this->tables[$selection]['tables']))
|
||||||
{
|
{
|
||||||
return;
|
//$this->internalError = true;
|
||||||
|
e107::getMessage()->addDebug("Couldn't read table data for ".$selection);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->tables[$selection]['tables'] as $key=>$tbl)
|
foreach($this->tables[$selection]['tables'] as $key=>$tbl)
|
||||||
@@ -208,7 +216,7 @@ class db_verify
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($rawSqlData === FALSE)
|
if($rawSqlData === false)
|
||||||
{
|
{
|
||||||
if($language) continue;
|
if($language) continue;
|
||||||
|
|
||||||
@@ -222,6 +230,7 @@ class db_verify
|
|||||||
|
|
||||||
// echo "<h4>RAW</h4>";
|
// echo "<h4>RAW</h4>";
|
||||||
// print_a($rawSqlData);
|
// print_a($rawSqlData);
|
||||||
|
// $this->currentTable = $tbl;v
|
||||||
|
|
||||||
$sqlDataArr = $this->getTables($rawSqlData);
|
$sqlDataArr = $this->getTables($rawSqlData);
|
||||||
// echo "<h4>PARSED</h4>";
|
// echo "<h4>PARSED</h4>";
|
||||||
@@ -736,7 +745,8 @@ class db_verify
|
|||||||
{
|
{
|
||||||
if(!$sql_data)
|
if(!$sql_data)
|
||||||
{
|
{
|
||||||
return;
|
e107::getMessage()->addError("No SQL Data found in file");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
@@ -770,7 +780,11 @@ class db_verify
|
|||||||
$ret['data'] = $match[2];
|
$ret['data'] = $match[2];
|
||||||
$ret['engine'] = $match[4];
|
$ret['engine'] = $match[4];
|
||||||
|
|
||||||
|
if(empty($ret['tables']))
|
||||||
|
{
|
||||||
|
e107::getMessage()->addDebug("Unable to parse ".$this->currentTable."_sql.php file data. Possibly missing a ';' at the end?");
|
||||||
|
e107::getMessage()->addDebug(print_a($regex,true));
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@@ -927,6 +941,7 @@ class db_verify
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mes->addDebug('Failed: '.$qry);
|
$mes->addDebug('Failed: '.$qry);
|
||||||
|
$this->internalError = true;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user