diff --git a/public_html/deployment/.htaccess b/public_html/deployment/.htaccess index b309715fa0c44428a9455be739ac4fff07cd5112..270fd26055cc845290eda5eadedfd24d1ab70ba3 100644 --- a/public_html/deployment/.htaccess +++ b/public_html/deployment/.htaccess @@ -1,10 +1,20 @@ RewriteEngine on # parse htm files -RewriteRule ^(.*)\.htm$ /deployment/shared/parse.php [PT,QSA] +# RewriteRule ^(.*)\.htm$ /deployment/shared/parse.php [PT,QSA] # rewrite bootstrap-ressources -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule /(css|js|img)/(.*)$ /deployment/gfranko-Document-Bootstrap-cf0730d/$1/$2 +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteCond %{REQUEST_FILENAME} !-d +# RewriteRule /(css|js|img)/(.*)$ /deployment/gfranko-Document-Bootstrap-cf0730d/$1/$2 # RewriteRule /(css|js|img)/(.*)$ /deployment-gui/bootstrap/$1/$2 + +RewriteBase /deployment +RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?prj=$1 +RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?prj=$1 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?prj=$1&action=$2 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?prj=$1&action=$2 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?prj=$1&action=$2&par3=$3 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?prj=$1&action=$2&par3=$3 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?prj=$1&action=$2&par3=$3&par4=$4 +RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?prj=$1&action=$2&par3=$3&par4=$4 diff --git a/public_html/deployment/act_accept.php b/public_html/deployment/act_accept.php new file mode 100644 index 0000000000000000000000000000000000000000..c7c6feb5c22114434a122e51076026734676aa3a --- /dev/null +++ b/public_html/deployment/act_accept.php @@ -0,0 +1,54 @@ +<?php + +require_once("./config/inc_projects_config.php"); +require_once("./classes/project.class.php"); + + +// --- Checks +$oPrj=new project($aParams["prj"]); + +if (array_key_exists("par3", $aParams)){ + $sPhase=$aParams["par3"]; +} + + +$sOut='<h1>Accept :: '.$oPrj->getLabel().' - '.$sPhase.'</h1><hr>'; +if (array_key_exists("confirm", $aParams)) { + $sOut.=$oPrj->accept($sPhase); + +} else { + + if (!$sPhase){ + $sOut.='ERROR: no Phase.'; + } else { + $aPhaseData=$oPrj->getPhaseInfos($sPhase); + + $sOut.=' + <p> + auf dem Server installiert:<br> + <pre>'.print_r($aPhaseData["depoyed"], true).'</pre> + </p> + '; + + if (!$oPrj->canAcceptPhase($sPhase)){ + $sOut.="ERROR: the phase $sPhase cannot be accepted."; + } else { + // Eingabe Kommentare zum Deployment + $sOut.=' + + <form action="?" method="post" enctype="multipart/form-data"> + <input type="hidden" name="confirm" value="1"> + <input type="submit" class="btn btn-primary" value="Deploy"> + </form> + '; + } + } +} + + +$sOut.=aHome(); + + +// -- Ausgabe +$sPhpOut=$sOut; +?> diff --git a/public_html/deployment/act_build.php b/public_html/deployment/act_build.php new file mode 100644 index 0000000000000000000000000000000000000000..9703fd8c020e31adebfb4f4c95da739407b514d3 --- /dev/null +++ b/public_html/deployment/act_build.php @@ -0,0 +1,43 @@ +<?php + +require_once("./config/inc_projects_config.php"); +require_once("./classes/project.class.php"); +require_once("./classes/formgen.class.php"); + + +// --- Checks +$oPrj=new project($aParams["prj"]); + + +$sOut='<h1>Build :: '.$oPrj->getLabel().'</h1><hr>'; + +if (array_key_exists("confirm", $aParams)) { + $sOut.=$oPrj->build(); +} else { + $sNext=$oPrj->getNextPhase(); + $sOut.=' + <p> + Es wird ein neues Paket erstellt und fü die Phase <em class="'.$sNext.'">'.$sNext.'</em> bereitgestellt.<br> + </p> + '; + + // Eingabe Kommentare zum Deployment + $sOut.=' + <hr> + <form action="?" method="post" enctype="multipart/form-data"> + <input type="hidden" name="confirm" value="1"> + <!-- ' . enterDeployinfos() . ' + <hr> + --> + <input type="submit" class="btn btn-primary" value="Paket für ['.$sNext.'] erstellen"> + </form> + '; +} + + +$sOut.=aHome(); + + +// -- Ausgabe +$sPhpOut=$sOut; +?> diff --git a/public_html/deployment/act_deploy.php b/public_html/deployment/act_deploy.php new file mode 100644 index 0000000000000000000000000000000000000000..04e41252a07c224da39ab304e13be93f1609fbb3 --- /dev/null +++ b/public_html/deployment/act_deploy.php @@ -0,0 +1,51 @@ +<?php + +require_once("./config/inc_projects_config.php"); +require_once("./classes/project.class.php"); + + +// --- Checks +$oPrj=new project($aParams["prj"]); + + +$sOut='<h1>Deploy :: '.$oPrj->getLabel().'</h1><hr>'; +if (array_key_exists("par3", $aParams)){ + $sPhase=$aParams["par3"]; +} + + +if (array_key_exists("confirm", $aParams)) { + $sOut.=$oPrj->deploy($sPhase); +} else { + if ($sPhase){ + $sPhase=$aParams["par3"]; + + $aPhaseData=$oPrj->getPhaseInfos($sPhase); + + $sOut.=' + <p> + in der Queue:<br> + <pre>'.print_r($aPhaseData["onhold"], true).'</pre> + </p> + '; + + // Eingabe Kommentare zum Deployment + $sOut.=' + + <form action="?" method="post" enctype="multipart/form-data"> + <input type="hidden" name="confirm" value="1"> + <input type="submit" class="btn btn-primary" value="Deploy"> + </form> + '; + } else { + $sOut.='ERROR: missing name of the phase.'; + } +} + + +$sOut.=aHome(); + + +// -- Ausgabe +$sPhpOut=$sOut; +?> diff --git a/public_html/deployment/act_doc.php b/public_html/deployment/act_doc.php new file mode 100644 index 0000000000000000000000000000000000000000..91c30af28c7f36e84d1ea95587f122dd47357c0a --- /dev/null +++ b/public_html/deployment/act_doc.php @@ -0,0 +1,21 @@ +<?php + +require_once("./classes/classinfos.class.php"); +$aClasses=array( + "project"=>"project", + "projectlist"=>"projectlist", + ); +$sClass=$sPrj; + +$sPhpOut=''; +foreach ($aClasses as $sClassfile=>$sName){ + + $sPhpOut.='<a href="/deployment/'.$sClassfile.'/doc/">'.$sClassfile.'</a> | '; +} +$sPhpOut.='<hr>'; + +require_once("./classes/$sClass.class.php"); +$o=new classinfos($sPrj); +$sPhpOut.=$o->render(); +?> + diff --git a/public_html/deployment/act_overview.php b/public_html/deployment/act_overview.php new file mode 100644 index 0000000000000000000000000000000000000000..12c2ce90801a6cf99f3e18eba774ee4349f0a702 --- /dev/null +++ b/public_html/deployment/act_overview.php @@ -0,0 +1,11 @@ +<?php + +require_once("./config/inc_projects_config.php"); +require_once("./classes/projectlist.class.php"); + +$oPrjList=new projectlist($aProjects); +// $oPrjList->setConfig($aProjects); +$sPhpOut='<h1>Overview</h1>'.$oPrjList->renderOverview(); + +?> + diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT b/public_html/deployment/bootstrap/LICENSE-MIT similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT rename to public_html/deployment/bootstrap/LICENSE-MIT diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/README.markdown b/public_html/deployment/bootstrap/README.markdown similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/README.markdown rename to public_html/deployment/bootstrap/README.markdown diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css b/public_html/deployment/bootstrap/css/bootstrap.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css rename to public_html/deployment/bootstrap/css/bootstrap.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css b/public_html/deployment/bootstrap/css/bootstrap.min.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css rename to public_html/deployment/bootstrap/css/bootstrap.min.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/docs.css b/public_html/deployment/bootstrap/css/docs.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/docs.css rename to public_html/deployment/bootstrap/css/docs.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css b/public_html/deployment/bootstrap/css/jquery.tocify.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css rename to public_html/deployment/bootstrap/css/jquery.tocify.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css b/public_html/deployment/bootstrap/css/jquery.ui.all.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css rename to public_html/deployment/bootstrap/css/jquery.ui.all.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/prettify.css b/public_html/deployment/bootstrap/css/prettify.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/prettify.css rename to public_html/deployment/bootstrap/css/prettify.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/styles.css b/public_html/deployment/bootstrap/css/styles.css similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/styles.css rename to public_html/deployment/bootstrap/css/styles.css diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/customDownload.html b/public_html/deployment/bootstrap/customDownload.html similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/customDownload.html rename to public_html/deployment/bootstrap/customDownload.html diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/documentation.html b/public_html/deployment/bootstrap/documentation.html similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/documentation.html rename to public_html/deployment/bootstrap/documentation.html diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png b/public_html/deployment/bootstrap/img/glyphicons-halflings-white.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png rename to public_html/deployment/bootstrap/img/glyphicons-halflings-white.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png b/public_html/deployment/bootstrap/img/glyphicons-halflings.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png rename to public_html/deployment/bootstrap/img/glyphicons-halflings.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png b/public_html/deployment/bootstrap/img/jqueryUIEffects.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png rename to public_html/deployment/bootstrap/img/jqueryUIEffects.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/themeroller.png b/public_html/deployment/bootstrap/img/themeroller.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/themeroller.png rename to public_html/deployment/bootstrap/img/themeroller.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png b/public_html/deployment/bootstrap/img/ui-bg_diagonals-thick_8_333333_40x40.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png rename to public_html/deployment/bootstrap/img/ui-bg_diagonals-thick_8_333333_40x40.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png b/public_html/deployment/bootstrap/img/ui-bg_flat_65_ffffff_40x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png rename to public_html/deployment/bootstrap/img/ui-bg_flat_65_ffffff_40x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png b/public_html/deployment/bootstrap/img/ui-bg_glass_40_111111_1x400.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png rename to public_html/deployment/bootstrap/img/ui-bg_glass_40_111111_1x400.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png b/public_html/deployment/bootstrap/img/ui-bg_glass_55_1c1c1c_1x400.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png rename to public_html/deployment/bootstrap/img/ui-bg_glass_55_1c1c1c_1x400.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png b/public_html/deployment/bootstrap/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png rename to public_html/deployment/bootstrap/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png b/public_html/deployment/bootstrap/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png rename to public_html/deployment/bootstrap/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png b/public_html/deployment/bootstrap/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png rename to public_html/deployment/bootstrap/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png b/public_html/deployment/bootstrap/img/ui-bg_inset-hard_45_cd0a0a_1x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png rename to public_html/deployment/bootstrap/img/ui-bg_inset-hard_45_cd0a0a_1x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png b/public_html/deployment/bootstrap/img/ui-bg_inset-hard_55_ffeb80_1x100.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png rename to public_html/deployment/bootstrap/img/ui-bg_inset-hard_55_ffeb80_1x100.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_222222_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_222222_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_4ca300_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_4ca300_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_bbbbbb_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_bbbbbb_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_ededed_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_ededed_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_ffcf29_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_ffcf29_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png b/public_html/deployment/bootstrap/img/ui-icons_ffffff_256x240.png similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png rename to public_html/deployment/bootstrap/img/ui-icons_ffffff_256x240.png diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG b/public_html/deployment/bootstrap/img/widgetFactory.PNG similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG rename to public_html/deployment/bootstrap/img/widgetFactory.PNG diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js b/public_html/deployment/bootstrap/js/DownloadBuilder.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js rename to public_html/deployment/bootstrap/js/DownloadBuilder.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/base64.js b/public_html/deployment/bootstrap/js/base64.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/base64.js rename to public_html/deployment/bootstrap/js/base64.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js b/public_html/deployment/bootstrap/js/bootstrap.min.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js rename to public_html/deployment/bootstrap/js/bootstrap.min.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js b/public_html/deployment/bootstrap/js/githubrepo.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js rename to public_html/deployment/bootstrap/js/githubrepo.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/history.js b/public_html/deployment/bootstrap/js/history.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/history.js rename to public_html/deployment/bootstrap/js/history.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js b/public_html/deployment/bootstrap/js/jquery-1.8.0.min.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js rename to public_html/deployment/bootstrap/js/jquery-1.8.0.min.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js b/public_html/deployment/bootstrap/js/jquery-ui-1.8.23.custom.min.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js rename to public_html/deployment/bootstrap/js/jquery-ui-1.8.23.custom.min.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js b/public_html/deployment/bootstrap/js/jquery.tocify.min.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js rename to public_html/deployment/bootstrap/js/jquery.tocify.min.js diff --git a/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/prettify.js b/public_html/deployment/bootstrap/js/prettify.js similarity index 100% rename from public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/prettify.js rename to public_html/deployment/bootstrap/js/prettify.js diff --git a/public_html/deployment/shared/default.tpl.html b/public_html/deployment/classes/html.tpl.php similarity index 50% rename from public_html/deployment/shared/default.tpl.html rename to public_html/deployment/classes/html.tpl.php index 8689f0bcc5d65f38f31a367f55f6e9203a488737..47bbe2e0d6d1c6d63270acb878fbe63b33f450b2 100644 --- a/public_html/deployment/shared/default.tpl.html +++ b/public_html/deployment/classes/html.tpl.php @@ -1,10 +1,6 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - - - <title>[[SITE]] :: [[TITLE]]</title> - <script src="functions.js"></script> +<!doctype html> +<html> + <head> <meta name="robots" content="noindex,nofollow" /> <meta charset="utf-8"> @@ -17,23 +13,12 @@ --> <!-- Le styles --> - <link href="css/bootstrap.css" rel="stylesheet"> + <link href="/deployment/bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/black-tie/jquery-ui.css" rel="stylesheet"> - <link href="css/jquery.tocify.css" rel="stylesheet"> - <link href="css/prettify.css" type="text/css" rel="stylesheet" /> - <link href="css/styles.css" type="text/css" rel="stylesheet" /> - - <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> - <!--[if lt IE 9]> - <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - - <!-- Le fav and touch icons --> - <link rel="shortcut icon" href="../assets/ico/favicon.ico"> - <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png"> - <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png"> - <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png"> - <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png"> + <link href="/deployment/bootstrap/css/jquery.tocify.css" rel="stylesheet"> + <link href="/deployment/bootstrap/css/prettify.css" type="text/css" rel="stylesheet" /> + <link href="/deployment/bootstrap/css/styles.css" type="text/css" rel="stylesheet" /> + <style> @media (max-width: 767px) { @@ -48,7 +33,13 @@ body, label, input, button, select, textarea, p, .btn { font-size: 12px; } - + #header{ + background:#eee; background: linear-gradient(#fff,#eee); + padding: 1em; font-size: 300%; + color:#a33; + text-shadow: 1px 1px 0 #fff, 10px 10px 10px #aaa; + border-bottom: 2px solid #ccc; + } h2{font-size: 16px; margin: 0;} h3{font-size: 14px; margin: 0;} @@ -106,79 +97,42 @@ </style> - </head> - - <body> - - <div class="navbar navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container-fluid"> - <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </a> - <a class="brand" href="index.htm">[[SITE]]</a> - - <div class="nav-collapse"> - <ul class="nav"> - - [[NAVI1]] - </ul> - </div><!--/.nav-collapse --> - </div> - </div> - </div> - - <div class="container-fluid"> - <div class="row-fluid"> - <div class="span12"> - - <noscript> - <div class="alert" > - <button type="button" class="close" data-dismiss="alert">×</button> - <span> - JAVASCRIPT erforderlich!<br> - Dieser klickbare Prototyp benötigt aktiviertes Javascript. - Aktivieren Sie Javascript und Laden Sie die Seite neu. - </span> - </div> - </noscript> - + + <!-- + <meta name="robots" content="noindex, nofollow" /> + + + <style type="text/css" title="currentStyle"> + @import "/shared/js/datatables/media/css/demo_page.css"; + @import "/shared/js/datatables/media/css/demo_table.css"; + </style> + + <script type="text/javascript" src="/shared/js/jquery.js"></script> + <script type="text/javascript" src="/shared/js/datatables/media/js/jquery.dataTables.min.js"></script> + + <link rel="stylesheet" type="text/css" href="main.css" media="screen"> + <script type="text/javascript" src="main.js"></script> + --> + {{HEADER}} + + + </head> + <body> + + <div id="divcontent"> + + {{CONTENT}} + + </div> + {{FOOTER}}{{JSONREADY}} - <br> - - <div id="msgBoxOnTop" class="alert" style="display: none;"> - <button type="button" class="close" data-dismiss="alert">×</button> - <span> - Hier kommt eine Meldung rein. - </span> - </div> - - [[CONTENT]] - - - </div> - - <br /> - - </div><!--/row--> - <div class="footerbar" style=""> - <p> - [[FOOTER]] - </p> - </div> - </div><!--/.fluid-container--> - - <!-- Le javascript - ================================================== --> <!-- Placed at the end of the document so the pages load faster --> - <script src="js/jquery-1.8.0.min.js"></script> - <script src="js/jquery-ui-1.8.23.custom.min.js"></script> - <script src="js/bootstrap.min.js"></script> - <script src="js/history.js"></script> - <script src="js/jquery.tocify.min.js"></script> - <script src="js/prettify.js"></script> + <script src="/deployment/bootstrap/js/jquery-1.8.0.min.js"></script> + <script src="/deployment/bootstrap/js/jquery-ui-1.8.23.custom.min.js"></script> + <script src="/deployment/bootstrap/js/bootstrap.min.js"></script> + <script src="/deployment/bootstrap/js/history.js"></script> + <script src="/deployment/bootstrap/js/jquery.tocify.min.js"></script> + <script src="/deployment/bootstrap/js/prettify.js"></script> <!-- <script src="js/githubrepo.js"></script> --> <script> $(function() { @@ -201,6 +155,7 @@ </script> - - </body> -</html> \ No newline at end of file + + </body> +</html> + diff --git a/public_html/deployment/classes/page.class.php b/public_html/deployment/classes/page.class.php new file mode 100644 index 0000000000000000000000000000000000000000..18e750c124900b2adefccd6f8018f19157768524 --- /dev/null +++ b/public_html/deployment/classes/page.class.php @@ -0,0 +1,209 @@ +<?php + +/** + * PIMPED APACHE-STATUS + * Page class + * Render output page by replacing placeholders + * + * @package pimped_apache_status + * @author Axel Hahn + */ +class Page { + + /** + * output type of content + * @var array + */ + private $sType = 'html'; + + /** + * array of strings for http response header + * @var array + */ + private $aResponseHeader = array(); + + /** + * Replacements in the template + * @var array + */ + private $aReplace = array( + '{{HEADER}}' => '', + '{{CONTENT}}' => '', + '{{FOOTER}}' => '', + '{{JSONREADY}}' => '', + ); + + /** + * constructor (it does nothing) + * @return boolean (true) + */ + public function __construct() { + $this->setOutputtype(); + return true; + } + + /** + * wrap on document ready instructions in jQuery style + * @return type + */ + private function _finalizeJsOnReady() { + return $this->aReplace["{{JSONREADY}}"] = ' + <script> + $(document).ready(function() { + ' . $this->aReplace["{{JSONREADY}}"] . ' + } ); + </script>'; + } + + // ---------------------------------------------------------------------- + // GETTER + // ---------------------------------------------------------------------- + + /** + * get current page content + * @return string + */ + public function getContent() { + return $this->aReplace['{{CONTENT}}']; + } + + /** + * get current footer + * @return type + */ + public function getFooter() { + return $this->aReplace['{{FOOTER}}']; + } + + /** + * get current header in response body + * @return type + */ + public function getHeader() { + return $this->aReplace['{{HEADER}}']; + } + + /** + * get on ready javascript instructions + * @return type¨ + */ + public function getJsOnReady() { + return $this->aReplace['{{JSONREADY}}']; + } + + + /** + * get output type + * @return string + */ + public function getOutputtype() { + return $this->sType; + } + + // ---------------------------------------------------------------------- + // SETTER + // ---------------------------------------------------------------------- + + /** + * add javascript for on ready execution + * @param string $s javascript code + * @return boolean + */ + public function addJsOnReady($s) { + return $this->aReplace['{{JSONREADY}}'] .= $s; + } + + /** + * add a http response header line + * @param string $s + * @return boolean + */ + public function addResponseHeader($s) { + return $this->aResponseHeader[] = $s; + } + + /** + * set html body; it replaces old content + * @param string $s html code + * @return boolean + */ + public function setContent($s) { + return $this->aReplace['{{CONTENT}}'] = $s; + } + /** + * set footer in html body; it replaces old content + * @param string $s html code + * @return boolean + */ + public function setFooter($s) { + return $this->aReplace['{{FOOTER}}'] = $s; + } + + /** + * set html header; it replaces old content + * @param string $s html code + * @return boolean + */ + public function setHeader($s) { + return $this->aReplace['{{HEADER}}'] = $s; + } + + /** + * set javascript code on ready; it replaces old content + * @param string $s javascript code + * @return boolean + */ + public function setJsOnReady($s) { + return $this->aReplace['{{JSONREADY}}'] = $s; + } + + /** + * set output type of response + * @param string $sOutputType + * @return boolean + */ + public function setOutputtype($sOutputType = 'html') { + return $this->sType = $sOutputType; + } + + + + // ---------------------------------------------------------------------- + // OUTPUT + // ---------------------------------------------------------------------- + + /** + * send http reponse headers and built the response body + * @return type + */ + public function render() { + $aS = array(); // search + $aR = array(); // replace + + $this->_finalizeJsOnReady(); + + foreach ($this->aReplace as $sSeach => $sReplace) { + $aS[] = $sSeach; + $aR[] = $sReplace; + } + + $sTemplate = false; + $sTplFile = dirname(__FILE__) . "/" . $this->sType . ".tpl.php"; + if (!file_exists($sTplFile)) { + die("ERROR: template for type " . $this->sType . " was not found: $sTplFile"); + } + + $sTemplate = file_get_contents($sTplFile); + if (!$sTemplate) { + die("ERROR: template file $sTplFile is empty or could not be read."); + } + + foreach ($this->aResponseHeader as $sHeader) { + header($sHeader); + } + return str_replace($aS, $aR, $sTemplate); + } + +} + +?> diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index e87376fd8cb967e42b6ef1b97559c302202dc5fe..515d5e25d5de8ae686c022c699994191a70eeb07 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -4,45 +4,45 @@ * class for single project */ class project { - // ---------------------------------------------------------------------- // CONFIG // ---------------------------------------------------------------------- - + /** * config file * @var type */ - private $_sCfgfile="../config/inc_projects_config.php"; + private $_sCfgfile = "../config/inc_projects_config.php"; /** * configuration ($aConfig in the config file) * @var array */ private $_aConfig = array(); - + /** * configuration of the project (= $aProjects[ID] in the config file) * @var array */ private $_aPrjConfig = array(); - + /** * version infos of all phases * @var type */ private $_aData = array(); - + /** * places of version infos in each deployment phase * @var type */ - private $_aPlaces=array( - "onhold"=>"Queue", - "ready4deployment"=>"Repo", - "deployed"=>"Installiert", + private $_aPlaces = array( + "onhold" => "Queue", + "ready4deployment" => "Repo", + "deployed" => "Installiert", ); - + private $_iRcAll = 0; + // ---------------------------------------------------------------------- // constructor // ---------------------------------------------------------------------- @@ -67,7 +67,7 @@ class project { * @return boolean */ private function _readConfig() { - require($this->_sCfgfile); + require(__dir__ . '/' . $this->_sCfgfile); $this->_aConfig = $aConfig; return true; } @@ -79,7 +79,7 @@ class project { private function _verifyConfig() { if (!count($this->_aPrjConfig)) die("ERROR::CONFIG: no config was for found the project. check $aProjects in config file."); - + if (!array_key_exists("packageDir", $this->_aConfig)) die("ERROR::CONFIG: packagedir is not defined."); if (!$this->_aConfig["packageDir"]) @@ -93,10 +93,10 @@ class project { die("ERROR::CONFIG: archiveDir is not set."); if (!file_exists($this->_aConfig["archiveDir"])) die("ERROR::CONFIG: archiveDir does not exist: "" . $this->_aConfig['archiveDir'] . ""."); - + if (!array_key_exists("phases", $this->_aPrjConfig)) die("ERROR::CONFIG: key "phases" was not found in config.<br><pre>" . print_r($this->_aPrjConfig, true) . "</pre>"); - + // TODO: verify ausbauen return true; } @@ -106,24 +106,25 @@ class project { * @param string $sCommand * @return string */ - private function _execAndSend($sCommand){ - $sReturn=''; - $bUseHtml=$_SERVER?true:false; + private function _execAndSend($sCommand) { + $sReturn = ''; + $bUseHtml = $_SERVER ? true : false; - ob_implicit_flush(true);ob_end_flush(); + ob_implicit_flush(true); + // ob_end_flush(); $descriptorspec = array( - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from - 1 => array("pipe", "w"), // stdout is a pipe that the child will write to - 2 => array("pipe", "w") // stderr is a pipe that the child will write to + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "w") // stderr is a pipe that the child will write to ); flush(); $process = proc_open($sCommand, $descriptorspec, $pipes, realpath('./'), array()); - $sReturn.="[".date("H:i:s d.m.Y")."] "; - $sReturn.=$bUseHtml?"<strong>$sCommand</strong>":"$sCommand"; - $sReturn.=$bUseHtml?"<br>":"\n"; + $sReturn.="[" . date("H:i:s d.m.Y") . "] "; + $sReturn.=$bUseHtml ? "<strong>$sCommand</strong>" : "$sCommand"; + $sReturn.=$bUseHtml ? "<br>" : "\n"; - $sErrors=false; + $sErrors = false; if (is_resource($process)) { while ($s = fgets($pipes[1])) { $sReturn.=$s; @@ -134,18 +135,21 @@ class project { flush(); } } - if ($sErrors)$sReturn.="STDERR:\n".$sErrors; + if ($sErrors) + $sReturn.="STDERR:\n" . $sErrors; $oStatus = proc_get_status($process); - $iRc=$oStatus['exitcode']; - $sReturn.="[".date("H:i:s d.m.Y")."] exitcode ".$iRc; - if ($bUseHtml){ - if ($iRc==0) { - $sReturn="<pre>".$sReturn; + $iRc = $oStatus['exitcode']; + $this->_iRcAll += $iRc; + $sReturn.="[" . date("H:i:s d.m.Y") . "] exitcode " . $iRc; + if ($bUseHtml) { + if ($iRc == 0) { + $sReturn = "<pre>" . $sReturn; } else { - $sReturn='<pre class="error">'.$sReturn; + $sReturn = '<pre class="error">' . $sReturn; } $sReturn.='</pre>'; } + flush(); return $sReturn; } @@ -153,72 +157,81 @@ class project { // ---------------------------------------------------------------------- // GETTER // ---------------------------------------------------------------------- - + /** * get a temp directory * @return string */ - private function _getTempDir(){ - $s=$this->_aConfig['workDir']."/build/".$this->_aPrjConfig["fileprefix"]."_".date("Ymd-His"); + private function _getTempDir() { + $s = $this->_aConfig['workDir'] . "/build/" . $this->_aPrjConfig["fileprefix"] . "_" . date("Ymd-His"); // TODO: auskommentieren - $s=$this->_aConfig['workDir']."/build/".$this->_aPrjConfig["fileprefix"]."_temp"; + $s = $this->_aConfig['workDir'] . "/build/" . $this->_aPrjConfig["fileprefix"] . "_temp"; return $s; } + /** - * get base of filename for infofile and package (without extension) + * get directory for infofile and package (without extension) * @param string $sPhase one of preview|stage|live ... * @param string $sPlace one of onhold|ready4deployment|deployed * @return string */ - private function _getFileBase($sPhase, $sPlace){ - if (!array_key_exists($sPhase, $this->_aConfig["phases"])){ + private function _getFileBase($sPhase, $sPlace) { + if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { die("ERROR: _getFileBase - this phase does not exist: $sPhase."); } - if (!array_key_exists($sPlace, $this->_aPlaces)){ + if (!array_key_exists($sPlace, $this->_aPlaces)) { die("ERROR: _getFileBase - this place does not exist: $sPhase."); } - - + + // local file for onhold|ready4deployment - $sBase=$this->_aConfig['packageDir']."/".$sPhase."/".$this->_aPrjConfig["fileprefix"]; - - if ($sPlace=="onhold") $sBase.="_onhold"; - + $sBase = $this->_aConfig['packageDir'] . "/" . $sPhase . "/" . $this->_aPrjConfig["fileprefix"]; + + if ($sPlace == "onhold") + $sBase.="_onhold"; + // $sBase .= "/" . $this->_aPrjConfig["fileprefix"]; + // url for deployed - if ($sPlace=="deployed"){ - if ($this->isActivePhase($sPhase) && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])){ - $sBase=$this->_aPrjConfig["phases"][$sPhase]["url"].$this->_aPrjConfig["fileprefix"]; + if ($sPlace == "deployed") { + if ($this->isActivePhase($sPhase) && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])) { + $sBase = $this->_aPrjConfig["phases"][$sPhase]["url"] . $this->_aPrjConfig["fileprefix"]; } else { - $sBase=''; + $sBase = ''; } } - + return $sBase; } - - + /** * get filename for info file * @param string $sPhase one of preview|stage|live ... * @param string $sPlace one of onhold|ready4deployment|deployed * @return string */ - private function _getInfofile($sPhase, $sPlace){ - $sBase=$this->_getFileBase($sPhase, $sPlace); - return $sBase?$sBase.".json":false; + private function _getInfofile($sPhase, $sPlace) { + $sBase = $this->_getFileBase($sPhase, $sPlace); + return $sBase ? $sBase .'/'.$this->_aPrjConfig["fileprefix"] . '.json' : false; } - + /** * get filename for package file * @param string $sPhase one of preview|stage|live ... * @param string $sPlace one of onhold|ready4deployment|deployed * @return string */ - private function _getPackagefile($sPhase, $sPlace){ - $sBase=$this->_getFileBase($sPhase, $sPlace); - return $sBase?$sBase.".tgz":false; + private function _getPackagefile($sPhase, $sPlace) { + $sBase = $this->_getFileBase($sPhase, $sPlace); + return $sBase ? $sBase .'/'.$this->_aPrjConfig["fileprefix"] . '.tgz' : false; } - + + private function _getArchiveDir($sTimestamp) { + if (!$sTimestamp) { + die("ERROR: getArchiveDir timestamp is required"); + } + return $this->_aConfig["archiveDir"] . '/' . $this->_aConfig["id"] . '/' . $sTimestamp; + } + /** * get conmplete config of the project * @return array @@ -247,96 +260,97 @@ class project { * get deploy and queue infos for all phases * @return type */ - public function getAllPhaseInfos(){ - if (!array_key_exists("phases", $this->_aData)) $this->_aData["phases"]=array(); - - foreach(array_keys($this->_aConfig["phases"]) as $sPhase){ - if (!array_key_exists($sPhase, $this->_aData["phases"])){ + public function getAllPhaseInfos() { + if (!array_key_exists("phases", $this->_aData)) + $this->_aData["phases"] = array(); + + foreach (array_keys($this->_aConfig["phases"]) as $sPhase) { + if (!array_key_exists($sPhase, $this->_aData["phases"])) { $this->getPhaseInfos($sPhase); } } return $this->_aData["phases"]; } - /** * get statusinfos of a named phase * @param string $sPhase name of the phase; one of preview|stage|live * @return array */ public function getPhaseInfos($sPhase) { - if (!array_key_exists("phases", $this->_aData)) $this->_aData["phases"]=array(); - - if (!array_key_exists($sPhase, $this->_aData["phases"])){ + if (!array_key_exists("phases", $this->_aData)) + $this->_aData["phases"] = array(); + + if (!array_key_exists($sPhase, $this->_aData["phases"])) { + + $this->_aData["phases"][$sPhase] = array(); + $aTmp = array(); - $this->_aData["phases"][$sPhase]=array(); - $aTmp=array(); - // a blocked package is waiting for deployment timeslot? - $sKey="onhold"; - $sJsonfile=$this->_getInfofile($sPhase, $sKey); - $aTmp[$sKey]=array(); - if (file_exists($sJsonfile)){ - $aJson=json_decode(file_get_contents($sJsonfile), true); - if (array_key_exists("timestamp", $aJson)){ - $aTmp[$sKey]=json_decode(file_get_contents($sJsonfile), true); - $aTmp[$sKey]["infofile"]=$sJsonfile; + $sKey = "onhold"; + $sJsonfile = $this->_getInfofile($sPhase, $sKey); + $aTmp[$sKey] = array(); + if (file_exists($sJsonfile)) { + $aJson = json_decode(file_get_contents($sJsonfile), true); + if (array_key_exists("timestamp", $aJson)) { + $aTmp[$sKey] = json_decode(file_get_contents($sJsonfile), true); + $aTmp[$sKey]["infofile"] = $sJsonfile; + $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"]="info file $sJsonfile exists but is corrupt (no timestamp)." . print_r($aJson, true); + $aTmp[$sKey]["error"] = "info file $sJsonfile exists but is corrupt (no timestamp)." . print_r($aJson, true); } } else { - $aTmp[$sKey]["info"]="No package is wainting in the queue."; - $aTmp[$sKey]["ok"]=1; + $aTmp[$sKey]["info"] = "No package is waiting in the queue."; + $aTmp[$sKey]["ok"] = 1; } - + // package for puppet - $sKey="ready4deployment"; - $sJsonfile=$this->_getInfofile($sPhase, $sKey); - $aTmp[$sKey]=array(); - if (file_exists($sJsonfile)){ - $sPkgfile=$this->_getPackagefile($sPhase, $sKey); - if (file_exists($sPkgfile)){ - $aJson=json_decode(file_get_contents($sJsonfile), true); - if (array_key_exists("timestamp", $aJson)){ - $aTmp[$sKey]=json_decode(file_get_contents($sJsonfile), true); - $aTmp[$sKey]["infofile"]=$sJsonfile; - $aTmp[$sKey]["packagefile"]=$sPkgfile; - $aTmp[$sKey]["ok"]=1; + $sKey = "ready4deployment"; + $sJsonfile = $this->_getInfofile($sPhase, $sKey); + $aTmp[$sKey] = array(); + if (file_exists($sJsonfile)) { + $sPkgfile = $this->_getPackagefile($sPhase, $sKey); + if (file_exists($sPkgfile)) { + $aJson = json_decode(file_get_contents($sJsonfile), true); + if (array_key_exists("timestamp", $aJson)) { + $aTmp[$sKey] = json_decode(file_get_contents($sJsonfile), true); + $aTmp[$sKey]["infofile"] = $sJsonfile; + $aTmp[$sKey]["packagefile"] = $sPkgfile; + $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"]="info file $sJsonfile exists but is corrupt (no timestamp)." . print_r($aJson, true); + $aTmp[$sKey]["error"] = "info file $sJsonfile exists but is corrupt (no timestamp)." . print_r($aJson, true); } } else { - $aTmp[$sKey]["error"]="package file was not found: $sPkgfile"; - } + $aTmp[$sKey]["error"] = "package file was not found: $sPkgfile"; + } } else { - $aTmp[$sKey]["error"]="info file was not found: $sJsonfile"; + $aTmp[$sKey]["error"] = "info file was not found: $sJsonfile"; } // published data - $sKey="deployed"; - $sJsonfile=$this->_getInfofile($sPhase, $sKey); - $aTmp[$sKey]=array(); - if ($this->isActivePhase($sPhase)){ - $sJsonUrl=$this->_aPrjConfig["phases"][$sPhase]["url"].$this->_aPrjConfig["fileprefix"].".json"; - $sJsonData=@file_get_contents($sJsonUrl); - if ($sJsonData){ - $aJson=json_decode($sJsonData, true); - if (array_key_exists("timestamp", $aJson)){ - $aTmp[$sKey]=$aJson; - $aTmp[$sKey]["infofile"]=$sJsonUrl; - $aTmp[$sKey]["ok"]=1; + $sKey = "deployed"; + $sJsonfile = $this->_getInfofile($sPhase, $sKey); + $aTmp[$sKey] = array(); + if ($this->isActivePhase($sPhase)) { + $sJsonUrl = $this->_aPrjConfig["phases"][$sPhase]["url"] . $this->_aPrjConfig["fileprefix"] . ".json"; + $sJsonData = @file_get_contents($sJsonUrl); + if ($sJsonData) { + $aJson = json_decode($sJsonData, true); + if (array_key_exists("timestamp", $aJson)) { + $aTmp[$sKey] = $aJson; + $aTmp[$sKey]["infofile"] = $sJsonUrl; + $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"]="json url was readable <a href=$sJsonUrl>$sJsonUrl</a> but is corrupt (no timestamp)." . print_r($aJson, true); + $aTmp[$sKey]["error"] = "json url was readable <a href=$sJsonUrl>$sJsonUrl</a> but is corrupt (no timestamp)." . print_r($aJson, true); } } else { - $aTmp[$sKey]["error"]="json url not readable <a href=$sJsonUrl>$sJsonUrl</a>"; + $aTmp[$sKey]["error"] = "json url not readable <a href=$sJsonUrl>$sJsonUrl</a>"; } } else { - $aTmp[$sKey]["warning"]="this phase is not active or has no url"; + $aTmp[$sKey]["warning"] = "this phase is not active or has no url"; } - - $this->_aData["phases"][$sPhase]=$aTmp; - + + $this->_aData["phases"][$sPhase] = $aTmp; } return $this->_aData["phases"][$sPhase]; } @@ -346,80 +360,73 @@ class project { * @param type $sPhase * @return type */ - public function isActivePhase($sPhase){ + public function isActivePhase($sPhase) { return ( - array_key_exists($sPhase, $this->_aPrjConfig["phases"]) - && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) - && $this->_aPrjConfig["phases"][$sPhase]["url"] - ); + array_key_exists($sPhase, $this->_aPrjConfig["phases"]) && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) && $this->_aPrjConfig["phases"][$sPhase]["url"] + ); } /** * find the next active phase of a project * @param string $sPhase current phase; if empty the function sends back the first phase */ - public function getNextPhase($sPhase=false){ - if ($sPhase){ - if (!array_key_exists($sPhase, $this->_aConfig["phases"])){ + public function getNextPhase($sPhase = false) { + if ($sPhase) { + if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { die("ERROR: this phase does not exist: $sPhase."); } } - - $sNextPhase=false; - $bUseNextPhase=$sPhase?false:true; - foreach(array_keys($this->_aConfig["phases"]) as $s){ - if ($bUseNextPhase){ - if ($this->isActivePhase($s)){ - $sNextPhase=$s; - $bUseNextPhase=false; + + $sNextPhase = false; + $bUseNextPhase = $sPhase ? false : true; + foreach (array_keys($this->_aConfig["phases"]) as $s) { + if ($bUseNextPhase) { + if ($this->isActivePhase($s)) { + $sNextPhase = $s; + $bUseNextPhase = false; continue; - } + } } - if ($sPhase==$s) { - $bUseNextPhase=true; + if ($sPhase == $s) { + $bUseNextPhase = true; } } - + return $sNextPhase; } - + /** * check: is the deployment to the next phase enabled for this phase? * @param type $sPhase */ - public function canDeploy($sPhase=false){ - - if (!$sPhase){ - $sNext=$this->getNextPhase($sPhase); - return $sNext>''; + public function canAcceptPhase($sPhase = false) { + + if (!$sPhase) { + $sNext = $this->getNextPhase($sPhase); + return $sNext > ''; } - - - if (!array_key_exists($sPhase, $this->_aConfig["phases"])){ + + + if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { die("ERROR: in canDeploy this phase does not exist: $sPhase."); } - if (!$this->isActivePhase($sPhase)){ + if (!$this->isActivePhase($sPhase)) { // die("ERROR: the phase $sPhase is not active in this project."); return false; } - $sNext=$this->getNextPhase($sPhase); - if (!$sNext) return false; - + $sNext = $this->getNextPhase($sPhase); + if (!$sNext) + return false; + // ensure that _aData is filled $this->getPhaseInfos($sPhase); - + // array key "ok" must be in the ready4deployment and deployed info if ( - array_key_exists($sPhase, $this->_aData["phases"]) - && array_key_exists("onhold", $this->_aData["phases"][$sPhase]) - && array_key_exists("ready4deployment", $this->_aData["phases"][$sPhase]) - && array_key_exists("deployed", $this->_aData["phases"][$sPhase]) - - && array_key_exists("ok", $this->_aData["phases"][$sPhase]["onhold"]) - && array_key_exists("ok", $this->_aData["phases"][$sPhase]["ready4deployment"]) - && array_key_exists("ok", $this->_aData["phases"][$sPhase]["deployed"]) - ) return true; - + array_key_exists($sPhase, $this->_aData["phases"]) && array_key_exists("onhold", $this->_aData["phases"][$sPhase]) && array_key_exists("ready4deployment", $this->_aData["phases"][$sPhase]) && array_key_exists("deployed", $this->_aData["phases"][$sPhase]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["onhold"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["ready4deployment"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["deployed"]) + ) + return true; + return false; } @@ -431,13 +438,13 @@ class project { * apply a config * @param array $aConfig * @return boolean - public function setConfig($aConfig) { - $this->_aConfig = $aConfig; - $this->_verifyConfig(); - return true; - } + public function setConfig($aConfig) { + $this->_aConfig = $aConfig; + $this->_verifyConfig(); + return true; + } */ - + /** * apply a config * @param array $aConfig @@ -445,12 +452,12 @@ class project { */ public function setProjectById($sId) { $this->_aPrjConfig = array(); - require($this->_sCfgfile); - if (!array_key_exists("$sId", $aProjects)){ + require(__dir__ . '/' . $this->_sCfgfile); + if (!array_key_exists("$sId", $aProjects)) { die("ERROR: a project with ID $sId does not exist."); } - $this->_aPrjConfig=$aProjects[$sId]; - $this->_aConfig["id"]=$sId; + $this->_aPrjConfig = $aProjects[$sId]; + $this->_aConfig["id"] = $sId; $this->_verifyConfig(); return true; } @@ -458,23 +465,26 @@ class project { // ---------------------------------------------------------------------- // ACTIONS // ---------------------------------------------------------------------- - - public function build(){ + + public function build() { global $aParams; - $sReturn=false; - + $sReturn = false; + + $this->_iRcAll = 0; + // -------------------------------------------------- // create workdir // -------------------------------------------------- - $sTempDir=$this->_getTempDir(); - $sFirstLevel=$this->getNextPhase(); + $sTempDir = $this->_getTempDir(); + $sFirstLevel = $this->getNextPhase(); + if (!$sFirstLevel) return false; $sReturn.="<h2>Create a temporary build dir</h2>"; if (!file_exists($sTempDir)) { - $sReturn.="* create ".$sTempDir."<br>"; + $sReturn.="* create " . $sTempDir . "<br>"; mkdir($sTempDir); } - $sReturn.=$this->_execAndSend("ls -ld ".$sTempDir); + $sReturn.=$this->_execAndSend("ls -ld " . $sTempDir); if (!file_exists($sTempDir)) { $sReturn.="ERROR: build - $sTempDir was not created."; return $sReturn; @@ -486,104 +496,231 @@ class project { // -------------------------------------------------- switch ($this->_aPrjConfig["build"]["type"]) { case "git": - + $sReturn.="<h2>Checkout a GIT project</h2>"; // $sReturn.=$this->_execAndSend("find " . $this->_aConfig["workDir"]); $sReturn.=$this->_execAndSend("cd $sTempDir && git init"); - - $sKeyfile=dirname(dirname(__file__))."/".$this->_aPrjConfig["build"]["keyfile"]; - $sWrapper=dirname(dirname(dirname(dirname(__file__))))."/shellscripts/gitsshwrapper.sh"; - $sReturn.=$this->_execAndSend("ls -l ".$sWrapper); + + $sKeyfile = dirname(dirname(__file__)) . "/" . $this->_aPrjConfig["build"]["keyfile"]; + $sWrapper = dirname(dirname(dirname(dirname(__file__)))) . "/shellscripts/gitsshwrapper.sh"; + $sReturn.=$this->_execAndSend("ls -l " . $sWrapper); // $sReturn.=$this->_execAndSend("ls -l ".$sKeyfile); - $sReturn.=$this->_execAndSend("cd $sTempDir && export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git pull ".$this->_aPrjConfig["build"]["ssh"]); - - $sVersion.=$this->_execAndSend("cd $sTempDir && export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git pull ".$this->_aPrjConfig["build"]["ssh"]); - + $sReturn.=$this->_execAndSend("cd $sTempDir && export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git pull " . $this->_aPrjConfig["build"]["ssh"]); + + $sVersion=$this->_execAndSend("cd $sTempDir && export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git pull " . $this->_aPrjConfig["build"]["ssh"]); + // control: directory listing after checkout $sReturn.=$this->_execAndSend("ls -lisa $sTempDir"); - + // fetch version infos - $sVersioninfo=shell_exec("cd $sTempDir && git log -1"); + $sVersioninfo = str_replace("\n", "<br>", shell_exec("cd $sTempDir && git log -1")); $sReturn.=$sVersioninfo; - + break; default: die("ERROR: Build Type not supported: " . $this->_aPrjConfig["build"]["type"]); break; } - + // -------------------------------------------------- // execute hook // -------------------------------------------------- - $sHookfile=$this->_aConfig['hooks']['build-aftercheckout']; - $sReturn.='<h2>Execute Hook '.$sHookfile.'</h2>'; - if (file_exists($sTempDir.'/'.$sHookfile)){ - $sReturn.=$this->_execAndSend('cd '.$sTempDir.' && bash "'.$sHookfile .'"'); + $sHookfile = $this->_aConfig['hooks']['build-aftercheckout']; + $sReturn.='<h2>Execute Hook ' . $sHookfile . '</h2>'; + if (file_exists($sTempDir . '/' . $sHookfile)) { + $sReturn.=$this->_execAndSend('cd ' . $sTempDir . ' && bash "' . $sHookfile . '"'); } else { $sReturn.='SKIP. Hook was not found.<br>'; } + // -------------------------------------------------- + // TODO: cleanup .git, .svn, ...? + // -------------------------------------------------- // -------------------------------------------------- // create package // -------------------------------------------------- $sReturn.='<h2>Create package</h2>'; // public_html must exist - $sWebroot=$sTempDir.'/public_html'; - if (!file_exists($sWebroot)){ + $sWebroot = $sTempDir . '/public_html'; + if (!file_exists($sWebroot)) { $sReturn.='ERROR: a subdir public_html does not exist.'; return $sReturn; } // generate info file - $sTs=date("Y-m-d H:i:s"); - $sTs2=date("Ymd_His"); - $sInfoFileWebroot=$sWebroot.'/'.basename($this->_getInfofile($sFirstLevel, "deployed")); - $sInfoFileArchiv= $this->_aConfig["archiveDir"].'/'.$this->_aConfig["id"].'.'.$sTs2.'/'.basename($this->_getInfofile($sFirstLevel, "deployed")); - $sPackageFileArchiv=$this->_aConfig["archiveDir"].'/'.$this->_aConfig["id"].'.'.$sTs2.'/'.basename($this->_getPackagefile($sFirstLevel, "deployed")); - - $sInfos='{ - "date": "'.$sTs.'", - "timestamp": "'.$sTs2.'", - "revision": "'.$sVersioninfo.'", - "user": "'.$aParams["inputUser"].'" - "remark": "'.$aParams["inputComment"].'" + $sTs = date("Y-m-d H:i:s"); + $sTs2 = date("Ymd_His"); + $sInfoFileWebroot = $sWebroot . '/' . basename($this->_getInfofile($sFirstLevel, "deployed")); + $sInfoFileArchiv = $this->_getArchiveDir($sTs2) . '/' . basename($this->_getInfofile($sFirstLevel, "deployed")); + $sPackageFileArchiv = $this->_getArchiveDir($sTs2) . '/' . basename($this->_getPackagefile($sFirstLevel, "deployed")); + + $sInfos = '{ + "date": "' . $sTs . '", + "timestamp": "' . $sTs2 . '", + "revision": "' . $sVersioninfo . '", + "user": "' . $aParams["inputUser"] . '", + "remark": "' . $aParams["inputComment"] . '" }'; + + $sReturn.="writing info file into webroot...<br>"; file_put_contents($sInfoFileWebroot, $sInfos); $sReturn.=$this->_execAndSend("ls -l $sInfoFileWebroot"); if (!file_exists(dirname($sPackageFileArchiv))) { - $sReturn.="* create ".dirname($sPackageFileArchiv)."<br>"; - mkdir(dirname($sPackageFileArchiv)); + $sReturn.="* create " . dirname($sPackageFileArchiv) . "<br>"; + mkdir(dirname($sPackageFileArchiv), 0775, true); } - $sReturn.=$this->_execAndSend("ls -ld ".dirname($sPackageFileArchiv)); + $sReturn.=$this->_execAndSend("ls -ld " . dirname($sPackageFileArchiv)); if (!file_exists(dirname($sPackageFileArchiv))) { $sReturn.="ERROR: directory was not created."; return $sReturn; } // TODO: cleanup - + $sReturn.="create archive $sPackageFileArchiv<br>"; $sReturn.=$this->_execAndSend("cd $sTempDir && tar -czf $sPackageFileArchiv ."); $sReturn.="writing info file into archive...<br>"; file_put_contents($sInfoFileArchiv, $sInfos); $sReturn.="<br>Created Archive files:<br>"; $sReturn.=$this->_execAndSend("ls -l $sPackageFileArchiv $sInfoFileArchiv"); - - $sReturn.="* Infofilezu [Paketarchiv]/[prj].json<br>"; - $sReturn.="* Temdir loeschen ".$sTempDir."<br>"; - $sReturn.="* <br>"; - $sReturn.="* Move [Paketarchiv]/[prj].[tgz+json] zu [RepoDir-von-".$sFirstLevel."]<br>"; + + if (!$this->_iRcAll == 0) { + $sReturn.='<h3>ERROR: creation failed</h3>One of the commands failed (see above).<br>You can ask the sysadmins and analyze with them the created temp directory "' . $sTempDir . '".'; + return $sReturn; + } + + // TODO: force synch archive to puppet master + + $sReturn.=$this->queue($sFirstLevel, $sTs2); + + + $sReturn.="<h2>cleanup $sTempDir</h2>"; + $sReturn.=$this->_execAndSend("rm -rf $sTempDir"); + + $sReturn.="* Move [Paketarchiv]/[prj].[tgz+json] zu [RepoDir-von-" . $sFirstLevel . "]<br>"; $sReturn.="<br>"; + + return $sReturn; + } + + public function queue($sTargetphase, $sVersion) { + + if (!$this->isActivePhase($sTargetphase)) return false; + $sReturn="<h2>Queue to $sTargetphase</h2>"; + $sPlace="onhold"; + + $sLinkTarget = $this->_getArchiveDir($sVersion); + $sLinkName = $this->_getFileBase($sTargetphase, $sPlace); + + // -------------------------------------------------- + // Checks + // -------------------------------------------------- + if (!$sLinkName) { + die("ERROR: Queuing failed - sLinkName is empty."); + } + if (!$sLinkTarget) { + die("ERROR: Queuing failed - sLinkTarget is empty."); + } + if (!file_exists($sLinkTarget)) { + die("ERROR: Queuing failed - version $sVersion is invalid. The directory $sLinkTarget does not exist."); + } + + // -------------------------------------------------- + // create the new link + // -------------------------------------------------- + $this->_iRcAll = 0; + if (file_exists($sLinkName)) { + $sReturn.="removing existing version<br>"; + $sReturn.=$this->_execAndSend("rm -f $sLinkName"); + } + $sReturn.="linking to new version <br>"; + $sReturn.=$this->_execAndSend("ln -s $sLinkTarget $sLinkName"); + $sReturn.=$this->_execAndSend("ls -l $sLinkName | fgrep $sLinkTarget"); + + + if (!$this->_iRcAll == 0) { + $sReturn.='<h3>ERROR: Queuing failed</h3>One of the commands failed (see above).'; + return $sReturn; + } + + // TODO: force synch to puppet master + + $sReturn.="<br>SUCCESS: the version $sVersion was set to place $sPlace<br>"; + + + $sReturn.=$this->deploy($sTargetphase); + // $sReturn.=$this->_execAndSend(""); + + return $sReturn; + } + + public function deploy($sTargetphase) { + if (!$this->isActivePhase($sTargetphase)) return false; + + $sReturn="<h2>Deploy to $sTargetphase</h2>"; + + $sQueueLink = $this->_getFileBase($sTargetphase, "onhold"); + $sRepoLink = $this->_getFileBase($sTargetphase, "ready4deployment"); + + if (array_key_exists("deploytimes", $this->_aConfig["phases"][$sTargetphase])){ + // check if the a deploy time is reached + $sNow=date("D H:i:s"); + $sReturn.="check if one of the deployment times is reached and matches $sNow<br>"; + $bCanDeploy=false; + foreach ($this->_aConfig["phases"][$sTargetphase]["deploytimes"] as $sRegex){ + $sReturn.="... $sRegex<br>"; + if (preg_match($sRegex, $sNow)){ + $bCanDeploy=true; + } + } + if (!$bCanDeploy){ + $sReturn.="SKIP: deployment time was not reached.<br>"; + return $sReturn; + } + $sReturn.="OK, deployment time was reached.<br>"; + // if () + } + if (!file_exists($sQueueLink)){ + $sReturn.="SKIP: no current queue - $sQueueLink does not exist."; + return $sReturn; + } + if (!file_exists($sQueueLink)){ + $sReturn.="SKIP: no current queue - $sQueueLink does not exist."; + return $sReturn; + } + + + // -------------------------------------------------- + // move the queue link to the repo name + // -------------------------------------------------- + $this->_iRcAll = 0; + if (file_exists($sRepoLink)) { + $sReturn.="removing existing version<br>"; + $sReturn.=$this->_execAndSend("rm -f $sRepoLink"); + } + $sReturn.="moving queue to repo<br>"; + $sReturn.=$this->_execAndSend("mv $sQueueLink $sRepoLink"); + + + if (!$this->_iRcAll == 0) { + $sReturn.='<h3>ERROR: Deployment failed</h3>One of the commands failed (see above).'; + return $sReturn; + } + + // TODO: force synch to puppet master + + $sReturn.="<br>SUCCESS: deployment was done and will be installed soon<br>"; return $sReturn; } + } ?> \ No newline at end of file diff --git a/public_html/deployment/classes/projectlist.class.php b/public_html/deployment/classes/projectlist.class.php index 9fbe2210b7b7ae0f985eacb4cbea94b3e8a0e335..7a628404e556c64ee358cd75666b956ac40ff084 100644 --- a/public_html/deployment/classes/projectlist.class.php +++ b/public_html/deployment/classes/projectlist.class.php @@ -39,7 +39,7 @@ class projectlist { */ private function _readConfig() { $this->_aProjects = array(); - require($this->_sCfgfile); + require(__dir__ . '/' . $this->_sCfgfile); $this->_aProjects = $aProjects; $this->_aPhases = $aConfig["phases"]; $this->_verifyConfig(); @@ -124,23 +124,27 @@ class projectlist { // --- on hold $sInfoH = ''; - if (!array_key_exists("ok", $aTmp[$h])) { - if (array_key_exists("deploytimes", $this->_aPhases[$sPhase])){ + if (array_key_exists("ok", $aTmp[$h]) && array_key_exists("timestamp", $aTmp[$h])) { $sInfoH = '<div class="versioninfo"> <i class="icon-calendar"></i> ' . $aTmp[$h]["date"] . '<br> <i class="icon-tag"></i> ' . $aTmp[$h]["revision"] . '<br> - Anm.: ' . $aTmp[$h]["remark"] . '<br> - <br> - Deployment: '. implode(",", array_values($this->_aPhases[$sPhase]["deploytimes"])).' - </div>'; - } else { - $sInfoH = '<div class="error"><i class="icon-exclamation-sign"></i> FEHLER:<br>Es ist keine Queue definiert, aber es ist eine Info-Datei für eine Queue vorhanden: '.$aTmp[$h]["infofile"].'<br>Confused :-/</div>'; + Anm.: ' . $aTmp[$h]["remark"] . '<br>'; + if (array_key_exists("deploytimes", $this->_aPhases[$sPhase]) || true){ + $sInfoH .= '<br>Deployment: '. implode(",", array_values($this->_aPhases[$sPhase]["deploytimes"])); } + $sInfoH .= ' + <br> + <a href="/deployment/'.$sPrj.'/deploy/'.$sPhase.'/" class="btn '.$sPhase.'"><i class=" icon-forward"></i> Deploy to '.$sPhase.'-Queue</a> + </div>'; } else { - $sInfoH = ''; + if (array_key_exists("error", $aTmp[$h])) { + $sInfoH = '<div class="error"><i class="icon-exclamation-sign"></i> FEHLER:<br>' . $aTmp[$h]["error"] . '</div>'; + } else { + $sInfoH = 'empty'; + } } - // --- queue and deployment have the same version? + // --- ready4deployment have the same version? $sInfoQ = ''; if (array_key_exists("ok", $aTmp[$q]) && array_key_exists("ok", $aTmp[$d]) && $aTmp[$q]["timestamp"] > " " && $aTmp[$q]["timestamp"] == $aTmp[$d]["timestamp"]) { $sInfoQ = "deployed"; @@ -174,9 +178,9 @@ class projectlist { $sInfoD = '<div class="error"><i class="icon-exclamation-sign"></i> FEHLER:<br>' . $aTmp[$d]["error"] . '</div>'; } - if ($oPrj->canDeploy($sPhase)){ + if ($oPrj->canAcceptPhase($sPhase)){ $sNext=$oPrj->getNextPhase($sPhase); - $sInfoD.='<br><a href="deploy.htm?prj='.$sPrj.'&phase='.$sPhase.'" class="btn '.$sNext.'"><i class=" icon-forward"></i> Deploy auf ['.$sNext.']</a>'; + $sInfoD.='<br><a href="/deployment/'.$sPrj.'/accept/'.$sPhase.'/" class="btn '.$sNext.'"><i class=" icon-forward"></i> Accept für ['.$sNext.']</a>'; } // output @@ -207,9 +211,9 @@ class projectlist { <td class="prj"> <strong>' . $oPrj->getLabel() . '</strong><br> ' . $oPrj->getDescription() . '<br>'; - if ($oPrj->canDeploy()){ + if ($oPrj->canAcceptPhase()){ $sNext=$oPrj->getNextPhase(); - $sOut.='<a href="build.htm?prj='.$sPrj.'" class="btn '.$sNext.'"><i class=" icon-forward"></i> Build für ['.$sNext.']</a>'; + $sOut.='<a href="/deployment/'.$sPrj.'/build/" class="btn '.$sNext.'"><i class=" icon-forward"></i> Build für ['.$sNext.']</a>'; } $sOut.='</td> ' . $sOutPhases . ' diff --git a/public_html/deployment/config/inc_projects_config.php b/public_html/deployment/config/inc_projects_config.php index ecfbdc13f57a813d17653da4fc82107cb83a6817..a554ba65ea83c179f38c44bcb6648748165deef5 100644 --- a/public_html/deployment/config/inc_projects_config.php +++ b/public_html/deployment/config/inc_projects_config.php @@ -16,6 +16,7 @@ $aConfig=array( 'phases'=>array( "preview"=>array( + // "deploytimes"=>array('/(Mon|Tue|Wed|Thu)\ 4/'), ), "stage"=>array(), "live"=>array( @@ -68,6 +69,8 @@ $aProjects=array( // generate ssh keypair // https://help.github.com/articles/generating-ssh-keys "ssh"=>"ssh gituser@gitserver:/path/to/project", + // der public Key muss beim Git-Repo hinterlegt sein + "keyfile"=>"config/sshkeys/git@gitlab.iml.unibe.ch", ), "phases"=>array( diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php new file mode 100644 index 0000000000000000000000000000000000000000..c687339f4ce62a6e4572b237ca25e1f90b985b1b --- /dev/null +++ b/public_html/deployment/inc_functions.php @@ -0,0 +1,50 @@ +<?php + +global $aParams; +$aParams=array(); +if (count($_GET)) foreach($_GET as $key=>$value) $aParams[$key]=$value; +if (count($_POST)) foreach($_POST as $key=>$value) $aParams[$key]=$value; + +/* +print_r($_GET); +print_r($_POST); +print_r($aParams); +*/ + +/** + * get link as home button + * @return string + */ +function aHome(){ + return '<a href="/deployment/?" class="btn"><i class="icon-home"></i> zur Übersicht</a>'; +} + + +function enterDeployinfos(){ + global $aParams; + $sIdUser="inputUser"; + $sIdComment="inputComment"; + $sUser=(array_key_exists($sIdUser, $aParams))?$aParams[$sIdUser]:""; + $sComment=(array_key_exists($sIdComment, $aParams))?$aParams[$sIdComment]:""; + + $sOut=' + <div class="control-group"> + <label class="control-label" for="inputUser">Benutzername</label> + <div class="controls"> + <input type="text" id="inputUser" name="inputUser" placeholder="Benutzername" value="'.$sUser.'"> + </div> + </div> + <div class="control-group"> + <label class="control-label" for="inputComment">Kommentar zum Deployment</label> + <div class="controls"> + <textarea id= rows="3" id="inputComment" name="inputComment" placeholder="Kommentar">'.$sComment.'</textarea> + </div> + </div> + '; + + return $sOut; +} + + + +?> diff --git a/public_html/deployment/index.html b/public_html/deployment/index.html deleted file mode 100644 index 6a48dcbb9f88816d3d9a0dd7a4d9307a3cef9dbc..0000000000000000000000000000000000000000 --- a/public_html/deployment/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> - <head> - <meta http-equiv="refresh" content="1;url=webgui/index.htm" /> - </head> - <body> - <h1>Weiterleitung ...</h1> - <p> - <a href="webgui/index.htm">Startseite</a> - </p> - </body> -</html> diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php new file mode 100644 index 0000000000000000000000000000000000000000..6179e9e36513c44e658d4925e62ba52edece33ab --- /dev/null +++ b/public_html/deployment/index.php @@ -0,0 +1,47 @@ +<?php + +require_once("./inc_functions.php"); +require_once("./classes/page.class.php"); + + +$sPrj=""; +$sAction="overview"; + +if (array_key_exists("prj", $aParams)) { + $sPrj=$aParams["prj"]; +} +if (array_key_exists("action", $aParams)) { + if (file_exists(__DIR__ . '/act_' . $aParams["action"] . ".php")){ + $sAction=$aParams["action"]; + } +} + +// ------ action + +$sActionFile=__DIR__ . '/act_' . $sAction . ".php"; +include($sActionFile); + + + +// ------ Ausgabe + +$sPhpOut=' + <div id="header"> + IML DEPLOYMENT GUI + </div> + '.$sPhpOut; + +$oPage = new Page(); +$oPage->setOutputtype('html'); +$oPage->addResponseHeader("Pragma: no-cache"); +$oPage->addJsOnReady(' + $(\'.tblOverview\').dataTable({ + "bPaginate": false, + "bLengthChange": false + }); +'); + +$oPage->setContent($sPhpOut); +echo $oPage->render(); + +?> diff --git a/public_html/deployment/scrudu.json b/public_html/deployment/scrudu.json deleted file mode 100644 index 0cd7a325b179f0bff39642f646bcd9e41d14837c..0000000000000000000000000000000000000000 --- a/public_html/deployment/scrudu.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "date": "2013-10-09 09:34:12", - "timestamp": "20131009_093412", - "revision": "optional: ausgecheckte Version aus dem Repo/ den Repos", - "remark": "Hinweise in diesem Release: wer hat was aktualisiert/ gefixt o.ä." -} \ No newline at end of file diff --git a/public_html/deployment/shared/default.tpl - bootstrap.html b/public_html/deployment/shared/default.tpl - bootstrap.html deleted file mode 100644 index d3ee6e4c697fa089f173bc55abc37d4fb082d58e..0000000000000000000000000000000000000000 --- a/public_html/deployment/shared/default.tpl - bootstrap.html +++ /dev/null @@ -1,164 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <title>[[SITE]] :: [[TITLE]]</title> - <link href="css/bootstrap-responsive.min.css" type="text/css" rel="stylesheet" /> - <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" /> - <style> - -@media (max-width: 767px) { - #toc { - position: relative; - width: 100%; - margin: 0px 0px 20px 0px; - } -} - -h1{text-shadow: 1px 1px 0 #fff, 4px 4px 15px #aaa;} -h2{color: #0088CC; text-shadow: 1px 1px 0 #fff, 2px 2px 5px #aaa; border-bottom: 1px solid #ddd; box-shadow: 0 8px 8px #f4f4f4; - border-radius: 10px; padding: 0 15px; - margin-left: -15px; -} -h3{color: #68a; text-shadow: 1px 1px 0 #fff, 2px 2px 4px #bbb; border-bottom: 1px dashed #ddd; } - - -.changeme{background:#fea;} -.changeme:after{content: "your value";} -.dirname{background:#ddd; font-style: italic; border: 1px dashed #aaa; color: #448;} -.dirname:after{content: "directory";} -.filename{background:#eff; font-style: italic; color: #468;border: 1px dashed #aaa;} -.filename:after{content: "file";} -.varname{background:#def;} -.varname:after{content: "variable";} -.varvalue{background:#eee; font-style: italic;} -.varvalue:after{content: "value";} - -.changeme:after, -.dirname:after, -.filename:after, -.varname:after, -.varvalue:after -{ - background:#aaa; font-size: 60%; margin: 0 5px; opacity: 0.5; - position: relative; - color:#fff; -} - -.urlvar{color:#a33; font-weight: bold;} -.urlval{color:#38c;} - -img.screenshot{padding: 10px; border: 1px solid #ccc; border-radius: 10px; box-shadow: 3px 3px 10px #ccc;} - -.warning{margin: 20px 60px; padding: 10px; - background: #fee; - color: #a88; - border: 2px solid #caa; border-radius: 10px; box-shadow: 3px 3px 10px #ccc;} - -.navbar-fixed-top{box-shadow: 0 5px 10px rgba(0,0,0,0.1); } -.navbar-inner{background-color: #eee; background-image: linear-gradient(to bottom, #fafafa, #ddd, #eee);} -.navbar .brand{color:#d62; font-weight: bold; font-size: 150%;} -.navbar .nav > li{border-left: 1px solid rgba(255,255,255,0.3);} -.active1{ - background-color: #cef; - box-shadow: 0 3px 8px rgba(0, 0, 0, 0.125) inset; - border-radius: 3px 3px 0 0; -} -.nav li:hover{ - background-color: rgba(0,0,0,0.04); -} -.container-fluid{padding-top: 6px;} -.row-fluid{margin-top: 10px;} -.footerbar{background-color: #f8f8f8; background-image: linear-gradient(to bottom, #f8f8f8, #f0f0f0, #fff); padding: 20px; - border-radius: 20px 20px 0 0; font-size: 80%; text-align: center; margin-top: 40px; - color:#aaa; - } - - - </style> - </head> - - <body> - - <div class="navbar navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container-fluid"> - <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </a> - <a class="brand" href="#">[[SITE]]</a> - - <div class="nav-collapse"> - <ul class="nav"> - - [[NAVI1]] - - </ul> - </div><!--/.nav-collapse --> - </div> - </div> - </div> - - <div class="container-fluid"> - <div class="row-fluid"> - <div class="span3 tocify"> - <div id="toc"> - </div><!--/.well --> - </div><!--/span--> - <div class="span9"> - - [[CONTENT]] - - </div> - - <br /> - - </div><!--/row--> - <div class="footerbar" style=""> - <p> - [[FOOTER]] - </p> - </div> - </div><!--/.fluid-container--> - - <!-- Le javascript - ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> - <script src="http://code.jquery.com/jquery-latest.js"></script> - <script src="js/bootstrap.min.js"></script> - <script> - $(function() { - - $("#toc").tocify({ selectors: "h2, h3, h4", scrollTo: 60, highlightOffset: 60, extendPage: false }); - - prettyPrint(); - - $(".optionName").popover({ trigger: "hover" }); - - $("a[href='#']").click(function(event) { - - event.preventDefault(); - - }); - - }); - - </script> - <!-- Piwik --> - <script src="http://www.axel-hahn.de/piwik/piwik.js" type="text/javascript"></script> - <noscript><p><img src="http://www.axel-hahn.de/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript> - <script type="text/javascript"> - var pkBaseURL = "/piwik/"; - try { - var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); - piwikTracker.trackPageView(); - piwikTracker.enableLinkTracking(); - } catch( err ) {} - var piwikTracker = false; var Piwik=false; - </script> - <!-- End Piwik Tag --> - - </body> -</html> \ No newline at end of file diff --git a/public_html/deployment/shared/default.tpl__botstrap.html b/public_html/deployment/shared/default.tpl__botstrap.html deleted file mode 100644 index d3ee6e4c697fa089f173bc55abc37d4fb082d58e..0000000000000000000000000000000000000000 --- a/public_html/deployment/shared/default.tpl__botstrap.html +++ /dev/null @@ -1,164 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <title>[[SITE]] :: [[TITLE]]</title> - <link href="css/bootstrap-responsive.min.css" type="text/css" rel="stylesheet" /> - <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" /> - <style> - -@media (max-width: 767px) { - #toc { - position: relative; - width: 100%; - margin: 0px 0px 20px 0px; - } -} - -h1{text-shadow: 1px 1px 0 #fff, 4px 4px 15px #aaa;} -h2{color: #0088CC; text-shadow: 1px 1px 0 #fff, 2px 2px 5px #aaa; border-bottom: 1px solid #ddd; box-shadow: 0 8px 8px #f4f4f4; - border-radius: 10px; padding: 0 15px; - margin-left: -15px; -} -h3{color: #68a; text-shadow: 1px 1px 0 #fff, 2px 2px 4px #bbb; border-bottom: 1px dashed #ddd; } - - -.changeme{background:#fea;} -.changeme:after{content: "your value";} -.dirname{background:#ddd; font-style: italic; border: 1px dashed #aaa; color: #448;} -.dirname:after{content: "directory";} -.filename{background:#eff; font-style: italic; color: #468;border: 1px dashed #aaa;} -.filename:after{content: "file";} -.varname{background:#def;} -.varname:after{content: "variable";} -.varvalue{background:#eee; font-style: italic;} -.varvalue:after{content: "value";} - -.changeme:after, -.dirname:after, -.filename:after, -.varname:after, -.varvalue:after -{ - background:#aaa; font-size: 60%; margin: 0 5px; opacity: 0.5; - position: relative; - color:#fff; -} - -.urlvar{color:#a33; font-weight: bold;} -.urlval{color:#38c;} - -img.screenshot{padding: 10px; border: 1px solid #ccc; border-radius: 10px; box-shadow: 3px 3px 10px #ccc;} - -.warning{margin: 20px 60px; padding: 10px; - background: #fee; - color: #a88; - border: 2px solid #caa; border-radius: 10px; box-shadow: 3px 3px 10px #ccc;} - -.navbar-fixed-top{box-shadow: 0 5px 10px rgba(0,0,0,0.1); } -.navbar-inner{background-color: #eee; background-image: linear-gradient(to bottom, #fafafa, #ddd, #eee);} -.navbar .brand{color:#d62; font-weight: bold; font-size: 150%;} -.navbar .nav > li{border-left: 1px solid rgba(255,255,255,0.3);} -.active1{ - background-color: #cef; - box-shadow: 0 3px 8px rgba(0, 0, 0, 0.125) inset; - border-radius: 3px 3px 0 0; -} -.nav li:hover{ - background-color: rgba(0,0,0,0.04); -} -.container-fluid{padding-top: 6px;} -.row-fluid{margin-top: 10px;} -.footerbar{background-color: #f8f8f8; background-image: linear-gradient(to bottom, #f8f8f8, #f0f0f0, #fff); padding: 20px; - border-radius: 20px 20px 0 0; font-size: 80%; text-align: center; margin-top: 40px; - color:#aaa; - } - - - </style> - </head> - - <body> - - <div class="navbar navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container-fluid"> - <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </a> - <a class="brand" href="#">[[SITE]]</a> - - <div class="nav-collapse"> - <ul class="nav"> - - [[NAVI1]] - - </ul> - </div><!--/.nav-collapse --> - </div> - </div> - </div> - - <div class="container-fluid"> - <div class="row-fluid"> - <div class="span3 tocify"> - <div id="toc"> - </div><!--/.well --> - </div><!--/span--> - <div class="span9"> - - [[CONTENT]] - - </div> - - <br /> - - </div><!--/row--> - <div class="footerbar" style=""> - <p> - [[FOOTER]] - </p> - </div> - </div><!--/.fluid-container--> - - <!-- Le javascript - ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> - <script src="http://code.jquery.com/jquery-latest.js"></script> - <script src="js/bootstrap.min.js"></script> - <script> - $(function() { - - $("#toc").tocify({ selectors: "h2, h3, h4", scrollTo: 60, highlightOffset: 60, extendPage: false }); - - prettyPrint(); - - $(".optionName").popover({ trigger: "hover" }); - - $("a[href='#']").click(function(event) { - - event.preventDefault(); - - }); - - }); - - </script> - <!-- Piwik --> - <script src="http://www.axel-hahn.de/piwik/piwik.js" type="text/javascript"></script> - <noscript><p><img src="http://www.axel-hahn.de/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript> - <script type="text/javascript"> - var pkBaseURL = "/piwik/"; - try { - var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); - piwikTracker.trackPageView(); - piwikTracker.enableLinkTracking(); - } catch( err ) {} - var piwikTracker = false; var Piwik=false; - </script> - <!-- End Piwik Tag --> - - </body> -</html> \ No newline at end of file diff --git a/public_html/deployment/shared/parse.php b/public_html/deployment/shared/parse.php deleted file mode 100644 index 32af1b3637107470eaf5d140959b4b605130a6f3..0000000000000000000000000000000000000000 --- a/public_html/deployment/shared/parse.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * - * PARSER SCRIPT. - * - * ---------------------------------------------------------------------- - * - * it takes the template "default.tpl.html" and fills placeholders - * The template is html template for gfranko-Document-Bootstrap - * where the ressources are - * - * ---------------------------------------------------------------------- - * - * to make it work I neeed an .htaccess file that rewrites requsts to - * the parser and the bootstrap - * - * RewriteEngine on - * - * # parse htm files - * RewriteRule ^(.*)\.htm$ /docs-source/shared/parse.php [PT,QSA] - * - * # rewrite bootstrap-ressources - * RewriteCond %{REQUEST_FILENAME} !-f - * RewriteCond %{REQUEST_FILENAME} !-d - * RewriteRule /(css|js|img)/(.*)$ /docs-source/gfranko-Document-Bootstrap-cf0730d/$1/$2 - * - * ---------------------------------------------------------------------- - * - * to publish pages below /doc-source/[project]/ - * go to /docs/ and start rsync_www.bash - * - */ - -// ---------------------------------------------------------------------- -// vars -// ---------------------------------------------------------------------- - $aSearch=array(); - $aReplace=array(); - $sTemplate=__DIR__ . "/default.tpl.html"; - $sErrTemplate=__DIR__ . "/default.tpl.html"; - $sTemplate=dirname($_SERVER["SCRIPT_FILENAME"]) . "/default.tpl.html"; - $sErrTemplate=dirname($_SERVER["SCRIPT_FILENAME"]) . "/default.tpl.html"; - $sContent=false; - $sPhpOut=false; - $sNavi1=false; - - -// ---------------------------------------------------------------------- -// split url and get pathes -// ---------------------------------------------------------------------- - $aParts = preg_split("#\/#", $_SERVER["REQUEST_URI"]); - array_shift($aParts); - - $sProjectDir=$_SERVER["DOCUMENT_ROOT"] . "/" . array_shift($aParts); - $sProject=array_shift($aParts); - $sProjectDir.="/".$sProject; - $sFile=implode("/", $aParts); - if (array_key_exists("REDIRECT_QUERY_STRING", $_SERVER)) - $sFile=str_replace("?".$_SERVER["REDIRECT_QUERY_STRING"], "", $sFile); - - // DEBUG STUFF - // echo "<h1>$sProject</h1>project-Home: $sProjectDir<br>File: " . $sFile . "<hr>"; - // echo "<pre>" . print_r($_SERVER, true) . "</pre>"; - -// ---------------------------------------------------------------------- -// load project based config -// ---------------------------------------------------------------------- - require_once($sProjectDir."/inc_config.php"); - - -// ---------------------------------------------------------------------- -// authentication - if reqired -// ---------------------------------------------------------------------- - if (isset($aAuth) && $aAuth) { - - header("PRAGMA: nocache"); - $sUserID=false; - // fuer ersten Aufruf: Cookie setzen - if (array_key_exists("id", $_GET)){ - $sUserID=$_GET["id"]; - setcookie("id", $sUserID, time()+36000); - } else { - if (array_key_exists("id", $_COOKIE)){ - $sUserID=$_COOKIE["id"]; - } - } - - if (!$sUserID || !array_key_exists($sUserID, $aAuth)){ - header('HTTP/1.0 403 Forbidden'); - $sContent=" - <h2>Zugriff verweigert</h2> - Klicken Sie auf den per E-Mail zugestellten Link, um sich anzumelden."; - $aCfg["prj"]=''; - $sNavi1=' '; - // die(); - } else { - - $aUser=$aAuth[$sUserID]; - $ACTTIME=date("Y-m-d"); - if ($ACTTIME > $aUser["validTo"]) { - header('HTTP/1.0 403 Forbidden'); - $sContent="<h2>Zugriff verweigert</h2> - ".$aUser["Anrede"]. ",<br /> - Bitte entschuldigen Sie, aber die Anzeigefrist f�r Ihre Einsicht ist - am <NOBR><strong>[".$aUser["validTo"]."]</strong></NOBR> abgelaufen.<br> - "; - $aCfg["prj"]=''; - $sNavi1=' '; - - // die(); - } else { - // ---------------------------------------------------------------------- - // replace users content - // ---------------------------------------------------------------------- - $aSearch[]='<div id="toc">'; - $aReplace[]=array_key_exists("adresse", $aCfg)?'<div id="toc">'.$aCfg["adresse"]:'<div id="toc">'; - foreach($aUser as $key=>$val) { - $aSearch[]='[['.$key.']]'; - $aReplace[]=$val; - } - } - } - - } - -// ---------------------------------------------------------------------- -// get content -// ---------------------------------------------------------------------- - - // create navigation - if (!$sNavi1) - foreach ($aCfg["pages"] as $sPage=>$aData){ - if ($sPage == $sFile){ - $sNavi1.='<li class="active1"><a href="'.$sPage.'"><i class="'.$aData["class"].'"></i> '.$aData["title"].'</a></li>'; - } else { - $sNavi1.='<li><a href="'.$sPage.'"><i class="'.$aData["class"].'"></i> '.$aData["title"].'</a></li>'; - } - } - - // load template - $sHtml=file_get_contents($sTemplate); - - // load requested file - if no error occured an $sContent was filled already - if (!$sContent){ - $sContentFile=$sProjectDir."/".$sFile; - if (file_exists($sContentFile)){ - $sContent=file_get_contents($sContentFile); - // load php script - if (file_exists($sContentFile.".php")){ - include($sContentFile.".php"); - } - } else { - header('HTTP/1.0 404 File Not Found'); - $sContent='<h2>Seite nicht gefunden</h2>'; - } - } else { - $sContent.='<div style="clear: both; height: 200px;"> </div>'; - } - - -// ---------------------------------------------------------------------- -// replace content -// ---------------------------------------------------------------------- - - if (array_key_exists($sFile, $aCfg["pages"])) { - $aSearch[]="[[TITLE]]"; - $aReplace[]=$aCfg["pages"][$sFile]["title"]; - } - - $sContent=str_replace($aSearch, $aReplace, $sContent); - foreach(array( - "[[SITE]]"=>$aCfg["prj"], - "[[CONTENT]]"=>$sContent, - "[[PHPOUT]]"=>$sPhpOut, - "[[NAVI1]]"=>$sNavi1, - "[[FOOTER]]"=>$aCfg["footer"], - ) as $sSearch=>$sReplace){ - $aSearch[]=$sSearch; - $aReplace[]=$sReplace; - } - - if (array_key_exists("replace", $aCfg)) { - foreach($aCfg["replace"] as $sSearch=>$sReplace){ - $aSearch[]=$sSearch; - $aReplace[]=$sReplace; - } - } - - - $aSearch[]="[[GPL3]]"; - $aReplace[]='GNU GPL v 3.0'; - $aSearch[]="[[URLGPL3]]"; - $aReplace[]='http://www.gnu.org/licenses/gpl.html'; - - - if (array_key_exists("sfprj", $aCfg)) { - $aSearch[]="[[SFPRJ]]"; - $aReplace[]=$aCfg['sfprj']; - $aSearch[]="[[SFURL]]"; - $aReplace[]='http://sourceforge.net/projects/'.$aCfg['sfprj'].'/'; - $aSearch[]="[[SFSVN]]"; - $aReplace[]='svn://svn.code.sf.net/p/'.$aCfg['sfprj'].'/code/trunk'; - } - -// ---------------------------------------------------------------------- -// output -// ---------------------------------------------------------------------- - print str_replace($aSearch, $aReplace, $sHtml); - - -// ---------------------------------------------------------------------- -// replace content -// ---------------------------------------------------------------------- -?> \ No newline at end of file diff --git a/public_html/deployment/webgui/build.htm b/public_html/deployment/webgui/build.htm deleted file mode 100644 index 1bbf32851c5dff4c3f5c24f2cc2c5e1ce33fb423..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/build.htm +++ /dev/null @@ -1 +0,0 @@ -[[PHPOUT]] \ No newline at end of file diff --git a/public_html/deployment/webgui/build.htm.php b/public_html/deployment/webgui/build.htm.php deleted file mode 100644 index 2450dcd11c51c813d01873d6533b003246ffc4a7..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/build.htm.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -require_once("../config/inc_projects_config.php"); -require_once("../classes/project.class.php"); -require_once("../classes/formgen.class.php"); - -require_once("inc_functions.php"); - -$sOut='<h1>Build</h1>'; -$sError=''; - -// --- Checks -if (!array_key_exists("prj", $aParams)){ - $sError.='<li>Es wurde kein Projekt angegeben.</li>'; -} - - -if ($sError){ - $sOut.='<i class="icon-exclamation-sign"></i> FEHLER:<ul>'.$sError.'</ul>'; - -} else { - $oPrj=new project($aParams["prj"]); - - $sAction="default"; - if (array_key_exists("action", $aParams)){ - $sAction=$aParams["action"]; - } - - $sOut='<h1>Build :: '.$oPrj->getLabel().'</h1> - <p>' . $oPrj->getDescription() . '</p> - <hr> - '; - - switch ($sAction) { - case "build": - $sOut.=$oPrj->build(); - // $sOut.=execAndSend("dir /s /b " . $aConfig['workDir']); - - break; - - default: - $sNext=$oPrj->getNextPhase(); - $sOut.=' - <p> - Es wird ein neues Paket erstellt und auf die Phase <em class="'.$sNext.'">'.$sNext.'</em> installiert.<br> - Du kannst einen Kommentar zu diesem Deployment angeben und darin beschreiben, worin das Update - besteht (Fix, neue Funktion, ...). - </p> - '; - - // Eingabe Kommentare zum Deployment - //$oForm=new formgen(); - $sOut.=' - <hr> - <form action="?" enctype="multipart/form-data"> - <input type="hidden" name="prj" value="'.$_GET["prj"].'"> - <input type="hidden" name="action" value="build"> - ' . enterDeployinfos() . ' - <hr> - <input type="submit" class="btn btn-primary" value="Paket für ['.$sNext.'] erstellen"> - </form> - '; - break; - } -} -$sOut.=aHome(); - - -// -- Ausgabe -$sPhpOut=$sOut; -?> - diff --git a/public_html/deployment/webgui/deploy.htm b/public_html/deployment/webgui/deploy.htm deleted file mode 100644 index 1bbf32851c5dff4c3f5c24f2cc2c5e1ce33fb423..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/deploy.htm +++ /dev/null @@ -1 +0,0 @@ -[[PHPOUT]] \ No newline at end of file diff --git a/public_html/deployment/webgui/deploy.htm.php b/public_html/deployment/webgui/deploy.htm.php deleted file mode 100644 index b99642c836006923d6b523ded656393cc7569498..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/deploy.htm.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -require_once("../config/inc_projects_config.php"); -require_once("../classes/project.class.php"); -require_once("../classes/formgen.class.php"); - -require_once("inc_functions.php"); - - -$sOut='<h1>Deploy</h1>'; -$sError=''; - -// --- Checks -if (!array_key_exists("prj", $_GET)){ - $sError.='<li>Es wurde kein Projekt angegeben.</li>'; -} else { - $oPrj=new project($_GET["prj"]); - $sOut='<h1>Deploy to next phase :: '.$oPrj->getLabel().'</h1><p>' . $oPrj->getDescription() . '</p><hr>'; - if (!array_key_exists("phase", $_GET)){ - $sError.='<li>Die aktuelle Phase wurde nicht angegeben.</li>'; - } else { - $sPhase=$_GET["phase"]; - if (!$oPrj->isActivePhase($sPhase)){ - $sError.='<li>Die Phase '.$sPhase.' ist in diesem Projekt nicht aktiv.</li>'; - } else { - if (!$oPrj->canDeploy($sPhase)){ - $sError.='<li>Die Phase '.$sPhase.' kann nicht deployed werden.</li>'; - } - } - } -} - -if ($sError){ - $sOut.='<i class="icon-exclamation-sign"></i> FEHLER:<ul>'.$sError.'</ul>'; - -} else { - $sNext=$oPrj->getNextPhase($sPhase); - $sOut.=' - <p> - Das aktuelle Paket von Phase <em class="'.$sPhase.'">'.$sPhase.'</em> wird auf die Phase <em class="'.$sNext.'">'.$sNext.'</em> installiert.<br> - Du kannst einen Kommentar zu diesem Deployment angeben. - </p> - '; - // Eingabe Kommentare zum Deployment - //$oForm=new formgen(); - // $sOut.=showPhases($sPhase, $sNext); - $aInfos=$oPrj->getPhaseInfos($sPhase); - $sOut.='<pre>'.print_r($aInfos["deployed"], true).'</pre>'; - - $sOut.=' - <hr> - ' . enterDeployinfos() . ' - <hr> - Aktionen [Buld] | - '; -} -$sOut.=aHome(); - -// -- Ausgabe -$sPhpOut=$sOut; -?> - diff --git a/public_html/deployment/webgui/doc.htm b/public_html/deployment/webgui/doc.htm deleted file mode 100644 index 1bbf32851c5dff4c3f5c24f2cc2c5e1ce33fb423..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/doc.htm +++ /dev/null @@ -1 +0,0 @@ -[[PHPOUT]] \ No newline at end of file diff --git a/public_html/deployment/webgui/doc.htm.php b/public_html/deployment/webgui/doc.htm.php deleted file mode 100644 index a2b970c6a96d02a2db48aedcd0cc273f838bc2f4..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/doc.htm.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -require_once("../classes/classinfos.class.php"); -require_once("../classes/project.class.php"); - -$o=new classinfos("project"); -$sOut=$o->render(); - -// -- Ausgabe -$sPhpOut=$sOut; -?> - diff --git a/public_html/deployment/webgui/functions.js b/public_html/deployment/webgui/functions.js deleted file mode 100644 index 9d77c69f476c27c56d15add7f11a9160b99fe619..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/functions.js +++ /dev/null @@ -1,3 +0,0 @@ -/* - * 2013-10-nn axel.hahn@iml.unibe.ch - */ diff --git a/public_html/deployment/webgui/inc_config.php b/public_html/deployment/webgui/inc_config.php deleted file mode 100644 index 3b0753ada4cf6943fb70deeb9a6c2282fa5c7d53..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/inc_config.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -$aCfg=array( - "prj"=>"IML Deployment", - "sfprj"=>"", // name sourceforge project - "version"=>"", - "footer"=>'Copyright © ' . date("Y") . ' IML<br> - ', - "pages"=>array( - "index.htm"=>array( - "title"=>"Übersicht", - "class"=>"icon-home", - ), - "build.htm"=>array( - "title"=>"Build", - "class"=>"icon-play-circle", - ), - "deploy.htm"=>array( - "title"=>"Deploy", - "class"=>"icon-forward", - ), - "doc.htm"=>array( - "title"=>"Doc", - "class"=>"icon-book", - ), - ), -); \ No newline at end of file diff --git a/public_html/deployment/webgui/inc_functions.php b/public_html/deployment/webgui/inc_functions.php deleted file mode 100644 index 8f1b0bb0cfbbeffcbda17b462bf911d49bf87971..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/inc_functions.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -global $aParams; -$aParams=array(); -if (count($_GET)) foreach($_GET as $key=>$value) $aParams[$key]=$value; -if (count($_POST)) foreach($_POST as $key=>$value) $aParams[$key]=$value; - -/** - * get link as home button - * @return string - */ -function aHome(){ - return '<a href="index.htm" class="btn"><i class="icon-home"></i> zur Übersicht</a>'; -} - - -function enterDeployinfos(){ - global $aParams; - $sIdUser="inputUser"; - $sIdComment="inputComment"; - $sUser=(array_key_exists($sIdUser, $aParams))?$aParams[$sIdUser]:""; - $sComment=(array_key_exists($sIdComment, $aParams))?$aParams[$sIdComment]:""; - - $sOut=' - <div class="control-group"> - <label class="control-label" for="inputUser">Benutzername</label> - <div class="controls"> - <input type="text" id="inputUser" name="inputUser" placeholder="Benutzername" value="'.$sUser.'"> - </div> - </div> - <div class="control-group"> - <label class="control-label" for="inputComment">Kommentar zum Deployment</label> - <div class="controls"> - <textarea id= rows="3" id="inputComment" name="inputComment" placeholder="Kommentar">'.$sComment.'</textarea> - </div> - </div> - '; - - return $sOut; -} - -function showPhases($sCurrentPhase=false, $sNext=false){ - include("../config/inc_projects_config.php"); - $sOut=''; - foreach (array_keys($aConfig["phases"]) as $sPhase){ - $sOut.='<div class="'.$sPhase.'" style="float: left; width: 200px; height: 3em;"> - '.$sPhase.'<br>'; - if ($sCurrentPhase==$sPhase) $sOut.='[ aktuell ]'; - if ($sNext==$sPhase) $sOut.='[ next ]'; - $sOut.='</div>'; - - } - $sOut.='<div style="clear: both;"></div>'; - return $sOut; -} - -function execAndSend($sCommand){ - $sReturn=''; - $bUseHtml=$_SERVER?true:false; - - ob_implicit_flush(true);ob_end_flush(); - $descriptorspec = array( - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from - 1 => array("pipe", "w"), // stdout is a pipe that the child will write to - 2 => array("pipe", "w") // stderr is a pipe that the child will write to - ); - flush(); - $process = proc_open($sCommand, $descriptorspec, $pipes, realpath('./'), array()); - - $sReturn.="[".date("H:i:s d.m.Y")."] $sCommand"; - $sReturn.=$bUseHtml?"<br><pre>":"\n"; - - if (is_resource($process)) { - $oStatus = proc_get_status($process); - while ($s = fgets($pipes[1])) { - $sReturn.=$s; - flush(); - } - } - $sReturn.=$bUseHtml?"</pre>":"\n"; - $sReturn.="[".date("H:i:s d.m.Y")."] finished; rc=".$oStatus['exitcode']; - $sReturn.=$bUseHtml?"<hr>":"\n---------\n"; - return $sReturn; -} - -?> diff --git a/public_html/deployment/webgui/index.htm b/public_html/deployment/webgui/index.htm deleted file mode 100644 index 1422b02e6a81e37ac02cbc631f252c1291d931c8..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/index.htm +++ /dev/null @@ -1,9 +0,0 @@ -<h1>Übersicht über alle Projekte</h1> -<p> - Ansicht aller Projekte und Versionen auf den einzelnen Deployment-Phasen -</p> - - -[[PHPOUT]] - - diff --git a/public_html/deployment/webgui/index.htm.php b/public_html/deployment/webgui/index.htm.php deleted file mode 100644 index 6afade5e6ccfbbfaaae6a5a1ba69548a764ca50a..0000000000000000000000000000000000000000 --- a/public_html/deployment/webgui/index.htm.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -require_once("../config/inc_projects_config.php"); -require_once("../classes/projectlist.class.php"); - -$oPrjList=new projectlist($aProjects); -// $oPrjList->setConfig($aProjects); -$sPhpOut=$oPrjList->renderOverview(); -?> -