mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Fix #1550 mark counter_site_status table as deleted
This commit is contained in:
parent
34280af0f0
commit
c26325efee
5 changed files with 28 additions and 5 deletions
|
|
@ -686,6 +686,10 @@ class DB
|
|||
{
|
||||
return $this->setError(-1, 'Table creation failed.');
|
||||
}
|
||||
if ($table->deleted)
|
||||
{
|
||||
return new \BaseObject;
|
||||
}
|
||||
|
||||
// Generate the CREATE TABLE query and execute it.
|
||||
$query_string = $table->getCreateQuery($this->_prefix, $this->_charset, $this->_engine);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class Table
|
|||
public $indexes = array();
|
||||
public $primary_key = array();
|
||||
public $constraints = array();
|
||||
public $deleted = false;
|
||||
|
||||
/**
|
||||
* Generate the CREATE TABLE query for this table.
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ class DBTableParser extends BaseParser
|
|||
$table->name = strval($xml['name']);
|
||||
}
|
||||
|
||||
$deleted = strval($xml['deleted']);
|
||||
if ($deleted !== '')
|
||||
{
|
||||
$table->deleted = toBool($deleted);
|
||||
}
|
||||
|
||||
// Load columns.
|
||||
foreach ($xml->column as $column_info)
|
||||
{
|
||||
|
|
|
|||
1
modules/counter/schemas/counter_site_status.xml
Normal file
1
modules/counter/schemas/counter_site_status.xml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<table name="counter_site_status" deleted="true"></table>
|
||||
|
|
@ -1442,14 +1442,25 @@ class moduleModel extends module
|
|||
if(!is_dir(FileHandler::getRealPath($path))) continue;
|
||||
|
||||
// Get the number of xml files to create a table in schemas
|
||||
$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
|
||||
$table_count = count($tmp_files);
|
||||
$table_count = 0;
|
||||
$schema_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
|
||||
foreach ($schema_files as $filename)
|
||||
{
|
||||
if (!preg_match('/<table\s[^>]*deleted="true"/i', file_get_contents($path . 'schemas/' . $filename)))
|
||||
{
|
||||
$table_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the table is created
|
||||
$created_table_count = 0;
|
||||
for($j=0;$j<$table_count;$j++)
|
||||
foreach ($schema_files as $filename)
|
||||
{
|
||||
list($table_name) = explode('.',$tmp_files[$j]);
|
||||
if($oDB->isTableExists($table_name)) $created_table_count ++;
|
||||
list($table_name, $unused) = explode('.', $filename);
|
||||
if($oDB->isTableExists($table_name))
|
||||
{
|
||||
$created_table_count++;
|
||||
}
|
||||
}
|
||||
// Get information of the module
|
||||
$info = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue