Some change to start to work on autinstall of modules

This commit is contained in:
Laurent Destailleur 2010-06-06 17:36:35 +00:00
parent 5cb7f4e8a7
commit b736e7322b

View File

@ -25,12 +25,13 @@
require("../../main.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
include_once $dolibarr_main_document_root."/lib/files.lib.php";
$langs->load("admin");
$langs->load("other");
if (! $user->admin)
accessforbidden();
accessforbidden();
if ($_GET["msg"]) $message='<div class="error">'.$_GET["msg"].'</div>';
@ -45,18 +46,47 @@ $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
/*
* Actions
*/
if ($_POST["action"]=='update')
* Actions
*/
if ($_POST["action"]=='install')
{
$error=0;
$original_file=basename($_FILES["fileinstall"]["name"]);
$newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
if (! $original_file)
{
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("File"));
$error++;
}
else
{
if (! preg_match('/\.tgz/i',$original_file))
{
$mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
$error++;
}
}
if (! $error)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
create_exdir($conf->admin->dir_temp.'/'.$original_file);
$result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0)
{
//dol_uncompress($newfile);
}
}
}
/*
* View
*/
* View
*/
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
@ -67,6 +97,11 @@ print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
print '<br>';
if ($mesg)
{
print '<div class="error">'.$mesg.'</div><br>';
}
print $langs->trans("Upgrade").'<br>';
print '<hr>';
print $langs->trans("ThisIsProcessToFollow").'<br>';
@ -96,6 +131,14 @@ print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
{
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
}
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';