if (sizeof($couples) > 0 && $num > sizeof($couples)) { $error=0; $db->begin(); $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; dolibarr_install_syslog("upgrade: delete association sql=".$sql); $resqld=$db->query($sql); if ($resqld) { foreach($couples as $key => $val) { $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; dolibarr_install_syslog("upgrade: insert association sql=".$sql); $resqli=$db->query($sql); if (! $resqli) $error++; } } if (! $error) { print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>'; print '<td align="right">'.$langs->trans("Success").' ('.$num.'=>'.sizeof($couples).')</td></tr>'; $db->commit(); } else { print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>'; print '<td align="right">'.$langs->trans("Failed").'</td></tr>';
$force_install_databasepass = ''; if (!isset($force_install_databaserootlogin)) $force_install_databaserootlogin = ''; if (!isset($force_install_databaserootpass)) $force_install_databaserootpass = ''; // Now we load forced value from install.forced.php file. $useforcedwizard = false; $forcedfile = "./install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php"; if (@file_exists($forcedfile)) { $useforcedwizard = true; include_once($forcedfile); } dolibarr_install_syslog("Fileconf: Entering fileconf.php page"); /* * View */ pHeader($langs->trans("ConfigurationFile"), "etape1"); // Test if we can run a first install process if (!is_writable($conffile)) { print $langs->trans("ConfFileIsNotWritable", $conffiletoshow); pFooter(1, $setuplang, 'jscheckparam'); exit; }
print "</td></tr>"; } else if ($result < 0) print 'Error in '.get_class($object_instance).'.fetch of id'.$id.' ref='.$ref.', result='.$result.'<br>'; } } } } } print '</table>'; if (empty($actiondone)) { print '<div class="error">'.$langs->trans("ErrorWrongParameters").'</div>'; } print '<div class="center"><a href="../index.php?mainmenu=home&leftmenu=home&'.(isset($_POST["login"])?'&username='******'').'">'; print $langs->trans("GoToDolibarr"); print '</a></div>'; dolibarr_install_syslog("--- repair: end"); pFooter(1,$setuplang); if ($db->connected) $db->close(); // Return code if ran from command line if (! $ok && isset($argv[1])) exit(1);
echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?> '); } // If create user asked else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?> '); } else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?> '); } return ok; } </script> <?php // $db->close(); Not database connexion yet dolibarr_install_syslog("--- fileconf: end"); pFooter($err, $setuplang, 'jscheckparam');
ok=true; //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?> '); document.getElementById('nextbutton').style.visibility="hidden"; document.getElementById('pleasewait').style.visibility="visible"; return ok; } </script> <?php dolibarr_install_syslog("--- step1: end"); pFooter($error, $setuplang, 'jsinfo', 1); /** * Create main file. No particular permissions are set by installer. * * @param string $mainfile Full path name of main file to generate/update * @param string $main_dir Full path name to main.inc.php file * @return void */ function write_main_file($mainfile, $main_dir) { $fp = @fopen("{$mainfile}", "w"); if ($fp) { clearstatcache(); fputs($fp, '<?php' . "\n"); fputs($fp, "// Wrapper to include main into htdocs\n");
else { print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>"; dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)); $ok=0; } } // Affiche version if ($ok) { $version=$db->getVersion(); $versionarray=$db->getVersionArray(); print '<tr><td>'.$langs->trans("ServerVersion").'</td>'; print '<td align="right">'.$version.'</td></tr>'; dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerVersion")." : $version"); //print '<td align="right">'.join('.',$versionarray).'</td></tr>'; } // Force l'affichage de la progression print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>'; flush(); /* * Load sql files */ if ($ok) { if ($choix==1) $dir = "mysql/migration/"; elseif ($choix==2) $dir = "pgsql/migration/";
ok=true; //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?> '); document.getElementById('nextbutton').style.visibility="hidden"; document.getElementById('pleasewait').style.visibility="visible"; return ok; } </script> <?php dolibarr_install_syslog("--- install/etape1.php end", LOG_INFO); pFooter($error, $setuplang, 'jsinfo', 1); /** * Create main file. No particular permissions are set by installer. * * @param string $mainfile Full path name of main file to generate/update * @param string $main_dir Full path name to main.inc.php file * @return void */ function write_main_file($mainfile, $main_dir) { $fp = @fopen("{$mainfile}", "w"); if ($fp) { clearstatcache(); fputs($fp, '<?php' . "\n"); fputs($fp, "// Wrapper to include main into htdocs\n");
} dolibarr_install_syslog("upgrade: result is num=" . $num . " count(couples)=" . count($couples)); // If there is duplicates couples or child with two parents if (count($couples) > 0 && $num > count($couples)) { $error = 0; $db->begin(); // We delete all $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_association"; dolibarr_install_syslog("upgrade: delete association", LOG_DEBUG); $resqld = $db->query($sql); if ($resqld) { // And we insert only each record once foreach ($couples as $key => $val) { $sql = "INSERT INTO " . MAIN_DB_PREFIX . "categorie_association(fk_categorie_mere,fk_categorie_fille)"; $sql .= " VALUES(" . $val['mere'] . ", " . $val['fille'] . ")"; dolibarr_install_syslog("upgrade: insert association", LOG_DEBUG); $resqli = $db->query($sql); if (!$resqli) { $error++; } } } if (!$error) { print '<tr><td>' . $langs->trans("RemoveDuplicates") . '</td>'; print '<td align="right">' . $langs->trans("Success") . ' (' . $num . '=>' . count($couples) . ')</td></tr>'; $db->commit(); } else { print '<tr><td>' . $langs->trans("RemoveDuplicates") . '</td>'; print '<td align="right">' . $langs->trans("Failed") . '</td></tr>'; $db->rollback(); }
print '</table>'; print '</div>'; } } } print '<script type="text/javascript"> $("div#AShowChoices a").click(function() { $("div#navail_choices").toggle(); if ($("div#navail_choices").css("display") == "none") { $(this).text("' . $langs->trans('ShowNotAvailableOptions') . '"); $(this).parent().children("img").attr("src", "../theme/eldy/img/1downarrow.png"); } else { $(this).text("' . $langs->trans('HideNotAvailableOptions') . '"); $(this).parent().children("img").attr("src", "../theme/eldy/img/1uparrow.png"); } }); /* $(".runupgrade").click(function() { return confirm("' . dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1) . '"); }); */ </script>'; dolibarr_install_syslog("--- check: end"); pFooter(true); // Never display next button
dolibarr_install_syslog("copied file ".$conffile.".example into ".$conffile." done successfully."); } else { // If failed, we try to create an empty file dolibarr_install_syslog("failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING); $fp = @fopen($conffile, "w"); if ($fp) { @fwrite($fp, '<?php'); @fputs($fp,"\n"); @fputs($fp,"?>"); fclose($fp); } else dolibarr_install_syslog("failed to create a new file ".$conffile." into current dir ".getcwd().". Check permission.", LOG_ERR); } // First install, on ne peut pas upgrader $allowupgrade=0; } // Si fichier absent et n'a pu etre cree if (! file_exists($conffile)) { print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",$conffiletoshow); print "<br><br>"; print $langs->trans("YouMustCreateWithPermission",$conffiletoshow); print "<br><br>";
} // For backward compatibility fwrite($fp, "This is a lock file to prevent use of install pages (set with permission " . $force_install_lockinstall . ")"); fclose($fp); @chmod($lockfile, octdec($force_install_lockinstall)); $createlock = 1; } } if (empty($createlock)) { print '<br><div class="warning">' . $langs->trans("WarningRemoveInstallDir") . "</div>"; } print "<br>"; print '<div class="center"><a href="../index.php?mainmenu=home' . (isset($_POST["login"]) ? '&username='******'') . '">'; print $langs->trans("GoToDolibarr"); print '</a></div>'; } else { // If here MAIN_VERSION_LAST_UPGRADE is not empty print $langs->trans("VersionLastUpgrade") . ': <b><font class="ok">' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '</font></b><br>'; print $langs->trans("VersionProgram") . ': <b><font class="ok">' . DOL_VERSION . '</font></b>'; print "<br>"; print '<div class="center"><a href="../install/index.php">'; print $langs->trans("GoToUpgradePage"); print '</a></div>'; } } else { dol_print_error('', 'step5.php: unknown choice of action'); } // Clear cache files clearstatcache(); dolibarr_install_syslog("--- step5: Dolibarr setup finished"); pFooter(1, $setuplang);
*/ include_once("./inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); $setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto'); $langs->setDefaultLang($setuplang); $langs->load("install"); // Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard. $useforcedwizard=false; if (file_exists("./install.forced.php")) { $useforcedwizard=true; include_once("./install.forced.php"); } else if (file_exists("/etc/dolibarr/install.forced.php")) { $useforcedwizard=include_once("/etc/dolibarr/install.forced.php"); } dolibarr_install_syslog("Licence: Entering licence.php page"); /* * View */ pHeader($langs->trans("License"),"fileconf"); // Test if we can run a first install process if (! is_writable($conffile)) { print $langs->trans("ConfFileIsNotWritable",$conffiletoshow); pFooter(1,$setuplang,'jscheckparam'); exit; }
print '<tr><td colspan="2"><hr></td></tr>'; print '<tr><td class="nowrap">' . $langs->trans("ChoosedMigrateScript") . ' (external modules)</td><td align="right">' . $modulefileshort . '</td></tr>' . "\n"; // Run sql script $okmodule = run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. } } } } print '</table>'; if ($db->connected) { $db->close(); } } if (empty($actiondone)) { print '<div class="error">' . $langs->trans("ErrorWrongParameters") . '</div>'; } $ret = 0; if (!$ok && isset($argv[1])) { $ret = 1; } dol_syslog("Exit " . $ret); dolibarr_install_syslog("--- upgrade: end " . (!$ok && empty($_GET["ignoreerrors"]) || $dirmodule)); pFooter(!$ok && empty($_GET["ignoreerrors"]) || $dirmodule ? 2 : 0, $setuplang); if ($db->connected) { $db->close(); } // Return code if ran from command line if ($ret) { exit($ret); }
} // For backward compatibility fwrite($fp, "This is a lock file to prevent use of install pages (set with permission " . $force_install_lockinstall . ")"); fclose($fp); @chmod($lockfile, octdec($force_install_lockinstall)); $createlock = 1; } } if (empty($createlock)) { print '<br><div class="warning">' . $langs->trans("WarningRemoveInstallDir") . "</div>"; } print "<br>"; print '<center><a href="../index.php?mainmenu=home' . (isset($_POST["login"]) ? '&username='******'') . '">'; print $langs->trans("GoToDolibarr"); print '</a></center>'; } else { // If here MAIN_VERSION_LAST_UPGRADE is not empty print $langs->trans("VersionLastUpgrade") . ': <b><font class="ok">' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '</font></b><br>'; print $langs->trans("VersionProgram") . ': <b><font class="ok">' . DOL_VERSION . '</font></b>'; print "<br>"; print '<center><a href="../install/index.php">'; print $langs->trans("GoToUpgradePage"); print '</a></center>'; } } else { dol_print_error('', 'install/etape5.php Unknown choice of action'); } // Clear cache files clearstatcache(); dolibarr_install_syslog("--- install/etape5.php Dolibarr setup finished", LOG_INFO); pFooter(1, $setuplang);
print '<tr><td colspan="2"><hr></td></tr>'; print '<tr><td class="nowrap">' . $langs->trans("ChoosedMigrateScript") . ' (external modules)</td><td align="right">' . $modulefileshort . '</td></tr>' . "\n"; // Run sql script $okmodule = run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. } } } } print '</table>'; if ($db->connected) { $db->close(); } } if (empty($actiondone)) { print '<div class="error">' . $langs->trans("ErrorWrongParameters") . '</div>'; } $ret = 0; if (!$ok && isset($argv[1])) { $ret = 1; } dol_syslog("Exit " . $ret); dolibarr_install_syslog("--- upgrade: end"); pFooter(!$ok && empty($_GET["ignoreerrors"]) || $dirmodule, $setuplang); if ($db->connected) { $db->close(); } // Return code if ran from command line if ($ret) { exit($ret); }
/** * Reload menu if dynamic menus, if modified by version * * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf * @param string $versionto Version target * @return void */ function migrate_reload_menu($db, $langs, $conf, $versionto) { global $conf; dolibarr_install_syslog("upgrade2::migrate_reload_menu"); // Define list of menu handlers to initialize $listofmenuhandler = array(); $versiontoarray = explode('.', $versionto); // Script for VX (X<2.9) -> V2.9 $afterversionarray = explode('.', '2.8.9'); $beforeversionarray = explode('.', '2.9.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { $listofmenuhandler['auguria'] = 1; // We set here only dynamic menu handlers } // Script for VX (X<3.2) -> V3.2 $afterversionarray = explode('.', '3.1.9'); $beforeversionarray = explode('.', '3.2.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { $listofmenuhandler['auguria'] = 1; // We set here only dynamic menu handlers } foreach ($listofmenuhandler as $key => $val) { print '<tr><td colspan="4">'; //print "x".$key; print '<br>'; print '<b>' . $langs->trans('Upgrade') . '</b>: ' . $langs->trans('MenuHandler') . " " . $key . "<br>\n"; // Load sql ini_menu_handler.sql file $dir = DOL_DOCUMENT_ROOT . "/core/menus/"; $file = 'init_menu_' . $key . '.sql'; if (file_exists($dir . $file)) { $result = run_sql($dir . $file, 1, '', 1, $key); } print '</td></tr>'; } }