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

handle first run

parent e3273806
Branches
No related tags found
1 merge request!195534 add docker
This commit is part of merge request !19. Comments created here will be created in the context of that merge request.
<?php <?php
$aConfig = include('config_defaults.php');
if (file_exists('config_custom.php')){
$aConfig = array_replace_recursive( $aConfig = array_replace_recursive(
include('config_defaults.php'), $aConfig,
include('config_custom.php') include('config_custom.php')
) );
; }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// generate some vars // generate some vars
......
...@@ -46,6 +46,7 @@ return [ ...@@ -46,6 +46,7 @@ return [
"page_deploy", "page_deploy",
"page_doc", "page_doc",
"page_htmltest", "page_htmltest",
"page_installer",
"page_phase", "page_phase",
"page_setup", "page_setup",
"page_checkssh", "page_checkssh",
......
...@@ -72,11 +72,19 @@ class user { ...@@ -72,11 +72,19 @@ class user {
// UNUSED SO FAR // UNUSED SO FAR
private function _getUser2Projects(){ 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(){ 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 * TODO: reimplement
......
...@@ -23,6 +23,10 @@ ini_set('display_startup_errors', 1); ...@@ -23,6 +23,10 @@ ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
require_once("./classes/page.class.php"); 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("../../config/inc_projects_config.php");
require_once("./classes/logger.class.php"); require_once("./classes/logger.class.php");
require_once("./classes/user.class.php"); require_once("./classes/user.class.php");
...@@ -52,6 +56,9 @@ $oCLog->add("parsing params " ...@@ -52,6 +56,9 @@ $oCLog->add("parsing params "
. '<pre>aParams: '.print_r($aParams, true).'</pre>' . '<pre>aParams: '.print_r($aParams, true).'</pre>'
); );
if($bFirstRun){
$sAction='installer';
}
// ------ Ausgabe // ------ Ausgabe
$sHeader = '<style>'; $sHeader = '<style>';
......
<?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