Skip to content
Snippets Groups Projects
Commit 0653c0cb authored by Axel Hahn's avatar Axel Hahn
Browse files

handle first run

parent e3273806
No related branches found
No related tags found
1 merge request!195534 add docker
<?php
$aConfig = array_replace_recursive(
include('config_defaults.php'),
include('config_custom.php')
)
;
$aConfig = include('config_defaults.php');
if (file_exists('config_custom.php')){
$aConfig = array_replace_recursive(
$aConfig,
include('config_custom.php')
);
}
// ----------------------------------------------------------------------
// generate some vars
......
......@@ -46,6 +46,7 @@ return [
"page_deploy",
"page_doc",
"page_htmltest",
"page_installer",
"page_phase",
"page_setup",
"page_checkssh",
......
......@@ -72,11 +72,19 @@ class user {
// UNUSED SO FAR
private function _getUser2Projects(){
return require(__DIR__ . '/../../../config/inc_user2projects.php');
$sFile=__DIR__ . '/../../../config/inc_user2projects.php';
return file_exists($sFile)
? require $sFile
: []
;
}
private function _getUser2Roles(){
return require(__DIR__ . '/../../../config/inc_user2roles.php');
$sFile=__DIR__ . '/../../../config/inc_user2roles.php';
return file_exists($sFile)
? require $sFile
: ['admin'=>['admin']]
;
}
/**
* TODO: reimplement
......
......@@ -23,6 +23,10 @@ ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once("./classes/page.class.php");
// detect first run
$bFirstRun=!file_exists("../../config/config_custom.php") || !file_exists("../../config/inc_user2roles.php");
require_once("../../config/inc_projects_config.php");
require_once("./classes/logger.class.php");
require_once("./classes/user.class.php");
......@@ -52,7 +56,10 @@ $oCLog->add("parsing params "
. '<pre>aParams: '.print_r($aParams, true).'</pre>'
);
if($bFirstRun){
$sAction='installer';
}
// ------ Ausgabe
$sHeader = '<style>';
foreach ($aConfig["phases"] as $sPhase => $aData) {
......
<?php
/* ######################################################################
IML DEPLOYMENT
INSTALLER
---------------------------------------------------------------------
2022-07-25 Axel <axel.hahn@iml.unibe.ch>
###################################################################### */
require_once("./inc_functions.php");
$sOut = ''
.'
<h2>Welcome to the IML CI SERVER!</h2>
<p>
This page appears on the first run. Or better: as long no configuration exists.<br>
<br>
<br>
Go to the directory <code>'.dirname($_SERVER['DOCUMENT_ROOT']).'/config/</code>.<br>
<br>
Copy 2 <code>*.dist</code> files <code>config_custom.php</code> and <code>inc_user2roles.php</code>.<br>
<br>
<a href="?" class="btn btn-default">Reload</a><br>
<br>
</p>
<script>
window.setTimeout("location.reload()", 5000);
</script>
'
;
// -- Ausgabe
echo $sOut;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment