$schemaPlugins = array();
function getSchemaPlugins($force = false){
global $schemaPlugins;
$pluginsDir = $GLOBALS["APP"]["pluginsdir"];
if (!$force && @$schemaPlugins) return $schemaPlugins;
foreach (scandir($pluginsDir) as $dirname) {
$fullPath = $pluginsDir."/".$dirname;
if (is_dir($fullPath)){
$schemaFile = $fullPath."/schema.ini.php";
if (file_exists($schemaFile)){
$schemaPlugins[$dirname] = loadINI($schemaFile);
}
$customSchemaFile = $fullPath."/custom-schema.ini.php";
if (file_exists($customSchemaFile)){
$customSchema = loadINI($customSchemaFile);
$exclude = array("version", "name", "description");
foreach ($exclude as $e):
unset($customSchema[$e]);
endforeach;
foreach($schemaPlugins[$dirname] as $key => $value):
if (is_array($value)){
foreach($value as $kv => $vv):
if (isset($customSchema[$key][$kv]) && @$customSchema[$key][$kv] != "" && @$customSchema[$key][$kv] != $vv) $schemaPlugins[$dirname][$key][$kv] = $customSchema[$key][$kv];
endforeach;
}else{
if (isset($customSchema[$key]) && @$customSchema[$key] != "" && @$customSchema[$key] != $value) $schemaPlugins[$dirname][$key] = $customSchema[$key];
}
endforeach;
}
}
}
return $schemaPlugins;
}
function installSQL($path){
if (file_exists($path."/install.sql")){
try{
sqlImport($path."/install.sql");
return 1;
}catch(Exception $e){
return 0;
}
}else{
return 1;
}
}
function installSchemas($path){
if (file_exists($path."/schemaPresets")){
foreach (scandir($path."/schemaPresets") as $dirname) {
if (strpos($dirname,".ini")){
addTablePlugin($path."/schemaPresets",$dirname);
}
}
rename($path."/schemaPresets/",$path."/schemaPresets.bck/");
return 0;
}else{
return 1;
}
}
function showInstall($path){
global $TABLE_PREFIX,$menu,$action,$schema;
//
$result = 0;
showHeader();
?>
- 0
Instalando tablas necesarias
}else{?>Error instalando la base de datos
}?> if (installSchemas($path)){ if ($borro) rename($path."/schemaPresets",$path."/schemaPresets.bck"); ?>Instalando Schemas
}else{?>Error instalando los esquemas
}?> if ($result==2){?>Recarga para cargar el plugin }?>