1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 12:21:45 +02:00

Closes #4745 - check for xml/install.xml during plugin installation.

This commit is contained in:
Cameron
2022-04-04 18:30:33 -07:00
parent 412b0b2efe
commit ba82fec626
2 changed files with 58 additions and 5 deletions

View File

@@ -1271,7 +1271,7 @@ class xmlClass
{
e107::getPlugConfig($type)->setPref($pArray);
}
else // 'add' only new prefs
elseif($mode === 'add') // 'add' only new prefs
{
foreach ($pArray as $pname => $pval)
{
@@ -1301,7 +1301,7 @@ class xmlClass
{
e107::getThemeConfig($type)->setPref($pArray);
}
else // 'add' only new prefs
elseif($mode === 'add') // 'add' only new prefs
{
foreach ($pArray as $pname => $pval)
{
@@ -1322,15 +1322,21 @@ class xmlClass
if(!empty($xmlArray['database']))
{
foreach($xmlArray['database']['dbTable'] as $val)
{
$table = $val['@attributes']['name'];
if(!isset($val['item']))
{
continue;
}
if($mode === 'install' && !$sql->isEmpty($table)) // install mode - ignore import when table contains data.
{
continue;
}
foreach($val['item'] as $item)
{
$insert_array = array();
@@ -1342,11 +1348,11 @@ class xmlClass
$insert_array[$fieldkey] = $fieldval;
}
if(($mode === "replace") && $sql->replace($table, $insert_array)!==FALSE)
if(($mode === "replace") && $sql->replace($table, $insert_array)!==false)
{
$ret['success'][] = $table;
}
elseif(($mode == "add") && $sql->insert($table, $insert_array)!==FALSE)
elseif($sql->insert($table, $insert_array)!==false)
{
$ret['success'][] = $table;
}