mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Skip creating tables marked as deleted
This commit is contained in:
parent
c26325efee
commit
b136b3e0c7
1 changed files with 17 additions and 9 deletions
|
|
@ -529,17 +529,25 @@ class installController extends install
|
|||
$schema_dir = sprintf('%s/schemas/', $module_path);
|
||||
$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
|
||||
|
||||
$file_cnt = count($schema_files);
|
||||
for($i=0;$i<$file_cnt;$i++)
|
||||
foreach ($schema_files as $filename)
|
||||
{
|
||||
$file = trim($schema_files[$i]);
|
||||
if(!$file || substr($file,-4)!='.xml') continue;
|
||||
$table_name = substr(basename($file), 0, -4);
|
||||
if($oDB->isTableExists($table_name)) continue;
|
||||
$output = $oDB->createTableByXmlFile($file);
|
||||
if($output === false)
|
||||
if (!preg_match('/^([a-zA-Z0-9_]+)\.xml$/', $filename, $matches))
|
||||
{
|
||||
throw new Exception(lang('msg_create_table_failed') . ': ' . basename($file) . ': ' . $oDB->getError()->getMessage());
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/<table\s[^>]*deleted="true"/i', file_get_contents($schema_dir . $filename)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$table_name = $matches[1];
|
||||
if($oDB->isTableExists($table_name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$output = $oDB->createTable($schema_dir . $filename);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
throw new Exception(lang('msg_create_table_failed') . ': ' . $table_name . ': ' . $oDB->getError()->getMessage());
|
||||
}
|
||||
}
|
||||
// Create a table and module instance and then execute install() method
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue