BUG 0000 Pmtables, importing & data lost issue SOLVED
This commit is contained in:
@@ -173,14 +173,14 @@ class PmTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildModelFor($dbsUid)
|
function buildModelFor($dbsUid, $tablesList)
|
||||||
{
|
{
|
||||||
$this->setDataSource($dbsUid);
|
$this->setDataSource($dbsUid);
|
||||||
$loadSchema = false;
|
$loadSchema = false;
|
||||||
$this->prepare($loadSchema);
|
$this->prepare($loadSchema);
|
||||||
$this->phingbuildModel();
|
$this->phingbuildModel();
|
||||||
$this->phingbuildSql();
|
$this->phingbuildSql();
|
||||||
$this->upgradeDatabaseFor($this->dataSource);
|
$this->upgradeDatabaseFor($this->dataSource, $tablesList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -467,7 +467,7 @@ class PmTable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeDatabaseFor($dataSource)
|
public function upgradeDatabaseFor($dataSource, $tablesList)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection($dataSource);
|
$con = Propel::getConnection($dataSource);
|
||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
@@ -509,7 +509,14 @@ class PmTable
|
|||||||
$line = substr($line, 0, strrpos($line, ";"));
|
$line = substr($line, 0, strrpos($line, ";"));
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
|
if (stripos($line, 'CREATE TABLE') !== false || stripos($line, 'DROP TABLE') !== false) {
|
||||||
|
if (preg_match('/TABLE\s[\'\"\`]+(\w+)[\'\"\`]+/i', $line, $match)) {
|
||||||
|
if (in_array($match[1], $tablesList)) {
|
||||||
|
//error_log($line);
|
||||||
$stmt->executeQuery($line);
|
$stmt->executeQuery($line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,7 +612,7 @@ class PmTable
|
|||||||
'propel.php.dir' => $this->baseDir
|
'propel.php.dir' => $this->baseDir
|
||||||
);
|
);
|
||||||
|
|
||||||
self::callPhing(array($taskName), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, true);
|
self::callPhing(array($taskName), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -665,6 +665,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$oAdditionalTables = new AdditionalTables();
|
$oAdditionalTables = new AdditionalTables();
|
||||||
$tableNameMap = array();
|
$tableNameMap = array();
|
||||||
$processQueue = array();
|
$processQueue = array();
|
||||||
|
$processQueueTables = array();
|
||||||
|
|
||||||
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
||||||
$filename = $_FILES['form']['name']['FILENAME'];
|
$filename = $_FILES['form']['name']['FILENAME'];
|
||||||
@@ -755,6 +756,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
if (!isset($processQueue[$contentSchema['DBS_UID']])) {
|
if (!isset($processQueue[$contentSchema['DBS_UID']])) {
|
||||||
$processQueue[$contentSchema['DBS_UID']] = array();
|
$processQueue[$contentSchema['DBS_UID']] = array();
|
||||||
}
|
}
|
||||||
|
$processQueueTables[] = $contentSchema['ADD_TAB_NAME'];
|
||||||
|
|
||||||
$result = $this->save($tableData, $alterTable);
|
$result = $this->save($tableData, $alterTable);
|
||||||
|
|
||||||
@@ -799,7 +801,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
foreach ($processQueue as $dbsUid => $tableData) {
|
foreach ($processQueue as $dbsUid => $tableData) {
|
||||||
|
|
||||||
$pmTable = new pmTable();
|
$pmTable = new pmTable();
|
||||||
$pmTable->buildModelFor($dbsUid);
|
$pmTable->buildModelFor($dbsUid, $processQueueTables);
|
||||||
$buildResult = ob_get_contents();
|
$buildResult = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user