Compare commits
34
Commits
2.0.3-rc.1
...
2.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1a33940ff | ||
|
|
b9be324698 | ||
|
|
40d0e6071a | ||
|
|
60dfebc676 | ||
|
|
0479701b70 | ||
|
|
f80dc6ec64 | ||
|
|
fc63d04c6b | ||
|
|
0cbf98d43e | ||
|
|
0359e12555 | ||
|
|
83e17cec7c | ||
|
|
05e4c00b7f | ||
|
|
69eb59b93b | ||
|
|
4883c53419 | ||
|
|
a0bafc453f | ||
|
|
b515760e6d | ||
|
|
ea4e0c0ec3 | ||
|
|
3f04905d22 | ||
|
|
0ab6391bf3 | ||
|
|
a66dfa8530 | ||
|
|
09cf83c31b | ||
|
|
aac8e9786d | ||
|
|
bcfea0cfad | ||
|
|
8a097b5956 | ||
|
|
effeae054e | ||
|
|
daabdbb566 | ||
|
|
2ed3a2bf3c | ||
|
|
3b12ce1786 | ||
|
|
6c3acfe5e9 | ||
|
|
93bb9b2610 | ||
|
|
e2fb0d6d89 | ||
|
|
617a3f50eb | ||
|
|
c666b50dd8 | ||
|
|
34fb57fa81 | ||
|
|
7680378f28 |
@@ -19,12 +19,6 @@
|
||||
RewriteRule "Giornale/all/.*" "oldArticleRedirect.php" [L,QSA]
|
||||
|
||||
</Directory>
|
||||
|
||||
<IfModule xsendfile_module>
|
||||
XSendFile on
|
||||
XSendFilePath "/tmp/xsend"
|
||||
</IfModule>
|
||||
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
@@ -12,5 +12,8 @@ mkdir -p "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
|
||||
chown -R www-data:www-data "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
|
||||
chown -R www-data:www-data /var/log/${DDNINJA_AUTHOR}
|
||||
|
||||
mkdir -p "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
|
||||
chown -R www-data:www-data "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
|
||||
|
||||
asdphp-entrypoint & wait
|
||||
exit $?
|
||||
|
||||
@@ -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 $?
|
||||
Executable
+83
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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;
|
||||
|
||||
?>
|
||||
|
||||
@@ -19,9 +19,7 @@ class BannerHelper {
|
||||
}
|
||||
|
||||
public static function printBanner($position = BannerModel::POSITION_HEAD){
|
||||
$category = BannerModel::GENERAL_CATEGORY;
|
||||
|
||||
$cur = self::getPlaceholderId();
|
||||
$cur = self::getPlaceholderId();
|
||||
|
||||
if (!array_key_exists($position, self::$positions)) {
|
||||
self::$positions[$position] = [];
|
||||
@@ -63,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(
|
||||
@@ -85,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;
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
|
||||
class SimpleConfigHelper {
|
||||
|
||||
private Memcached $memcached;
|
||||
private GenericDao $dao;
|
||||
|
||||
private stdClass $config;
|
||||
|
||||
public function __construct() {
|
||||
$this->memcached = new Memcached();
|
||||
$this->memcached->addServer('memcached', 11211);
|
||||
$this->dao = GlobalVariables::get("dao");
|
||||
|
||||
$this->reload();
|
||||
}
|
||||
|
||||
public function hasValue(string $name) : bool {
|
||||
return property_exists($this->config, $name);
|
||||
}
|
||||
|
||||
public function getValue(string $name) {
|
||||
return $this->config->$name;
|
||||
}
|
||||
|
||||
public function setValue(string $name, $val) {
|
||||
$model = $this->dao->getFirst(SimpleConfig::class);
|
||||
$model->details->$name = $val;
|
||||
$this->dao->save($model);
|
||||
$this->reload($model);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function reload($model = null) {
|
||||
if (!is_null($model)) {
|
||||
$this->memcached->set($this->getCacheKey(), json_encode($model->details, JSON_FORCE_OBJECT));
|
||||
}
|
||||
else if ( !$this->isCached() ) {
|
||||
$model = $this->dao->getFirst(SimpleConfig::class);
|
||||
if (is_null($model)) {
|
||||
$model = new SimpleConfig();
|
||||
$this->dao->save($model);
|
||||
}
|
||||
$this->memcached->set($this->getCacheKey(), json_encode($model->details, JSON_FORCE_OBJECT));
|
||||
}
|
||||
|
||||
$rval = $this->memcached->get(
|
||||
$this->getCacheKey()
|
||||
);
|
||||
$this->config = json_decode($rval, false);
|
||||
}
|
||||
|
||||
private function getCacheKey() {
|
||||
return 'glob.fdn2.simpleConfig';
|
||||
}
|
||||
|
||||
private function isCached(): bool {
|
||||
return $this->memcached->get( $this->getCacheKey() ) ? true : false;
|
||||
}
|
||||
|
||||
private function flush() {
|
||||
$this->memcached->set( $this->getCacheKey(), false );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -45,6 +45,8 @@ require_once(dirname(__FILE__)."/models/stats/ArticleStatsModel.php");
|
||||
require_once(dirname(__FILE__)."/models/stats/BannerStatsModel.php");
|
||||
require_once(dirname(__FILE__)."/models/stats/PageViewStatsModel.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/models/SimpleConfig.php");
|
||||
|
||||
$dao = new GenericDao($database->dbName,$database->connectionString);
|
||||
GlobalVariables::set("dao", $dao);
|
||||
?>
|
||||
|
||||
@@ -13,13 +13,18 @@ class BannerModel extends HasMediaModel{
|
||||
const POSITION_HEAD = 1;
|
||||
const POSITION_BODY = 2;
|
||||
const POSITION_LONG = 3;
|
||||
|
||||
const POSITION_TOP = 4;
|
||||
const POSITION_BOTTOM = 5;
|
||||
|
||||
const GENERAL_CATEGORY = 0;
|
||||
|
||||
public static $BANNER_POSITIONS = array(
|
||||
self::POSITION_HEAD=>array("label"=>"Testata"),
|
||||
self::POSITION_BODY=>array("label"=>"Corpo"),
|
||||
self::POSITION_LONG=>array("label"=>"Corpo Lungo")
|
||||
self::POSITION_LONG=>array("label"=>"Corpo Lungo"),
|
||||
self::POSITION_TOP=>array("label"=>"Inizio pagina"),
|
||||
self::POSITION_BOTTOM=>array("label"=>"Fine pagina")
|
||||
);
|
||||
|
||||
public function __construct($saveableObject = null){
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -47,6 +47,8 @@ class NotiziaModel extends HasMediaModel implements DaoSearchable{
|
||||
const CATEGORY_CONSIGLI_ESPERTI = 18;
|
||||
|
||||
const CATEGORY_MONDO_SPOSI = 19;
|
||||
|
||||
const CATEGORY_VARIE = 99;
|
||||
|
||||
public static $NOTIZIE_CATEGORY = array(
|
||||
self::CATEGORY_POLITICA=>array("label"=>"Politica","mainMenu"=>true,"hidden"=>false,"pages"=>array("list"=>"politica.php"),"color"=>"#3e3e3e","isSubmenu"=>null),
|
||||
@@ -69,6 +71,8 @@ class NotiziaModel extends HasMediaModel implements DaoSearchable{
|
||||
self::CATEGORY_CONSIGLI_ESPERTI=>array("label"=>"I consigli degli esperti","mainMenu"=>false, "hidden"=>false,"pages"=>array("list"=>"consigliEsperti.php"),"color"=>"#3e3e3e","isSubmenu"=>null),
|
||||
|
||||
self::CATEGORY_MONDO_SPOSI=>array("label"=>"Mondo Sposi","mainMenu"=>false, "hidden"=>false,"pages"=>array("list"=>"mondoSposi.php"),"color"=>"#dd603a","isSubmenu"=>null),
|
||||
|
||||
self::CATEGORY_VARIE=>array("label"=>"Varie","mainMenu"=>false, "hidden"=>true,"pages"=>array("list"=>"varie.php"),"color"=>"#dd603a","isSubmenu"=>null),
|
||||
);
|
||||
|
||||
public function __construct($saveableObject = null){
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 13/gen/2016
|
||||
*/
|
||||
|
||||
|
||||
class SimpleConfig extends Model {
|
||||
const VARIE_LABEL = "varie_home_label";
|
||||
|
||||
|
||||
public function __construct($saveableObject = null) {
|
||||
parent::__construct($saveableObject);
|
||||
if (!$this->hasProperty("data") || !is_object($this->details)) {
|
||||
$this->details = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "simpleConfig";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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 ),
|
||||
|
||||
@@ -19,9 +19,7 @@ class GUIHandler {
|
||||
private static $onLoadEvents = array();
|
||||
|
||||
public static function generateHtmlHeaders(array $data = array(), $admin = false){
|
||||
if ($admin) {
|
||||
ASDSessionHandler::getSessionId();
|
||||
}
|
||||
ASDSessionHandler::getSessionId();
|
||||
$conf = GlobalVariables::get("config");
|
||||
|
||||
$title = $conf->info->projectName;
|
||||
@@ -217,12 +215,15 @@ 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>
|
||||
</div>
|
||||
<div class="bottomBar" style="height:40px;width:1000px;"></div>
|
||||
<div class="bottomBar" style="width:1000px;"></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -329,6 +330,9 @@ class GUIHandler {
|
||||
self::setCookieSeen();
|
||||
}
|
||||
?>
|
||||
<div class="banner footerBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_BOTTOM);?>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footerCategory">
|
||||
<a href="index.php">Home</a>
|
||||
@@ -377,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);
|
||||
|
||||
@@ -445,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
|
||||
}
|
||||
|
||||
|
||||
@@ -343,12 +343,6 @@ class GUIHandlerMobile {
|
||||
public static function generateFooter(){
|
||||
if (!self::hasSeenCookieMessage()){
|
||||
?>
|
||||
<!-- <div class="cookieAdvice"> -->
|
||||
<!-- <div>Questo sito utilizza cookie tecnici per offrirti una migliore esperienza di navigazione sul sito.</div> -->
|
||||
<!-- <div>Navigando su questo sito accetti l'utilizzo dei cookie.</div><br/> -->
|
||||
<!-- <a class="closeAdvice">Chiudi</a> -->
|
||||
<!-- <br/><br/> -->
|
||||
<!-- </div> -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.closeAdvice').click(function(){
|
||||
@@ -363,6 +357,9 @@ class GUIHandlerMobile {
|
||||
self::setCookieSeen();
|
||||
}
|
||||
?>
|
||||
<div class="banner footerBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_BOTTOM);?>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footerButton" style="text-align:center;">
|
||||
<a href="#">
|
||||
@@ -470,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
)),
|
||||
@@ -47,7 +47,9 @@ class MenuGenerator {
|
||||
array("label"=>"Config","page"=>"editConfig.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Logs","page"=>"logs.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN)
|
||||
)),
|
||||
|
||||
|
||||
array("label"=>"Config","page"=>"simpleConfig.php"),
|
||||
|
||||
array("label"=>"Guida","page"=>"index.php"),
|
||||
|
||||
array("label"=>"Logout","page"=>"logout.php")
|
||||
|
||||
@@ -48,5 +48,8 @@ require_once(dirname(__FILE__)."/BannerHelper.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/RSSHelper.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/SimpleConfigHelper.php");
|
||||
|
||||
GlobalVariables::set("cfg", new SimpleConfigHelper());
|
||||
|
||||
?>
|
||||
@@ -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");
|
||||
|
||||
@@ -91,9 +91,17 @@ try{
|
||||
<span class="label">Posizione:</span>
|
||||
<select name="position">
|
||||
<option disabled selected style="display:none;">Seleziona Posizione</option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_HEAD?"selected":"";?> value="<?php echo BannerModel::POSITION_HEAD;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_HEAD]["label"];?></option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_BODY?"selected":"";?> value="<?php echo BannerModel::POSITION_BODY;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BODY]["label"];?></option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_LONG?"selected":"";?> value="<?php echo BannerModel::POSITION_LONG;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_LONG]["label"];?></option>
|
||||
<?php
|
||||
foreach (BannerModel::$BANNER_POSITIONS as $type => $data) {
|
||||
printf(
|
||||
'<option %s value="%s">%s</option>',
|
||||
$banner->position==$type ? "selected" : "",
|
||||
$type,
|
||||
$data['label']
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -74,6 +74,8 @@ 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>1000x150px</b></li>
|
||||
<li>Banner Fine pagina:<b>1000x200px</b></li>
|
||||
</ul>
|
||||
Tale restizione è consigliata anche per i banner di tipo <i>HTML5</i>.
|
||||
</p>
|
||||
|
||||
@@ -23,18 +23,6 @@ try{
|
||||
$newMedia = null;
|
||||
$mediaTypeSaved = PostHandler::get("mediaType");
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit = true;
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $newMedias = DaoMediaHandler::getMedias($banner);
|
||||
// if(sizeof($newMedias)>0){
|
||||
// $newMedia = reset($newMedias);
|
||||
// }
|
||||
// if($banner->hasProperty("type") && !is_null($banner->type)){
|
||||
// $mediaTypeSaved = $banner->type;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){
|
||||
$mediaType = PostHandler::get("mediaType");
|
||||
if (!is_null($mediaType) && strcmp($mediaType, "")!=0){
|
||||
@@ -98,69 +86,7 @@ try{
|
||||
else {
|
||||
throw new GUIException("Selezionare il tipo di file multimediale da utilizzare");
|
||||
}
|
||||
|
||||
|
||||
// if(is_null($bannerId) || strcmp($bannerId, "")==0){
|
||||
// $banner->customer = PostHandler::get("customer");
|
||||
// $banner->type = PostHandler::get("mediaType");
|
||||
// $banner->start = new Mongodate(strtotime(PostHandler::get("dateStart")));
|
||||
// $banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd")));
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// $bannerId = $banner->id;
|
||||
// }
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit=true;
|
||||
// // $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $file = "";
|
||||
|
||||
// $mediaType = PostHandler::get("mediaType");
|
||||
// $banner->type=$mediaType;
|
||||
// if(strcmp($mediaType, "")!=0){
|
||||
// $tmp = array();
|
||||
// $saveable = new stdClass();
|
||||
// $saveable->mediaType = $mediaType;
|
||||
// if(strcmp($mediaType,MediaModel::TYPE_HTML5)==0){
|
||||
// $saveable->code = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewTextBasedMedia($saveable);
|
||||
// }
|
||||
// else if(strcmp($mediaType,MediaModel::TYPE_IMAGE)==0){
|
||||
// $file = $_FILES['data']['tmp_name'];
|
||||
// $info = pathinfo($_FILES['data']['name']);
|
||||
// // $file = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
|
||||
// }
|
||||
|
||||
// if(!is_null($media)){
|
||||
// GlobalVariables::get("dao")->save($media);
|
||||
// DaoMediaHandler::addMedia($banner, $media);
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Cannot save a null media in the news with id '".$bannerId."'");
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Invalid mediaType '".$mediaType."' while trying to add the media in editBanner");
|
||||
// }
|
||||
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
}
|
||||
// else if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "delete")==0){
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $medias = DaoMediaHandler::getMedias($banner);
|
||||
// // $media = reset($medias);
|
||||
// // $media = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$mediaId));
|
||||
// foreach ($medias as $media){
|
||||
// DaoMediaHandler::deleteMedia($banner, $media);
|
||||
// $banner->type = null;
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// }
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<span class="label">Seleziona file</span><input type="file" name="data" />';
|
||||
if($edit && !is_null($newMedia)){
|
||||
@@ -173,6 +99,7 @@ try{
|
||||
}catch(GUIException $ex){
|
||||
$error = $ex->getMessage();
|
||||
}catch (Exception $exec){
|
||||
var_dump($exec);
|
||||
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_ERROR, $exec->getMessage());
|
||||
$error = "Si è verificato un errore inaspettato durante l'esecuzione della pagina. Se l'errore persiste contattare il supporto tecnico.";
|
||||
}
|
||||
@@ -196,6 +123,8 @@ try{
|
||||
<option value="<?php echo BannerModel::POSITION_HEAD;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_HEAD]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_BODY;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BODY]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_LONG;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_LONG]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_TOP;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_TOP]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_BOTTOM;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BOTTOM]["label"];?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 25/gen/2016
|
||||
*/
|
||||
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
GUIHandler::generateHtmlHeaders(array(),true);
|
||||
|
||||
if (!AdminLoginManager::isLogged()){
|
||||
GUIHandler::redirect("admin/login.php");
|
||||
}
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_NORMALADMIN)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
$saved = false;
|
||||
$action = PostHandler::get("action");
|
||||
if (!is_null($action) && strcmp("", $action)!=0){
|
||||
if (strcmp("save", $action)==0){
|
||||
|
||||
if (PostHandler::get(SimpleConfig::VARIE_LABEL)) {
|
||||
GlobalVariables::get("cfg")->setValue(SimpleConfig::VARIE_LABEL, PostHandler::get(SimpleConfig::VARIE_LABEL));
|
||||
}
|
||||
|
||||
$saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
if ($saved){
|
||||
echo '<div style="color:green;">Dati salvati con successo</div>';
|
||||
}
|
||||
?>
|
||||
<form id="taskForm" method="POST" action="">
|
||||
<input type="hidden" name="action" value="" />
|
||||
<div><span class="label"> </span><b>Tasks</b></div>
|
||||
<?php
|
||||
printf(
|
||||
'<div><span class="label">Varie (home)</span><input type="text" name="%s" value="%s" /><br/>',
|
||||
SimpleConfig::VARIE_LABEL,
|
||||
GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ? GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL) : ""
|
||||
)
|
||||
?>
|
||||
</form>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="taskForm_salva" >Salva</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#taskForm_salva").click(function(event){
|
||||
$("form#taskForm input[type=hidden][name=action]").val("save");
|
||||
$("form#taskForm").submit();
|
||||
});
|
||||
$("#taskForm_annulla").click(function(event){
|
||||
$("form#taskForm input[type=hidden][name=action]").val("cancel");
|
||||
$("form#taskForm").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -133,6 +133,13 @@ GUIHandler::generateHtmlHeaders(array("additionalMetadata"=>$additionalHeaders,"
|
||||
<div class="clickableImageContainer" onclick="javascript:hidePreview()"></div> -->
|
||||
<div style="width:1000px;margin-left:auto;margin-right:auto;" itemscope itemtype="http://schema.org/Article">
|
||||
<?php
|
||||
|
||||
$categoryName = NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["label"];
|
||||
if ($articolo->category == NotiziaModel::CATEGORY_VARIE) {
|
||||
if ( GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ) {
|
||||
$categoryName = GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
GUIHandler::generateHeadPublic();
|
||||
GUIHandler::generateMenu();
|
||||
@@ -140,7 +147,7 @@ GUIHandler::generateHtmlHeaders(array("additionalMetadata"=>$additionalHeaders,"
|
||||
<div class="articoloCategory">
|
||||
<div class="categoryStyle">
|
||||
<div class="icon"><img alt="" src="images/categoryIcon.png"></div>
|
||||
<div class="articoloCategoryName" style="background-color:<?php echo NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["color"] ?>"><span itemprop="articleSection"><?php echo strtoupper(NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["label"]);?></span></div>
|
||||
<div class="articoloCategoryName" style="background-color:<?php echo NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["color"] ?>"><span itemprop="articleSection"><?php echo strtoupper($categoryName);?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="articoloContainer" >
|
||||
@@ -165,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;?> —</span>
|
||||
<span itemprop="headline"><?php echo $articolo->sottotitolo;?></span>
|
||||
|
||||
@@ -12,17 +12,11 @@ if (array_key_exists("id",$_GET)) {
|
||||
if (!is_null($pdfModel)){
|
||||
$localFilePath = GlobalVariables::get("config")->paths->media."/".$id.".".$pdfModel->extension;
|
||||
if (SFSManager::fileExists($localFilePath)){
|
||||
$exposedFilePath = GlobalVariables::get("config")->paths->xsendfile."/".$id.".".$pdfModel->extension;
|
||||
if (!SFSManager::fileExists($exposedFilePath)){
|
||||
if (!SFSManager::fileExists(GlobalVariables::get("config")->paths->xsendfile) || !is_dir(GlobalVariables::get("config")->paths->xsendfile)){
|
||||
SystemController::mkdir(GlobalVariables::get("config")->paths->xsendfile);
|
||||
}
|
||||
SystemController::shellExec("ln",'-nFs "'.$localFilePath.'" "'.$exposedFilePath.'"');
|
||||
}
|
||||
header('X-Sendfile: '.$exposedFilePath.'');
|
||||
|
||||
header("Content-type: application/octet-stream");
|
||||
header('Content-Disposition: attachment; filename="' . basename($exposedFilePath) . '"');
|
||||
header('Content-Disposition: attachment; filename="' . $id.".".$pdfModel->extension . '"');
|
||||
|
||||
echo file_get_contents($localFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+37
-26
@@ -154,15 +154,27 @@ try {
|
||||
// }
|
||||
|
||||
|
||||
$animalNews = GlobalVariables::get("dao")->getFirst("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_MONDO_SPOSI,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1))
|
||||
);
|
||||
if (!is_null($animalNews)){
|
||||
$animalNews->testo = strip_tags($animalNews->testo);
|
||||
$animalNews->sottotitolo = strip_tags($animalNews->sottotitolo);
|
||||
}
|
||||
$varie = GlobalVariables::get("dao")->query(
|
||||
NotiziaModel::class,
|
||||
[
|
||||
"status"=>NotiziaModel::STATUS_ACCEPTED,
|
||||
"category"=>NotiziaModel::CATEGORY_VARIE,
|
||||
'_id'=> [ '$nin'=>$ansaIds ],
|
||||
"about.lastEdit" => [ '$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ) ]
|
||||
]
|
||||
);
|
||||
$varie = array_map(
|
||||
function ($model) {
|
||||
$model->testo = strip_tags($model->testo);
|
||||
$model->sottotitolo = strip_tags($model->sottotitolo);
|
||||
return $model;
|
||||
},
|
||||
$varie
|
||||
);
|
||||
$varieName = "Varie";
|
||||
if ( GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ) {
|
||||
$varieName = GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL);
|
||||
}
|
||||
|
||||
$saluteNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_SALUTE,'_id'=>array('$nin'=>$ansaIds),
|
||||
@@ -467,7 +479,7 @@ catch (Exception $ex){
|
||||
<?php
|
||||
if(sizeof($elezioni)>0){
|
||||
?>
|
||||
<div class="lastViaggi">
|
||||
<div class="rightCategory">
|
||||
<div class="categoryBar" style="text-align:left;">
|
||||
<div class="categoryTag"><span>SPECIALE ELEZIONI</span></div>
|
||||
<div class="categoryLine"></div>
|
||||
@@ -489,7 +501,7 @@ catch (Exception $ex){
|
||||
}
|
||||
else{
|
||||
?>
|
||||
<div class="lastViaggi">
|
||||
<div class="rightCategory">
|
||||
<div class="categoryBar" style="text-align:left;">
|
||||
<div class="categoryTag"><span>VIAGGI</span></div>
|
||||
<div class="categoryLine"></div>
|
||||
@@ -513,23 +525,22 @@ catch (Exception $ex){
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="animali">
|
||||
<div class="categoryBar" style="text-align:left;">
|
||||
<div class="categoryTag"><span>MONDO SPOSI</span></div>
|
||||
<div class="rightCategory">
|
||||
<div class="categoryBar" style="text-align:left;" >
|
||||
<div class="categoryTag"><span><?php echo strtoupper($varieName); ?></span></div>
|
||||
<div class="categoryLine"></div>
|
||||
</div>
|
||||
<?php if(!is_null($animalNews)){
|
||||
// $stringTitle = (strlen($animalNews->titolo) > 53) ? htmlentities( substr( html_entity_decode( $animalNews->titolo ) ,0,50) ) .'...' : $animalNews->titolo;
|
||||
$stringTitle = $animalNews->cutTextHtmlSafe("titolo",50);
|
||||
?>
|
||||
<a href="<?php echo $animalNews->getAbsoluteUrl();?>" class="animaliContainer">
|
||||
<?php $media = DaoMediaHandler::getMainMediaFromModel($animalNews);
|
||||
if(!is_null($media)){?>
|
||||
<div class="culturaMainMedia mediaContent"><?php $media->renderMedia(['size' => MediaImage::SIZE_MEDIUM]);?></div>
|
||||
<?php }?>
|
||||
<div class="animaliTitle"><?php echo $stringTitle;?></div>
|
||||
</a>
|
||||
<?php }?>
|
||||
<?php
|
||||
foreach ($varie as $model) {
|
||||
$media = DaoMediaHandler::hasMainMedia($model) ? DaoMediaHandler::getMainMediaFromModel($model) : null;
|
||||
printf(
|
||||
'<a href="%s" class=""><div class="mediaContent">%s</div><div class="rightColumnTitle" >%s</div></a>',
|
||||
$model->getAbsoluteUrl(),
|
||||
is_null($media) ? "" : $media->asText(['size' => MediaImage::SIZE_MEDIUM]),
|
||||
$model->cutTextHtmlSafe("titolo",50)
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="middleRightLongBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_LONG);?></div>
|
||||
</div>
|
||||
|
||||
+25
-3
@@ -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;
|
||||
}
|
||||
@@ -152,8 +152,9 @@ try {
|
||||
</div>
|
||||
<div class="archivioResults">
|
||||
<div style="text-align:center;">
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!$post){
|
||||
?>
|
||||
|
||||
@@ -128,6 +128,13 @@ GUIHandlerMobile::generateHtmlHeaders(array("additionalMetadata"=>$additionalHea
|
||||
<div style="margin-top:32vw;width:100vw;margin-left:auto;margin-right:auto;" itemscope itemtype="http://schema.org/Article">
|
||||
<?php
|
||||
|
||||
$categoryName = NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["label"];
|
||||
if ($articolo->category == NotiziaModel::CATEGORY_VARIE) {
|
||||
if ( GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ) {
|
||||
$categoryName = GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
GUIHandlerMobile::generateHeadPublic();
|
||||
GUIHandlerMobile::generateMenu();
|
||||
?>
|
||||
@@ -136,11 +143,12 @@ GUIHandlerMobile::generateHtmlHeaders(array("additionalMetadata"=>$additionalHea
|
||||
</script>
|
||||
<div class="newsContainer">
|
||||
<div style="text-align:center;">
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="articoloCategoryName" style="color:white;background-color:<?php echo NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["color"] ?>;">
|
||||
<span itemprop="articleSection"><?php echo strtoupper(NotiziaModel::$NOTIZIE_CATEGORY[$articolo->category]["label"]);?></span>
|
||||
<span itemprop="articleSection"><?php echo strtoupper($categoryName);?></span>
|
||||
</div>
|
||||
<div class="headArticolo">
|
||||
<div class="newsImage" >
|
||||
@@ -190,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;?> —</span>
|
||||
<span itemprop="headline"><?php echo $articolo->sottotitolo;?></span>
|
||||
|
||||
@@ -65,9 +65,10 @@ try{
|
||||
GUIHandlerMobile::generateHeadPublic();
|
||||
GUIHandlerMobile::generateMenu();?>
|
||||
<div class="categorySummaryContainer">
|
||||
<div style="text-align:center;">
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div style="text-align:center;">
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i=0;
|
||||
if(sizeof($notizie)>0){
|
||||
|
||||
+70
-83
@@ -6,9 +6,13 @@ Creation Date: 22/dic/2015
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
function stripModelText($model) {
|
||||
$model->testo = strip_tags($model->testo);
|
||||
$model->sottotitolo = strip_tags($model->sottotitolo);
|
||||
return $model;
|
||||
}
|
||||
|
||||
try {
|
||||
// AnalyticsHelper::logPageImpression();
|
||||
|
||||
$config = GlobalVariables::get("config");
|
||||
$directLink = $config->pages->remoteLocationPath."index.php";
|
||||
|
||||
@@ -17,122 +21,107 @@ try {
|
||||
|
||||
GUIHandlerMobile::generateHtmlHeaders(array("additionalMetadata"=>$additionalHeaders));
|
||||
|
||||
// echo "OK";
|
||||
|
||||
// var_dump(date("n"));
|
||||
|
||||
$mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile',
|
||||
'Maggio', 'Giugno', 'Luglio', 'Agosto',
|
||||
'Settembre', 'Ottobre', 'Novembre','Dicembre');
|
||||
// $day = date("d");
|
||||
$pageSelected="home";
|
||||
|
||||
// $ansaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("isAnsa"=>true,"status"=>NotiziaModel::STATUS_ACCEPTED,"about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4));
|
||||
$ansaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("isAnsa"=>true,"status"=>NotiziaModel::STATUS_ACCEPTED,"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>8));
|
||||
$ansaIds = array();
|
||||
if (sizeof($ansaNews)>0){
|
||||
$ansaIds = array_map(function($ele){return new MongoDB\BSON\ObjectID($ele->id);}, $ansaNews);
|
||||
|
||||
$ansaNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $ansaNews);
|
||||
}
|
||||
|
||||
|
||||
$ansaIds = array_map(
|
||||
function($ele){
|
||||
return new MongoDB\BSON\ObjectID($ele->id);
|
||||
},
|
||||
$ansaNews
|
||||
);
|
||||
$ansaNews = array_map(
|
||||
'stripModelText',
|
||||
$ansaNews
|
||||
);
|
||||
|
||||
|
||||
// $politicaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_POLITICA,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$politicaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_POLITICA,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($politicaNews)>0){
|
||||
$politicaNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $politicaNews);
|
||||
}
|
||||
$politicaNews = array_map(
|
||||
'stripModelText',
|
||||
$politicaNews
|
||||
);
|
||||
|
||||
|
||||
// $cronacaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_CRONACA,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$cronacaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_CRONACA,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>6)
|
||||
);
|
||||
if (sizeof($cronacaNews)>0){
|
||||
$cronacaNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $cronacaNews);
|
||||
}
|
||||
$cronacaNews = array_map(
|
||||
'stripModelText',
|
||||
$cronacaNews
|
||||
);
|
||||
|
||||
// $sportNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_SPORT,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$sportNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_SPORT,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($sportNews)>0){
|
||||
$sportNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $sportNews);
|
||||
}
|
||||
|
||||
// $culturaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_CULTURA,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$sportNews = array_map(
|
||||
'stripModelText',
|
||||
$sportNews
|
||||
);
|
||||
|
||||
$culturaNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_CULTURA,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($culturaNews)>0){
|
||||
$culturaNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $culturaNews);
|
||||
}
|
||||
$culturaNews = array_map(
|
||||
'stripModelText',
|
||||
$culturaNews
|
||||
);
|
||||
|
||||
|
||||
// $foodNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_RISTORANTI,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$foodNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_RISTORANTI,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($foodNews)>0){
|
||||
$foodNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $foodNews);
|
||||
}
|
||||
$foodNews = array_map(
|
||||
'stripModelText',
|
||||
$foodNews
|
||||
);
|
||||
|
||||
// $professioniNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
// array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_MESTIERI,'_id'=>array('$nin'=>$ansaIds),
|
||||
// "about.data"=>array('$lte'=>new MongoDate())),
|
||||
// array("sort"=>array("about.data"=>-1),"limit"=>4)
|
||||
// );
|
||||
$professioniNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_MESTIERI,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($professioniNews)>0){
|
||||
$professioniNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $professioniNews);
|
||||
}
|
||||
$professioniNews = array_map(
|
||||
'stripModelText',
|
||||
$professioniNews
|
||||
);
|
||||
|
||||
$mondoSposiNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"category"=>NotiziaModel::CATEGORY_MONDO_SPOSI,'_id'=>array('$nin'=>$ansaIds),
|
||||
"about.lastEdit"=>array('$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ))),
|
||||
array("sort"=>array("about.lastEdit"=>-1),"limit"=>4)
|
||||
);
|
||||
if (sizeof($mondoSposiNews)>0){
|
||||
$mondoSposiNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $mondoSposiNews);
|
||||
}
|
||||
$varie = GlobalVariables::get("dao")->query(
|
||||
NotiziaModel::class,
|
||||
[
|
||||
"status"=>NotiziaModel::STATUS_ACCEPTED,
|
||||
"category"=>NotiziaModel::CATEGORY_VARIE,
|
||||
'_id'=> [ '$nin'=>$ansaIds ],
|
||||
"about.lastEdit" => [ '$lte'=>new MongoDB\BSON\UTCDateTime( time() * 1000 ) ]
|
||||
]
|
||||
);
|
||||
$varie = array_map(
|
||||
'stripModelText',
|
||||
$varie
|
||||
);
|
||||
$varieName = "Varie";
|
||||
if ( GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ) {
|
||||
$varieName = GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL);
|
||||
}
|
||||
}
|
||||
catch (Exception $ex){
|
||||
echo $ex->getMessage();
|
||||
@@ -144,15 +133,15 @@ catch (Exception $ex){
|
||||
?>
|
||||
<div class="newsBarMobile">
|
||||
<div style="text-align:center;">
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="newsContainer" >
|
||||
<?php $i=0; foreach($ansaNews as $ansa){
|
||||
$i++;
|
||||
$stringTitolo = (strlen($ansa->titolo) > 103) ? htmlentities ( substr( html_entity_decode( $ansa->titolo ),0,100) ) .'...' : $ansa->titolo;
|
||||
// $stringSottotitolo = (strlen($ansa->sottotitolo) > 73) ? substr($ansa->sottotitolo,0,70).'...' : $ansa->sottotitolo;
|
||||
// $stringTesto = (strlen($ansa->testo) > 33) ? substr($ansa->testo,0,30).'...' : $ansa->testo;?>
|
||||
?>
|
||||
<div class="primaryNews">
|
||||
<a href="articolo.php?id=<?php echo $ansa->id;?>" id="ansa_<?php echo $i;?>" class="ansaNews"><?php
|
||||
$media = DaoMediaHandler::getMainMediaFromModel($ansa);
|
||||
@@ -357,12 +346,12 @@ catch (Exception $ex){
|
||||
</div>
|
||||
|
||||
<div class="newsContainer">
|
||||
<div class="categoryBar" style="background-color:<?php echo NotiziaModel::$NOTIZIE_CATEGORY[NotiziaModel::CATEGORY_MONDO_SPOSI]["color"] ?>">
|
||||
<span><?php echo NotiziaModel::$NOTIZIE_CATEGORY[NotiziaModel::CATEGORY_MONDO_SPOSI]["label"] ?></span>
|
||||
<div class="categoryBar" style="background-color: <?php echo NotiziaModel::$NOTIZIE_CATEGORY[NotiziaModel::CATEGORY_VARIE]["color"] ?>">
|
||||
<span><?php echo strtoupper($varieName); ?></span>
|
||||
</div>
|
||||
<?php if(sizeof($mondoSposiNews)>0){
|
||||
<?php if(sizeof($varie)>0){
|
||||
$i=0;
|
||||
foreach ($mondoSposiNews as $articolo){
|
||||
foreach ($varie as $articolo){
|
||||
|
||||
$stringTitolo = (strlen($articolo->titolo) > 53) ? htmlentities ( substr( html_entity_decode( $articolo->titolo ) ,0,50) ) .'...' : $articolo->titolo;
|
||||
// $string = (strlen($politica->sottotitolo) > 33) ? substr($politica->sottotitolo,0,30).'...' : $politica->sottotitolo;?>
|
||||
@@ -429,8 +418,6 @@ catch (Exception $ex){
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".newsBarMobile").css({"margin-top":$(".headContainer").outerHeight()});
|
||||
|
||||
$("img.poster").hide();
|
||||
$("video.localVideo").attr("style","");
|
||||
|
||||
|
||||
@@ -88,8 +88,9 @@ try {
|
||||
GUIHandlerMobile::generateMenu();?>
|
||||
<div class="searchResultsContainer">
|
||||
<div style="text-align:center;">
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="middleBanner mediaContent"><?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($found){
|
||||
|
||||
@@ -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");
|
||||
|
||||
?>
|
||||
@@ -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");
|
||||
|
||||
?>
|
||||
@@ -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");
|
||||
|
||||
?>
|
||||
@@ -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");
|
||||
|
||||
?>
|
||||
@@ -4,7 +4,7 @@ a{text-decoration:none;}
|
||||
body{font-family:lato, arial;}
|
||||
|
||||
/* TOP HEAD BAR/Menu/Footer (GUIHandler)*/
|
||||
.headContainer{position:fixed;background-color:white;width:100vw;top:0;left:0;z-index:10;overflow:hidden;}
|
||||
.headContainer{position:sticky;background-color:white;width:100vw;top:0;left:0;z-index:10;overflow:hidden;}
|
||||
.upperBar{text-align:center;border:1px solid #949494;border-left:0px;border-right:0px;margin:5px 0;padding:2px;font-size:8pt;color:#949494;}
|
||||
.logo{text-align:center;}
|
||||
.logo img{width:50vw;margin:auto;}
|
||||
@@ -102,7 +102,7 @@ body{font-family:lato, arial;}
|
||||
}
|
||||
|
||||
|
||||
.newsBarMobile{margin-top:32vw;width:100vw;}
|
||||
.newsBarMobile{width:100vw;}
|
||||
.newsContainer{width:100vw;}
|
||||
.newsContainer .categoryBar{padding:5px 10px;}
|
||||
.newsContainer .categoryBar > span{color:white;font-weight:bold;font-size:14pt;}
|
||||
@@ -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;}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -22,11 +22,14 @@ body{font-family:lato, arial;}
|
||||
.socialBar > a > div{display:inline-block;width:22px;height:22px;background-repeat:no-repeat;}
|
||||
|
||||
.middleBar{position:relative;height:138px;border:solid #d6d6d6 1px;border-top:0px;border-left:0px;border-right:0px;}
|
||||
.banner img{ width: 100%; height: 100%; overflow: hidden; }
|
||||
.leftBanner{position:absolute;top:45px;left:10px;}
|
||||
.logo{display:inline-block;width:50%;text-align:center;margin:12px 250px;}
|
||||
.rightBanner{position:absolute;top:45px;right:10px;}
|
||||
.topBanner{width:180px;height:60px;}
|
||||
.topBanner > *{max-widht:100%;max-height:100%;}
|
||||
.topBanner > * { max-width:100%; max-height:100%; }
|
||||
.subheadBanner { width:1000px; height:150px; }
|
||||
.footerBanner { width:1000px; height:200px; }
|
||||
|
||||
|
||||
.menuContainer{position:relative;}
|
||||
@@ -312,26 +315,29 @@ display: inline-block;
|
||||
.meteo div span{font-weight:bold;}
|
||||
|
||||
.middleRightBanner{width:210px;overflow: hidden;height: 157px;margin: 5px 0;}
|
||||
.middleRightBanner img{width:100%; heigth:100%;}
|
||||
.middleRightBanner img{width:100%; height:100%;}
|
||||
.middleRightLongBanner img{height:100%;width:100%;}
|
||||
.middleRightLongBanner{height:314px; width:210px;overflow: hidden;margin: 5px 0;}
|
||||
|
||||
.reader > .lastContainer, .lastContainer{/* max-height:120px */;display:block;padding:5px;border-bottom:dotted #C1B4B4 1px;cursor:pointer;text-decoration:none;color:black;}
|
||||
.reader > .lastContainer, .lastContainer{ display:block;padding:5px;border-bottom:dotted #C1B4B4 1px;cursor:pointer;text-decoration:none;color:black;}
|
||||
.reader > .lastContainer:last-child, .lastContainer:last-child {border-bottom: none;}
|
||||
.reader > .lastData, .lastData{font-size:12px;}
|
||||
.reader > .lastTitle, .lastTitle{font-size:12px;font-weight:bold;}
|
||||
.reader > .lastContinua, .lastContinua{text-align:right; font-size:12px;font-weight:bold;padding-bottom:5px;}
|
||||
.reader > .lastContinua a, .lastContinua a{color:#64bff0;}
|
||||
|
||||
.gossipContainer{/* max-height:165px */;/* margin-top:5px */;margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;cursor:pointer;overflow:hidden;text-decoration:none;color:black;}
|
||||
.gossipContainer{margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;cursor:pointer;overflow:hidden;text-decoration:none;color:black;}
|
||||
.gossipContainer#gossip_2{border-bottom:none;}
|
||||
.gossipTitle{margin-bottom:5px;font-weight:bold;font-size:20px;}
|
||||
.gossipSubtitle{margin-bottom:5px;color:#64bff0;font-weight:bold;font-size:15px;}
|
||||
|
||||
.animaliContainer,.viaggiContainer{/* max-height:165px; *//* margin-top:5px */;display:block;margin-bottom:5px;text-decoration:none;color:black;}
|
||||
.animaliContainer, .viaggiContainer, .variousContainer {display:block;margin-bottom:5px;text-decoration:none;color:black;}
|
||||
.animaliContainer > .culturaMainMedia,.viaggiContainer > .culturaMainMedia{text-align:left;}
|
||||
.animaliTitle,.viaggiTitle{cursor:pointer;margin-bottom:5px;font-weight:bold;font-size:17px;}
|
||||
|
||||
.rightCategory .categoryBar{ margin-bottom: 5px;}
|
||||
.rightColumnTitle{ margin-bottom:5px; font-weight:bold; font-size:17px; color: black; }
|
||||
|
||||
/*
|
||||
_ _ _ _
|
||||
/ \ _ __| |_(_) ___ ___ | | ___
|
||||
@@ -364,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;}
|
||||
|
||||
|
||||
@@ -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"]
|
||||
Executable
+24
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
4 0 * * * /myscripts/backup 2>&1
|
||||
@@ -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
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
@@ -0,0 +1,37 @@
|
||||
# Use a PHP runtime as a parent image
|
||||
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /§PROJECT_BUILDNAME§
|
||||
|
||||
# Install GD (required by mpdf)
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq --no-install-recommends libpng-dev zlib1g-dev && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN docker-php-ext-install gd
|
||||
|
||||
# Install Memcached
|
||||
RUN apt-get update && apt-get install -y libmemcached-dev \
|
||||
&& pecl install memcached-3.1.5 \
|
||||
&& docker-php-ext-enable memcached
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY ./app /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./version /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./config /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./install /§PROJECT_BUILDNAME§
|
||||
|
||||
RUN chmod 744 /§PROJECT_BUILDNAME§/install
|
||||
|
||||
RUN /§PROJECT_BUILDNAME§/install webserver
|
||||
|
||||
|
||||
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
|
||||
|
||||
# Make port 80 available to the world outside this container
|
||||
EXPOSE 80
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Use a PHP runtime as a parent image
|
||||
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /§PROJECT_BUILDNAME§
|
||||
|
||||
# Install XDebug
|
||||
RUN pecl install xdebug | tail -n 1 | awk -F"\"" '{print $2}' > /usr/local/etc/php/conf.d/xdebug.ini
|
||||
RUN echo "\n\n[XDebug]\nxdebug.mode=debug\nxdebug.start_with_request=yes\nxdebug.client_host = §DEBUG_REMOTE_IP§\nxdebug.client_port = §DEBUG_REMOTE_PORT§\n" >> /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
# Install Memcached
|
||||
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
|
||||
&& pecl install memcached-3.1.5 \
|
||||
&& docker-php-ext-enable memcached
|
||||
|
||||
# Install SOAP
|
||||
RUN docker-php-ext-install soap
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY ./app /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./version /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./config /§PROJECT_BUILDNAME§
|
||||
|
||||
COPY ./install /§PROJECT_BUILDNAME§
|
||||
|
||||
RUN chmod 744 /§PROJECT_BUILDNAME§/install
|
||||
|
||||
RUN /§PROJECT_BUILDNAME§/install webserver
|
||||
|
||||
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
|
||||
|
||||
# Make port 80 available to the world outside this container
|
||||
EXPOSE 80
|
||||
@@ -0,0 +1,15 @@
|
||||
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-webserver-unit
|
||||
|
||||
WORKDIR /§PROJECT_BUILDNAME§
|
||||
COPY ./app /§PROJECT_BUILDNAME§
|
||||
COPY ./test /test§PROJECT_BUILDNAME§
|
||||
COPY ./version /§PROJECT_BUILDNAME§
|
||||
COPY ./config /§PROJECT_BUILDNAME§
|
||||
COPY ./test/install /§PROJECT_BUILDNAME§
|
||||
|
||||
RUN chmod 744 /§PROJECT_BUILDNAME§/install
|
||||
|
||||
RUN /§PROJECT_BUILDNAME§/install webserver
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/phpunit"]
|
||||
CMD ["--help"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
@@ -1,2 +1,3 @@
|
||||
DDNINJA_PROJECTNAME=FDN2
|
||||
DDNINJA_BUILDNAME=fdn2
|
||||
DDNINJA_AUTHOR=ddninja
|
||||
@@ -0,0 +1,3 @@
|
||||
DDNINJA_PROJECTNAME=FDN2
|
||||
DDNINJA_BUILDNAME=fdn2
|
||||
DDNINJA_AUTHOR=ddninja
|
||||
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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']}
|
||||
|
||||
@@ -37,4 +37,4 @@ db.notizia.ensureIndex({"about.author": "text",sottotitolo: "text",testo: "text"
|
||||
|
||||
db.article_stats.ensureIndex({ "notizia": 1, "time": 1, "deleted": 1 }, {name: "quick_upsert"})
|
||||
db.banner_stats.ensureIndex({ "banner": 1, "time": 1, "deleted": 1 }, {name: "quick_upsert"})
|
||||
db.pageview_stats.ensureIndex({ "deleted": 1, "time": 1, "page": 1 }, {name: "quick_upsert"})
|
||||
db.pageview_stats.ensureIndex({ "time": 1, "page": 1, "deleted": 1, }, {name: "quick_upsert"})
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
|
||||
|
||||
?>
|
||||
@@ -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);
|
||||
// }
|
||||
|
||||
?>
|
||||
@@ -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);
|
||||
|
||||
// }
|
||||
|
||||
?>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require_once(dirname(__FILE__). "/../load.php");
|
||||
|
||||
?>
|
||||
@@ -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);
|
||||
// }
|
||||
|
||||
?>
|
||||
+10
-6
@@ -15,9 +15,10 @@ source "$DIR/../config"
|
||||
source "$DIR/libs.sh"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [-h] [-v] [-t: version] [image type, see below] " 1>&2;
|
||||
echo "Usage: $0 [-h] [-v] [-t: version] -I <webserver|worker> [image type, see below] " 1>&2;
|
||||
echo "This script builds framework docker images, the following options are available:" 1>&2;
|
||||
echo " -h: This message" 1>&2;
|
||||
echo " -I: Image (webserver or worker)" 1>&2;
|
||||
echo " Image types (at least one, otherwise the script does nothing)" 1>&2;
|
||||
echo " -a: All, same as ub" 1>&2;
|
||||
echo " -u: Unit" 1>&2;
|
||||
@@ -33,9 +34,13 @@ UNIT_MODE=0
|
||||
DEBUG_MODE=0
|
||||
|
||||
TAG="local"
|
||||
TYPE="webserver"
|
||||
|
||||
while getopts "t:hvaubd" o; do
|
||||
while getopts "I:t:hvaubd" o; do
|
||||
case "${o}" in
|
||||
I)
|
||||
TYPE="${OPTARG}"
|
||||
;;
|
||||
b)
|
||||
BASE_MODE=1
|
||||
;;
|
||||
@@ -66,7 +71,6 @@ while getopts "t:hvaubd" o; do
|
||||
done
|
||||
|
||||
|
||||
|
||||
cd ".."
|
||||
|
||||
# STANDARD MODE
|
||||
@@ -78,7 +82,7 @@ if [[ $BASE_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 -f $DOCKERFILE .
|
||||
@@ -93,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 .
|
||||
@@ -108,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 .
|
||||
|
||||
+29
-14
@@ -116,11 +116,6 @@ if [[ $SELECTED_MODES -ne 1 ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ $AUTOTAG -eq 1 ]]; then
|
||||
TAG=`./next-ver.sh -${TAG_OPTS}`
|
||||
echo "Using tag $TAG"
|
||||
fi
|
||||
|
||||
./aws-login.sh
|
||||
|
||||
if [[ $UNIT_MODE -eq 1 ]]; then
|
||||
@@ -130,25 +125,43 @@ 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
|
||||
if [[ $AUTOTAG -eq 1 ]]; then
|
||||
TAG=`./next-ver.sh -${TAG_OPTS}`
|
||||
echo "Using tag $TAG"
|
||||
fi
|
||||
BUILDOPT+="bu"
|
||||
VERBOPT=""
|
||||
if [[ $VERBOSE -gt 0 ]]; then
|
||||
BUILDOPT+="v"
|
||||
VERBOPT="-v"
|
||||
fi
|
||||
msg "running ./build.sh -$BUILDOPT -t $TAG"
|
||||
./build.sh -$BUILDOPT -t $TAG
|
||||
|
||||
./run-unit.sh $VERBOPT -t $TAG
|
||||
# WEBSERVER
|
||||
msg "running ./build.sh -I webserver -$BUILDOPT -t $TAG-webserver"
|
||||
./build.sh -I webserver -$BUILDOPT -t "$TAG-webserver"
|
||||
|
||||
./publish.sh $VERBOPT -t $TAG
|
||||
./run-unit.sh $VERBOPT -t "$TAG-webserver"
|
||||
|
||||
./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
|
||||
@@ -162,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
|
||||
|
||||
@@ -22,6 +22,7 @@ usage() {
|
||||
echo " -d: Debug" 1>&2;
|
||||
echo " -u: Unit" 1>&2;
|
||||
echo " -b: Base" 1>&2;
|
||||
echo " -I: Image (webserver or worker)" 1>&2;
|
||||
echo " -i: Config Input File" 1>&2;
|
||||
echo " -o: Output file" 1>&2;
|
||||
echo " -v: Verbose" 1>&2;
|
||||
@@ -36,8 +37,13 @@ DEBUG_MODE=0
|
||||
UNIT_MODE=0
|
||||
BASE_MODE=0
|
||||
|
||||
while getopts "i:o:hvdub" o; do
|
||||
TYPE="webserver"
|
||||
|
||||
while getopts "i:o:I:hvdub" o; do
|
||||
case "${o}" in
|
||||
I)
|
||||
TYPE="${OPTARG}"
|
||||
;;
|
||||
d)
|
||||
DEBUG_MODE=1
|
||||
SELECTED_MODES+=1
|
||||
@@ -88,12 +94,12 @@ if [[ $OUTFILE == "" ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
STARTING_FILE="../cicd/dockerfiles/build.dockerfile"
|
||||
STARTING_FILE="../cicd/dockerfiles/${TYPE}/build.dockerfile"
|
||||
if [[ $DEBUG_MODE -eq 1 ]]; then
|
||||
STARTING_FILE="../cicd/dockerfiles/debug.dockerfile"
|
||||
STARTING_FILE="../cicd/dockerfiles/${TYPE}/debug.dockerfile"
|
||||
fi
|
||||
if [[ $UNIT_MODE -eq 1 ]]; then
|
||||
STARTING_FILE="../cicd/dockerfiles/test.dockerfile"
|
||||
STARTING_FILE="../cicd/dockerfiles/${TYPE}/test.dockerfile"
|
||||
fi
|
||||
msg "Using source file $STARTING_FILE"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
git tag -l --sort=-version:refname | head -n 1
|
||||
git pull --quiet
|
||||
git tag | tr - \~ | sort -V | tr \~ - | tail -n 1
|
||||
Reference in New Issue
Block a user