Skip to content

Commit

Permalink
NEW Support of deployement of metapackages
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 12, 2019
1 parent 0d56cd0 commit 9514155
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -145,6 +145,7 @@ NEW: #4301
For Developers or integrators:

NEW: Add a manifest.json.php file for web app.
NEW: Support of deployement of metapackages
NEW: Removed deprecated code that create linked object from ->origin
NEW: experimental zapier for dolibarr
NEW: Accountancy - Add hook bookkeepinglist on general ledger
Expand Down
44 changes: 30 additions & 14 deletions htdocs/admin/modules.php
Expand Up @@ -198,20 +198,36 @@
// TODO Make more test
}

// Now we install the module
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file
dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
{
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulename, LOG_WARNING);
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulename), null, 'errors');
$error++;
}
dol_syslog("Uncompress of module file is a success.");

$modulenamearrays = array();
if (dol_is_file($modulenamedir.'/metapackage.conf')) {
// This is a meta package
$metafile = file_get_contents($modulenamedir.'/metapackage.conf');
$modulenamearrays = explode("\n", $metafile);
}
$modulenamearrays[$modulename] = $modulename;

foreach($modulenamearrays as $modulenameval) {
if (strpos($modulenameval, '#') === 0) continue; // Discard comments
if (strpos($modulenameval, '//') === 0) continue; // Discard comments
if (! trim($modulenameval)) continue;

// Now we install the module
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
$result=dolCopyDir($conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval, '0444', 1);
if ($result <= 0)
{
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyDir", $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval), null, 'errors');
$error++;
}
}
}
}
}
Expand Down

0 comments on commit 9514155

Please sign in to comment.