28 Commits
Author SHA1 Message Date
r.didato b1a33940ff Merge branch 'development' of ssh://gogs.didato.ninja:2022/Work/fdn2 into development 2023-06-26 21:34:08 +02:00
r.didato b9be324698 #16 - Inserito nuovo tag 2023-06-26 21:34:06 +02:00
r.didato 40d0e6071a Update 'cicd/environments/production/worker.env' 2022-12-24 00:49:26 +00:00
r.didato 60dfebc676 Update 'cicd/environments/production/webserver.env' 2022-12-24 00:49:13 +00:00
r.didato 0479701b70 Update 'cicd/environments/test/worker.env' 2022-12-24 00:46:05 +00:00
r.didato f80dc6ec64 Update 'cicd/environments/test/webserver.env' 2022-12-24 00:45:53 +00:00
r.didato fc63d04c6b Fix paths 2022-11-16 22:23:00 +01:00
r.didato 0cbf98d43e Ridotto tempo di rotazione banner 2022-11-16 21:15:30 +01:00
r.didato 0359e12555 #15 Rimossi allineamenti non necessari 2022-10-10 21:02:48 +02:00
r.didato 83e17cec7c #15 - Fixed 2022-10-10 20:57:18 +02:00
r.didato 05e4c00b7f asd 2022-10-04 20:45:14 +02:00
r.didato 69eb59b93b Typpo 2022-10-04 20:42:00 +02:00
r.didato 4883c53419 Fix click Banner 2022-10-04 20:41:22 +02:00
r.didato a0bafc453f CICD 2022-10-04 19:56:49 +02:00
r.didato b515760e6d Fix config 2022-10-04 19:47:16 +02:00
r.didato ea4e0c0ec3 FromName email 2022-10-02 19:54:26 +02:00
r.didato 3f04905d22 #12 Backup + fix config email 2022-10-02 19:45:09 +02:00
r.didato 0ab6391bf3 #12 2022-10-02 19:16:59 +02:00
r.didato a66dfa8530 CICD 2022-10-02 15:58:36 +02:00
r.didato 09cf83c31b Typo 2022-10-01 20:03:35 +02:00
r.didato aac8e9786d CICD minor 2022-10-01 12:47:32 +02:00
r.didato bcfea0cfad #6 - WIP 2022-10-01 12:42:57 +02:00
r.didato 8a097b5956 #6 - Prima stesura worker 2022-09-29 23:13:55 +02:00
r.didato effeae054e Incrementata dimensione banner top a 150px 2022-09-29 21:42:47 +02:00
r.didato daabdbb566 Fixata priorità banner 2022-09-28 20:27:24 +02:00
r.didato 2ed3a2bf3c #1 - Titoli H1 2022-09-28 20:00:33 +02:00
r.didato 3b12ce1786 #11 - Fix banner sorting 2022-09-28 19:48:51 +02:00
r.didato 6c3acfe5e9 Fix git tag detection 2022-09-25 21:29:34 +02:00
56 changed files with 411 additions and 398 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
function exit_func {
echo "SIGTERM detected"
exit 1
}
trap exit_func SIGTERM SIGINT
ASD_BINDIR="/home/${DDNINJA_AUTHOR}/private/${DDNINJA_BUILDNAME}/bin"
mkdir -p "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
mkdir -p "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
mkdir -p "/var/log/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}/"
php /home/${DDNINJA_AUTHOR}/private/${DDNINJA_BUILDNAME}/bin/worker.php & wait
exit $?
+83
View File
@@ -0,0 +1,83 @@
<?php
use ASD\ThresholdTimer;
require_once(dirname(__FILE__)."/../load.php");
require_once("/home/ddninja/private/asdphp/lib/core/ThresholdTimer.php");
$timer = new ThresholdTimer(60);
function logInfo(string $msg) {
echo date("Y-m-d H:i")." - ".$msg,PHP_EOL;
}
function execHour() {
return intval(date('i')) == 0;
}
function execDay() {
return execHour() && intval(date('H')) == 3;
}
function getMinuteTasks() {
return [
GenerateAdminActivationMailTask::class,
GenerateUserActivationMailTask::class,
GenerateAdminPasswordRecoveryMailTask::class,
GenerateUserPasswordRecoveryMailTask::class,
MailSendTask::class
];
}
function getHourTasks() {
return [
// NewsletterCheckTask::class,
DeleteOldPasswordResetRequestsTask::class,
UpdateMeteoCacheTask::class,
GenerateCommentiWarningMailTask::class
];
}
function getDailyTasks() {
return [
// SendBackupTask::class
];
}
function execute($taskName) {
try {
if ($taskName::isActive()){
logInfo("Executing task $taskName");
$taskName::execute();
logInfo("Task $taskName executed with success");
}
}
catch (Exception $ex) {
logInfo("Task $taskName failed execution");
var_dump($ex);
}
}
logInfo("Worker STARTED!!");
$count = 1;
while (1) {
logInfo("Executing Minute");
foreach (getMinuteTasks() as $task ) {
execute($task);
}
if (execHour()) {
logInfo("Exec hourly");
foreach (getHourTasks() as $task ) {
execute($task);
}
}
if (execDay()) {
logInfo("Exec Daily");
foreach (getDailyTasks() as $task ) {
execute($task);
}
}
$timer->waitUntilThresholdReached(true);
}
?>
+8 -1
View File
@@ -36,7 +36,7 @@ $currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
$currentSystem->remoteLocationPath = getenv('ASD_PUBLIC_URL')."/";
$currentSystem->remoteLocationPath = getenv('DDNINJA_PUBLIC_URL')."/";
// Deprecato in quanto CBS2 è stato dismesso
$backupSystem = new stdClass();
@@ -132,4 +132,11 @@ $config->cbs2->serverPort = $cbs2->serverPort;
$config->database = $database;
$config->mailer = new stdClass();
$config->mailer->address = "email-smtp.eu-west-1.amazonaws.com";
$config->mailer->port = "587";
$config->mailer->username = "AKIASMB7IW2MQPUP5CXS";
$config->mailer->password = "BHv+82Nns1kIKg99Hx0sjKlEpR+X4+1EgX+ec64n/mBt";
$config->mailer->smtpAuth = true;
?>
+7 -8
View File
@@ -61,17 +61,16 @@ class BannerHelper {
private static function getBannerImpressions($bannerIds) {
$time = strtotime("today");
$stats = GlobalVariables::get("dao")->query(
BannerStatsModel::class,
[
'_id' => [
'$in' => array_map(
function($banner) {
return new \MongoDB\BSON\ObjectID($banner);
},
$bannerIds
)
'banner' => [
'$in' => $bannerIds
],
'y' => intval(date('Y', $time)),
'm' => intval(date('m', $time)),
'd' => intval(date('d', $time))
]
);
$rval = array_reduce(
@@ -83,7 +82,7 @@ class BannerHelper {
[]
);
foreach ($stats as $stat) {
$rval[strval($stat->id)] = intval($stat->views);
$rval[strval($stat->banner)] = intval($stat->views);
}
return $rval;
}
+1 -1
View File
@@ -193,7 +193,7 @@ class PipelineHelper {
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
'content.position'=>$position,
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today CET") * 1000) )
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today") * 1000) )
)
),
array(
+27 -17
View File
@@ -42,36 +42,46 @@ class MailModel extends Model implements FDN_MailInterface{
return parent::__set($attr, $value);
}
public function getMailObject(){
$email = new PHPMailer();
$email->CharSet = "UTF-8";
$email->isMail();
public function getMailObject() {
$email = new PHPMailer();
$email->CharSet = "UTF-8";
$email->isMail();
$email->From = $this->from;
$email->FromName = "I Fatti di Napoli";
$email->From = $this->from;
if ($this->hasProperty("fromName")){
$email->FromName = $this->fromName;
}
$email->Subject = $this->subject;
$email->Subject = $this->subject;
$email->IsHTML(true);
$email->Body = $this->body;
$email->Body = $this->body;
if ($this->hasProperty("altBody")){
$email->AltBody = $this->altBody;
}
else {
$email->AltBody = strip_tags($this->body);
}
$email->AddAddress($this->recipient);
$email->AddAddress($this->recipient);
if ($this->hasProperty("attachment")){
$email->AddAttachment( $this->attachment , basename($this->attachment) );
}
return $email;
}
$cfg = GlobalVariables::get("config");
$email->IsSMTP();
$email->Host = $cfg->mailer->address;
$email->Port = $cfg->mailer->port;
$email->Username = $cfg->mailer->username;
$email->Password = $cfg->mailer->password;
$email->SMTPAuth = $cfg->mailer->smtpAuth;
return $email;
}
public static function getCollectionName(){
return "mail";
@@ -28,7 +28,7 @@ class ArticleStatsModel extends Model {
}
public static function getFilter($articleId, $day, $month, $year) {
$time = strtotime("$year-$month-$day CET");
$time = strtotime("$year-$month-$day");
return [
'notizia' => $articleId,
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
@@ -16,7 +16,7 @@ class BannerStatsModel extends Model {
}
public static function new($bannerId, $day, $month, $year) {
$time = strtotime("$year-$month-$day CET");
$time = strtotime("$year-$month-$day");
return new static(
(object)[
'banner' => $bannerId,
@@ -30,7 +30,7 @@ class BannerStatsModel extends Model {
);
}
public static function getFilter($bannerId, $day, $month, $year) {
$time = strtotime("$year-$month-$day CET");
$time = strtotime("$year-$month-$day");
return [
'banner' => $bannerId,
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
@@ -15,7 +15,7 @@ class PageViewStatsModel extends Model {
return "pageview_stats";
}
public static function new($page, $day, $month, $year) {
$time = strtotime("$year-$month-$day CET");
$time = strtotime("$year-$month-$day");
return new static(
(object)[
@@ -33,7 +33,7 @@ class PageViewStatsModel extends Model {
}
public static function getFilter($page, $day, $month, $year) {
$time = strtotime("$year-$month-$day CET");
$time = strtotime("$year-$month-$day");
return [
'page' => $page,
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
+11 -14
View File
@@ -215,7 +215,7 @@ class GUIHandler {
<div class="leftBanner topBanner mediaContent">
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
</div>
<div class="logo"><a href="http://ifattidinapoli.it/index.php"><img src="http://ifattidinapoli.it/images/logo_uff.png"></a></div>
<div class="logo"><a href="http://www.ifattidinapoli.it/index.php"><img src="http://www.ifattidinapoli.it/images/logo_uff.png"></a></div>
<div class="rightBanner topBanner mediaContent">
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
</div>
@@ -381,7 +381,7 @@ class GUIHandler {
$stats = GlobalVariables::get("dao")->aggregate(
ArticleStatsModel::class,
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days CET"),5)
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5)
);
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
@@ -449,19 +449,16 @@ class GUIHandler {
public static function generateGoogleAnalyticsScripts(){
?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
// ga('create', 'UA-75287906-1', 'auto');
// ga('send', 'pageview');
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YTMS8G32Q"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-5YTMS8G32Q');
</script>
ga('create', 'UA-6137905-1', 'auto');
ga('send', 'pageview');
</script>
<?php
}
+9 -12
View File
@@ -467,19 +467,16 @@ class GUIHandlerMobile {
public static function generateGoogleAnalyticsScripts(){
?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-75287906-1', 'auto');
ga('send', 'pageview');
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YTMS8G32Q"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-5YTMS8G32Q');
</script>
ga('create', 'UA-6137905-1', 'auto');
ga('send', 'pageview');
</script>
<?php
}
+3 -3
View File
@@ -28,9 +28,9 @@ class MenuGenerator {
array("label"=>"Utenti registrati","page"=>"listUsers.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
array("label"=>"Newsletter", "subvoices"=>array(
array("label"=>"Nuova","page"=>"editNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
array("label"=>"Da inviare","page"=>"pendingNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
array("label"=>"Inviate","page"=>"sentNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
// array("label"=>"Nuova","page"=>"editNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
// array("label"=>"Da inviare","page"=>"pendingNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
// array("label"=>"Inviate","page"=>"sentNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
array("label"=>"Nuova Mail","page"=>"editMail.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
array("label"=>"Coda Mail","page"=>"listMail.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN)
)),
+2
View File
@@ -4,6 +4,8 @@ Author: Riccardo Di Dato
Creation Date: 04/feb/2013
*/
date_default_timezone_set("Europe/Rome");
require_once(dirname(__FILE__)."/common/config.php");
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
+4 -4
View File
@@ -72,13 +72,13 @@ try{
<div class="bannerStat">
<div>
<div class="statName">Oggi</div>
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today CET"));?></div>
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today CET"));?></div>
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today"));?></div>
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today"));?></div>
</div>
<div>
<div class="statName">Ultima settimana</div>
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days CET"));?></div>
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days CET"));?></div>
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days"));?></div>
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days"));?></div>
</div>
<div>
<div class="statName">Totali</div>
+2 -2
View File
@@ -144,11 +144,11 @@ try{
<div class="notiziaStat">
<div>
<div class="statName">Oggi</div>
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today CET"));?></div>
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today"));?></div>
</div>
<div>
<div class="statName">Ultima settimana</div>
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days CET"));?></div>
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days"));?></div>
</div>
<div>
<div class="statName">Totali</div>
+1 -1
View File
@@ -74,7 +74,7 @@ HTMLHelper::generateAdminHead();
<li>Banner testata:<b>180x60px</b></li>
<li>Banner corpo:<b>160x120px</b></li>
<li>Banner lungo:<b>160x240px</b></li>
<li>Banner Inizio pagina:<b>1000x120px</b></li>
<li>Banner Inizio pagina:<b>1000x150px</b></li>
<li>Banner Fine pagina:<b>1000x200px</b></li>
</ul>
Tale restizione &egrave; consigliata anche per i banner di tipo <i>HTML5</i>.
+1 -1
View File
@@ -172,7 +172,7 @@ GUIHandler::generateHtmlHeaders(array("additionalMetadata"=>$additionalHeaders,"
?>
</div>
<div class="articoloTitle">
<div class="title" itemprop="name"><?php echo htmlentities($articolo->titolo);?></div>
<h1 class="title" itemprop="name"><?php echo htmlentities($articolo->titolo);?></h1>
<div class="subTitle">
<span><?php echo $data;?> &mdash;</span>
<span itemprop="headline"><?php echo $articolo->sottotitolo;?></span>
+25 -3
View File
@@ -1,5 +1,5 @@
const MAX_EXECUTIONS = 12;
const ROTATION_INTERVAL = 30000;
const ROTATION_INTERVAL = 12000;
const executions = {};
@@ -41,7 +41,29 @@ function bannerGroup(group, grpName) {
(target) => {
if (rval.length > 0) {
const ele = rval.shift();
$('#'+target).html(ele.media);
let mediaHtml = ele.media;
if (ele.link) {
const a = document.createElement('a');
a.href = ele.link;
a.target = "_blank";
a.innerHTML = ele.media;
mediaHtml = a;
}
mediaHtml.addEventListener(
'click',
() => {
$.ajax({
url: "stats/bannerClick.php",
method: "POST",
data: {
banner: ele.id,
source: document.URL
},
dataType: "html"
});
}
);
$('#'+target).html(mediaHtml);
}
}
);
@@ -66,5 +88,5 @@ function resortGroup(group) {
}
function compareEle(a, b) {
return a.views >= b.views;
return a.views - b.views;
}
+1 -1
View File
@@ -198,7 +198,7 @@ GUIHandlerMobile::generateHtmlHeaders(array("additionalMetadata"=>$additionalHea
?>
</div>
<div class="articoloTitle">
<p class="title" itemprop="name"><?php echo htmlentities($articolo->titolo);?></p>
<h1 class="title" itemprop="name"><?php echo htmlentities($articolo->titolo);?></h1>
<p class="subTitle">
<span><?php echo $data;?> &mdash;</span>
<span itemprop="headline"><?php echo $articolo->sottotitolo;?></span>
+1 -24
View File
@@ -4,29 +4,6 @@ Author: Riccardo Di Dato
Creation Date: 02/mar/2016
*/
require_once(dirname(__FILE__)."/../../load.php");
try {
if (array_key_exists("HTTP_REFERER",$_SERVER)){
$host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if (strcmp($host,$_SERVER["SERVER_NAME"])==0){
$banner = PostHandler::get("banner");
$source = PostHandler::get("source");
if (!is_null($banner) && !is_null($source)){
AnalyticsHelper::saveBannerClick($banner, $source);
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from referer '".$host."'");
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from null referer. Related ip '".$_SERVER['REMOTE_ADDR']."'");
}
}
catch (Exception $ex){
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Error while logging statistical data. Message: '".$ex->getMessage()."'");
}
include(dirname(__FILE__)."/../../stats/bannerClick.php");
?>
+1 -25
View File
@@ -4,30 +4,6 @@ Author: Riccardo Di Dato
Creation Date: 02/mar/2016
*/
require_once(dirname(__FILE__)."/../../load.php");
try {
if (array_key_exists("HTTP_REFERER",$_SERVER)){
$host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if (strcmp($host,$_SERVER["SERVER_NAME"])==0){
$ip = PostHandler::get("ip");
$banner = PostHandler::get("banner");
$source = PostHandler::get("source");
if (!is_null($ip) && !is_null($banner) && !is_null($source)){
AnalyticsHelper::saveBannerImpression($ip, $banner, $source);
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from referer '".$host."'");
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from null referer. Related ip '".$_SERVER['REMOTE_ADDR']."'");
}
}
catch (Exception $ex){
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Error while logging statistical data. Message: '".$ex->getMessage()."'");
}
include(dirname(__FILE__)."/../../stats/bannerImpression.php");
?>
@@ -0,0 +1,9 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 02/mar/2016
*/
include(dirname(__FILE__)."/../../stats/bannerMultiImpression.php");
?>
+1 -26
View File
@@ -3,31 +3,6 @@
Author: Riccardo Di Dato
Creation Date: 28/gen/2016
*/
require_once(dirname(__FILE__)."/../../load.php");
try {
if (array_key_exists("HTTP_REFERER",$_SERVER)){
$host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if (strcmp($host,$_SERVER["SERVER_NAME"])==0){
$ip = PostHandler::get("ip");
$notizia = PostHandler::get("notizia");
$source = PostHandler::get("source");
if (!is_null($ip) && !is_null($notizia) && !is_null($source)){
AnalyticsHelper::saveNotiziaImpression($ip, $notizia, $source);
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from referer '".$host."'");
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from null referer. Related ip '".$_SERVER['REMOTE_ADDR']."'");
}
}
catch (Exception $ex){
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Error while logging statistical data. Message: '".$ex->getMessage()."'");
}
include(dirname(__FILE__)."/../../stats/notiziaImpression.php");
?>
+1 -25
View File
@@ -4,30 +4,6 @@ Author: Riccardo Di Dato
Creation Date: 27/gen/2016
*/
require_once(dirname(__FILE__)."/../../load.php");
try {
if (array_key_exists("HTTP_REFERER",$_SERVER)){
$host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
if (strcmp($host,$_SERVER["SERVER_NAME"])==0){
$ip = PostHandler::get("ip");
$content = PostHandler::get("content");
$source = PostHandler::get("source");
if (!is_null($ip) && !is_null($content) && !is_null($source)){
AnalyticsHelper::savePageImpression($ip, $content, $source);
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from referer '".$host."'");
}
}
else {
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Dropped statistical data coming from null referer. Related ip '".$_SERVER['REMOTE_ADDR']."'");
}
}
catch (Exception $ex){
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_INFO,"Error while logging statistical data. Message: '".$ex->getMessage()."'");
}
include(dirname(__FILE__)."/../../stats/pageImpression.php");
?>
+1 -1
View File
@@ -154,7 +154,7 @@ body{font-family:lato, arial;}
.headArticolo .newsImage{width:100vw;text-align:center;overflow:hidden;}
.headArticolo .newsImage img{max-width:100%;}
.articoloTitle{width:90%;padding:10px;margin:auto;}
.articoloTitle .title{ font-weight:bold; color:black; }
.articoloTitle .title{ font-weight:bold; color:black; margin: 0; font-size: 1.8em; }
.articoloTitle .subTitle{font-weight:italic;color:#9a9a9a;}
.articoloBody{width:90vw;margin:auto;}
.articoloBody .articoloTesto{text-align:justify;padding:5px;}
+1 -1
View File
@@ -17,7 +17,7 @@ try {
if (!is_null($ip) && !is_null($banners) && !is_null($source)){
$banners = explode(",", $banners);
$ts = strtotime('today CET');
$ts = strtotime('today');
foreach ($banners as $banner) {
AnalyticsHelper::bannerImpression(
+2 -2
View File
@@ -28,7 +28,7 @@ body{font-family:lato, arial;}
.rightBanner{position:absolute;top:45px;right:10px;}
.topBanner{width:180px;height:60px;}
.topBanner > * { max-width:100%; max-height:100%; }
.subheadBanner { width:1000px; height:120px; }
.subheadBanner { width:1000px; height:150px; }
.footerBanner { width:1000px; height:200px; }
@@ -370,7 +370,7 @@ display: inline-block;
.articoloMainMedia.mediaContent img{max-height:225px;cursor:pointer;}
.articoloTitle{display:inline-block;width:550px;padding:0px 20px;vertical-align:top;text-align:left;}
.articoloTitle > .title{font-size:20px;font-weight:bold;text-transform:uppercase;font-family:"Arial Bold";}
.articoloTitle > .title{font-size:20px;font-weight:bold;text-transform:uppercase;font-family:"Arial Bold"; margin: 0;}
.articoloTitle > .subTitle{font-style:italic;font-family:"Arial Bold";}
.subTitle > span:first-child{color:rgb(150,150,150);text-transform:none;font-weight:bold;}
+13
View File
@@ -0,0 +1,13 @@
FROM alpine:3.6
RUN apk add --no-cache --upgrade bash mongodb-tools
# copy crontabs for root user
COPY crontab /etc/crontabs/root
# copy backup script
COPY backup /myscripts/backup
RUN chmod 0744 /myscripts/backup
# start crond with log level 8 in foreground, output to stderr
CMD ["crond", "-f", "-d", "8"]
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
DATE=`date +"%Y-%m-%d_%H:%M"`
echo "Generating backup $DATE"
DATABASE_HOST="fdn2.production.database"
DATABASE_NAME="fdn2"
DATABASE_PORT="27017"
WORKDIR="/workdir"
STORAGE="/backups"
mkdir -p $WORKDIR
mongodump --host $DATABASE_HOST -d $DATABASE_NAME --port $DATABASE_PORT --out "$WORKDIR"
tar -cvzf "$STORAGE/dump-$DATE.tar.gz" "$WORKDIR"
for old in `ls -t $STORAGE | tail -n +7`; do
TOREMOVE="$STORAGE/$old"
echo "Removing '$TOREMOVE'";
rm -r $TOREMOVE
done
+1
View File
@@ -0,0 +1 @@
4 0 * * * /myscripts/backup 2>&1
+17
View File
@@ -0,0 +1,17 @@
version: "3"
services:
backup:
image: cronjob
build: ./
networks:
- backup-network
restart: "unless-stopped"
volumes:
- /home/ddninja/fdn2/backups:/backups
networks:
backup-network:
external: true
name:
backup-network
+36 -18
View File
@@ -5,8 +5,11 @@ services:
restart: "on-failure:5"
networks:
db-network:
backup-network:
aliases:
- §PROJECT_BUILDNAME§.§ENVIRONMENT_TYPE§.database
volumes:
- ./persistence/database/mongodb:/usr/local/mongodb
- ./persistence/database/mongodb:/data/db/
logging:
driver: "json-file"
options:
@@ -30,7 +33,7 @@ services:
links:
- mongo:database
volumes:
- ./persistence/webserver/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§
- ./persistence/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§
- §PROJECT_BUILDNAME§-ws-log:/var/log/§PROJECT_AUTHOR§/
- §PROJECT_BUILDNAME§-job-comms:/jobComunication/
logging:
@@ -38,23 +41,32 @@ services:
options:
max-file: "5"
max-size: "150m"
# worker:
# image: 662348923997.dkr.ecr.eu-west-1.amazonaws.com/§PROJECT_GROUP§/edenlandia-worker:§TAG_NAME§
# env_file: worker.env
# restart: "no"
# networks:
# db-network:
# §PROJECT_BUILDNAME§-network:
# links:
# - mongo:database
# volumes:
# - §PROJECT_BUILDNAME§-storage:/home/asdynamics/storage/edenlandia-worker
# - edenlandia-worker-log:/var/log/asdynamics/
# - ~/workspace-azzurro/webapps/edenlandia-worker/app/private:/home/asdynamics/private/§PROJECT_BUILDNAME§:ro
# - §PROJECT_BUILDNAME§-job-comms:/jobComunication/
worker:
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-worker
env_file:
- environments/common/worker.env
- environments/§ENVIRONMENT_TYPE§/worker.env
depends_on:
- mongo
- memcached
restart: "on-failure:3"
networks:
db-network:
§PROJECT_BUILDNAME§-network:
links:
- mongo:database
volumes:
- ./persistence/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§
- §PROJECT_BUILDNAME§-wk-log:/var/log/§PROJECT_AUTHOR§/
- §PROJECT_BUILDNAME§-job-comms:/jobComunication/
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "150m"
memcached:
image: memcached:1.6.9-alpine
restart: "on-failure:3"
restart: "on-failure:5"
networks:
§PROJECT_BUILDNAME§-network:
logging:
@@ -66,6 +78,10 @@ services:
networks:
db-network:
§PROJECT_BUILDNAME§-network:
backup-network:
external: true
name:
backup-network
nginx-network:
external: true
name:
@@ -74,5 +90,7 @@ networks:
volumes:
§PROJECT_BUILDNAME§-ws-log:
§PROJECT_BUILDNAME§-wk-log:
§PROJECT_BUILDNAME§-db-persist:
§PROJECT_BUILDNAME§-job-comms:
§PROJECT_BUILDNAME§-job-comms:
+24 -18
View File
@@ -5,12 +5,13 @@ services:
restart: "no"
networks:
db-network:
backup-network:
aliases:
- §PROJECT_BUILDNAME§.§ENVIRONMENT_TYPE§.database
- §PROJECT_BUILDNAME§.local.database
volumes:
- §PROJECT_BUILDNAME§-db-persist:/usr/local/mongodb
- §PROJECT_BUILDNAME§-db-persist:/data/db/
webserver:
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-debug
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-webserver-debug
env_file:
- environments/common/webserver.env
- environments/local/webserver.env
@@ -28,20 +29,22 @@ services:
- §DEBUG_HOST_PROJECT_FOLDER§/app/public:/var/www/§PROJECT_BUILDNAME§:ro
- §DEBUG_HOST_PROJECT_FOLDER§/app/private:/home/§PROJECT_AUTHOR§/private/§PROJECT_BUILDNAME§:ro
- §PROJECT_BUILDNAME§-job-comms:/jobComunication/
# worker:
# image: 662348923997.dkr.ecr.eu-west-1.amazonaws.com/§PROJECT_GROUP§/edenlandia-worker:§TAG_NAME§
# env_file: worker.env
# restart: "no"
# networks:
# db-network:
# §PROJECT_BUILDNAME§-network:
# links:
# - mongo:database
# volumes:
# - §PROJECT_BUILDNAME§-storage:/home/asdynamics/storage/edenlandia-worker
# - edenlandia-worker-log:/var/log/asdynamics/
# - ~/workspace-azzurro/webapps/edenlandia-worker/app/private:/home/asdynamics/private/§PROJECT_BUILDNAME§:ro
# - §PROJECT_BUILDNAME§-job-comms:/jobComunication/
worker:
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-worker-debug
env_file:
- environments/common/worker.env
- environments/local/worker.env
restart: "no"
networks:
db-network:
§PROJECT_BUILDNAME§-network:
links:
- mongo:database
volumes:
- §PROJECT_BUILDNAME§-storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§
- ./worker-logs:/var/log/§PROJECT_AUTHOR§/
- §DEBUG_HOST_PROJECT_FOLDER§/app/private:/home/§PROJECT_AUTHOR§/private/§PROJECT_BUILDNAME§:ro
- §PROJECT_BUILDNAME§-job-comms:/jobComunication/
memcached:
image: memcached:1.6.9-alpine
restart: "no"
@@ -51,11 +54,14 @@ services:
networks:
db-network:
§PROJECT_BUILDNAME§-network:
backup-network:
external: true
name:
backup-network
volumes:
§PROJECT_BUILDNAME§-storage:
§PROJECT_BUILDNAME§-log:
# edenlandia-worker-log:
§PROJECT_BUILDNAME§-db-persist:
§PROJECT_BUILDNAME§-job-comms:
+2 -2
View File
@@ -1,5 +1,5 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
@@ -27,7 +27,7 @@ COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install webserver
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
+2 -2
View File
@@ -1,5 +1,5 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
@@ -27,7 +27,7 @@ COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install webserver
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
+2 -2
View File
@@ -1,4 +1,4 @@
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§-unit
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver-unit
WORKDIR /§PROJECT_BUILDNAME§
COPY ./app /§PROJECT_BUILDNAME§
@@ -9,7 +9,7 @@ COPY ./test/install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install webserver
ENTRYPOINT ["/usr/local/bin/phpunit"]
CMD ["--help"]
+2 -2
View File
@@ -1,5 +1,5 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-worker
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
@@ -27,7 +27,7 @@ COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install worker
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
+2 -2
View File
@@ -1,5 +1,5 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-worker
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
@@ -27,7 +27,7 @@ COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install worker
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
+2 -2
View File
@@ -1,4 +1,4 @@
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§-unit
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-worker-unit
WORKDIR /§PROJECT_BUILDNAME§
COPY ./app /§PROJECT_BUILDNAME§
@@ -9,7 +9,7 @@ COPY ./test/install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install worker
ENTRYPOINT ["/usr/local/bin/phpunit"]
CMD ["--help"]
+3
View File
@@ -0,0 +1,3 @@
DDNINJA_PROJECTNAME=FDN2
DDNINJA_BUILDNAME=fdn2
DDNINJA_AUTHOR=ddninja
+7
View File
@@ -0,0 +1,7 @@
DDNINJA_ENVIRONMENT_NAME=local
DDNINJA_IS_PRODUCTION=false
DDNINJA_MONGO_DBNAME=fdn2
DDNINJA_MONGO_LOCATION=database
DDNINJA_PUBLIC_URL=http://www.fdn2.loc:8800
+2 -2
View File
@@ -2,6 +2,6 @@ DDNINJA_ENVIRONMENT_NAME=production
DDNINJA_IS_PRODUCTION=true
DDNINJA_MONGO_DBNAME=fdn2
DDNINJA_MONGO_LOCATION=database
DDNINJA_MONGO_LOCATION=mongo
DDNINJA_PUBLIC_URL=http://preproduction.ifattidinapoli.it
DDNINJA_PUBLIC_URL=http://www.ifattidinapoli.it
+7
View File
@@ -0,0 +1,7 @@
DDNINJA_ENVIRONMENT_NAME=production
DDNINJA_IS_PRODUCTION=true
DDNINJA_MONGO_DBNAME=fdn2
DDNINJA_MONGO_LOCATION=mongo
DDNINJA_PUBLIC_URL=http://www.ifattidinapoli.it
+1 -1
View File
@@ -2,6 +2,6 @@ DDNINJA_ENVIRONMENT_NAME=test
DDNINJA_IS_PRODUCTION=false
DDNINJA_MONGO_DBNAME=fdn2_test
DDNINJA_MONGO_LOCATION=database
DDNINJA_MONGO_LOCATION=mongo
DDNINJA_PUBLIC_URL=http://test.ifattidinapoli.it
+7
View File
@@ -0,0 +1,7 @@
DDNINJA_ENVIRONMENT_NAME=test
DDNINJA_IS_PRODUCTION=false
DDNINJA_MONGO_DBNAME=fdn2_test
DDNINJA_MONGO_LOCATION=mongo
DDNINJA_PUBLIC_URL=http://test.ifattidinapoli.it
-2
View File
@@ -4,7 +4,6 @@ declare -A CONFIG=(
["FRAMEWORK_REPOSITORY"]="299952237278.dkr.ecr.eu-west-1.amazonaws.com"
["FRAMEWORK_IMAGE"]="ddninja/phpframework"
["FRAMEWORK_VERSION"]="2.5.4"
["FRAMEWORK_TYPE"]="webserver"
["FRAMEWORK_AUTHOR"]="ddninja"
["PROJECT_REPOSITORY"]="299952237278.dkr.ecr.eu-west-1.amazonaws.com"
@@ -23,7 +22,6 @@ declare -A CONFIG=(
FRAMEWORK_REPOSITORY=${CONFIG['FRAMEWORK_REPOSITORY']}
FRAMEWORK_IMAGE=${CONFIG['FRAMEWORK_IMAGE']}
FRAMEWORK_VERSION=${CONFIG['FRAMEWORK_VERSION']}
FRAMEWORK_TYPE=${CONFIG['FRAMEWORK_TYPE']}
FRAMEWORK_AUTHOR=${CONFIG['FRAMEWORK_AUTHOR']}
PROJECT_REPOSITORY=${CONFIG['PROJECT_REPOSITORY']}
+13 -5
View File
@@ -1,5 +1,11 @@
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
fi
TYPE=$1
my_dir="$(dirname "$0")"
DIR_RETURN=`pwd`
@@ -25,11 +31,13 @@ chown -R www-data:www-data /var/log/$PROJECT_AUTHOR
chmod 0744 /home/$PROJECT_AUTHOR/private/$PROJECT_BUILDNAME/bin/*
# Apache
cat ./os/000-${PROJECT_TYPE}.template.conf |
sed -e "s/§PROJECT_BUILDNAME§/${PROJECT_BUILDNAME}/g" \
> /etc/apache2/sites-available/000-default.conf
if [[ $TYPE == "webserver" ]]; then
cat ./os/000-${PROJECT_TYPE}.template.conf |
sed -e "s/§PROJECT_BUILDNAME§/${PROJECT_BUILDNAME}/g" \
> /etc/apache2/sites-available/000-default.conf
a2enmod rewrite
a2enmod rewrite
fi
# Overwrite opcache default config
cat ./os/opcache.template.ini |
@@ -40,7 +48,7 @@ cat ./os/opcache.template.ini |
cat ./os/php.template.ini > /usr/local/etc/php/php.ini
# Generate Entrypoint
cp "./os/webserver-entrypoint" "/usr/local/bin/$PROJECT_BUILDNAME-entrypoint"
cp "./os/${TYPE}-entrypoint" "/usr/local/bin/$PROJECT_BUILDNAME-entrypoint"
chmod 0744 /usr/local/bin/$PROJECT_BUILDNAME-entrypoint
-18
View File
@@ -1,18 +0,0 @@
#!/usr/bin/php
<?php
require_once(dirname(__FILE__). "/../load.php");
// try {
// }
// catch (UNHADBException $unex){
// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
// catch (Exception $ex){
// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
?>
-38
View File
@@ -1,38 +0,0 @@
#!/usr/bin/php
<?php
require_once(dirname(__FILE__). "/../load.php");
$tasks = array("SendBackupTask");
if (sizeof($tasks)>0){
foreach ($tasks as $taskName){
try {
if ($taskName::isActive()){
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' ");
$taskName::execute();
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully");
}
}catch (CoreException $ex){
$msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
catch (Exception $ex){
$msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
}
}
// try {
// }catch (UNHADBException $unex){
// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
// catch (Exception $ex){
// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
?>
-40
View File
@@ -1,40 +0,0 @@
#!/usr/bin/php
<?php
require_once(dirname(__FILE__). "/../load.php");
$tasks = array("NewsletterCheckTask","DeleteOldPasswordResetRequestsTask", "UpdateMeteoCacheTask", "GenerateCommentiWarningMailTask");
if (sizeof($tasks)>0){
foreach ($tasks as $taskName){
try {
if ($taskName::isActive()){
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' ");
$taskName::execute();
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully");
}
}catch (CoreException $ex){
$msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
catch (Exception $ex){
$msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
}
}
// try {
// SystemController::executeTask("RefreshApiCache.php");
// }
// catch (UNHADBException $unex){
// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("GenerateReminderMail.php",$msg),true);
// }
// catch (Exception $ex){
// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("GenerateReminderMail.php",$msg),true);
// }
?>
-37
View File
@@ -1,37 +0,0 @@
#!/usr/bin/php
<?php
/*
Author: Riccardo Di Dato
Creation Date: 12/gen/2016
*/
require_once(dirname(__FILE__). "/../load.php");
$tasks = array(
"GenerateAdminActivationMailTask",
"GenerateUserActivationMailTask",
"GenerateAdminPasswordRecoveryMailTask",
"GenerateUserPasswordRecoveryMailTask",
"MailSendTask",
);
if (sizeof($tasks)>0){
foreach ($tasks as $taskName){
try {
if ($taskName::isActive()){
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' ");
$taskName::execute();
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully");
}
}catch (CoreException $ex){
$msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
catch (Exception $ex){
$msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'";
LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg);
}
}
}
?>
-5
View File
@@ -1,5 +0,0 @@
#!/usr/bin/php
<?php
require_once(dirname(__FILE__). "/../load.php");
?>
-16
View File
@@ -1,16 +0,0 @@
#!/usr/bin/php
<?php
require_once(dirname(__FILE__). "/../load.php");
// try {
// }catch (UNHADBException $unex){
// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
// catch (Exception $ex){
// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage());
// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true);
// }
?>
+2 -2
View File
@@ -97,7 +97,7 @@ if [[ $UNIT_MODE -gt 0 ]]; then
OPTS+="v"
fi
$DIR/generateDockerfile.sh -$OPTS -o $DOCKERFILE
$DIR/generateDockerfile.sh -I "${TYPE}" -$OPTS -o $DOCKERFILE
msg "Building project image $TAG"
docker build -t $PROJECT_REPOSITORY/$PROJECT_GROUP/$PROJECT_BUILDNAME:$TAG-unit -f $DOCKERFILE .
@@ -112,7 +112,7 @@ if [[ $DEBUG_MODE -gt 0 ]]; then
OPTS+="v"
fi
$DIR/generateDockerfile.sh -$OPTS -o $DOCKERFILE
$DIR/generateDockerfile.sh -I "${TYPE}" -$OPTS -o $DOCKERFILE
msg "Building project image $TAG"
docker build -t $PROJECT_REPOSITORY/$PROJECT_GROUP/$PROJECT_BUILDNAME:$TAG-debug -f $DOCKERFILE .
+18 -6
View File
@@ -125,10 +125,14 @@ if [[ $UNIT_MODE -eq 1 ]]; then
BUILDOPT+="v"
UNITOPT="-v"
fi
msg "running ./build.sh -$BUILDOPT -t $TAG"
./build.sh -$BUILDOPT -t $TAG
msg "running ./build.sh -I webserver -$BUILDOPT -t \"$TAG-webserver\""
./build.sh -I webserver -$BUILDOPT -t "$TAG-webserver"
./run-unit.sh $UNITOPT -t $TAG
msg "running ./build.sh -I worker -$BUILDOPT -t \"$TAG-worker\""
./build.sh -I worker -$BUILDOPT -t "$TAG-worker"
./run-unit.sh $UNITOPT -t $TAG-webserver
./run-unit.sh $UNITOPT -t $TAG-worker
fi
if [[ $PUBLISH_MODE -eq 1 ]]; then
@@ -151,7 +155,13 @@ if [[ $PUBLISH_MODE -eq 1 ]]; then
./publish.sh $VERBOPT -t "$TAG-webserver"
# WORKER
msg "running ./build.sh -I worker -$BUILDOPT -t $TAG-worker"
./build.sh -I worker -$BUILDOPT -t "$TAG-worker"
./run-unit.sh $VERBOPT -t "$TAG-worker"
./publish.sh $VERBOPT -t "$TAG-worker"
if [[ $TAG_IMPLICIT -ne 1 ]]; then
git tag $TAG
@@ -165,8 +175,10 @@ if [[ $DEBUG_MODE -eq 1 ]]; then
if [[ $VERBOSE -gt 0 ]]; then
BUILDOPT+="v"
fi
msg "running ./build.sh -$BUILDOPT -t $TAG"
./build.sh -$BUILDOPT -t $TAG
msg "running ./build.sh -I webserver -$BUILDOPT -t $TAG-webserver"
./build.sh -$BUILDOPT -I webserver -t $TAG-webserver
msg "running ./build.sh -I worker -$BUILDOPT -t $TAG-worker"
./build.sh -$BUILDOPT -I worker -t $TAG-worker
OUT_FOLDER="/home/$PROJECT_AUTHOR/$PROJECT_BUILDNAME/local"
mkdir -p $OUT_FOLDER
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
git pull --quiet
git tag -l --sort=-version:refname | head -n 1
git tag | tr - \~ | sort -V | tr \~ - | tail -n 1