mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-07 12:47:41 +01:00
Aggiunta modalità manutenzione e blocco hooks e cron
This commit is contained in:
parent
ad5b45a9be
commit
891826859e
@ -43,6 +43,13 @@ $debug = false;
|
|||||||
// Permette di eseguire il cron anche se OSM è installato su localhost
|
// Permette di eseguire il cron anche se OSM è installato su localhost
|
||||||
$forza_cron_localhost = false;
|
$forza_cron_localhost = false;
|
||||||
|
|
||||||
|
// Permette di disabilitare i cron e gli hooks
|
||||||
|
$disable_cron = false;
|
||||||
|
$disable_hooks = false;
|
||||||
|
|
||||||
|
// Permette di accedere solo con un ip (da utilizzare per manutenzione)
|
||||||
|
$maintenance_ip = '';
|
||||||
|
|
||||||
// Personalizzazione dei gestori dei tag personalizzati
|
// Personalizzazione dei gestori dei tag personalizzati
|
||||||
$HTMLWrapper = null;
|
$HTMLWrapper = null;
|
||||||
$HTMLHandlers = [];
|
$HTMLHandlers = [];
|
||||||
|
2
core.php
2
core.php
@ -169,7 +169,7 @@ $revision = Update::getRevision();
|
|||||||
|
|
||||||
/* ACCESSO E INSTALLAZIONE */
|
/* ACCESSO E INSTALLAZIONE */
|
||||||
// Controllo sulla presenza dei permessi di accesso basilari
|
// Controllo sulla presenza dei permessi di accesso basilari
|
||||||
$continue = $dbo->isInstalled() && !Update::isUpdateAvailable() && (Auth::check() || API\Response::isAPIRequest());
|
$continue = $dbo->isInstalled() && !Update::isUpdateAvailable() && (Auth::check() || API\Response::isAPIRequest()) && (empty($config['maintenance_ip']) || $config['maintenance_ip'] == $_SERVER['REMOTE_ADDR']);
|
||||||
|
|
||||||
if (!empty($skip_permissions)) {
|
if (!empty($skip_permissions)) {
|
||||||
Permissions::skip();
|
Permissions::skip();
|
||||||
|
@ -65,22 +65,29 @@ if (Auth::check()) {
|
|||||||
<style>'.$custom_css.'</style>';
|
<style>'.$custom_css.'</style>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Toast
|
// Toast
|
||||||
alertPush();
|
alertPush();
|
||||||
|
|
||||||
// Orologio
|
// Orologio
|
||||||
clock();
|
clock();';
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
setTimeout("startHooks();", 1000);
|
if (!$config['disable_hooks']) {
|
||||||
|
echo '
|
||||||
|
setTimeout("startHooks();", 1000);';
|
||||||
|
}
|
||||||
|
|
||||||
// Abilitazione del cron autonoma
|
// Abilitazione del cron autonoma
|
||||||
$.get(globals.rootdir + "/cron.php");
|
if (!$config['disable_cron']) {
|
||||||
});
|
echo '
|
||||||
|
$.get(globals.rootdir + "/cron.php");';
|
||||||
|
}
|
||||||
|
echo '
|
||||||
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
47
include/init/maintenance.php
Normal file
47
include/init/maintenance.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
if ($config['maintenance_ip'] != $_SERVER['REMOTE_ADDR']) {
|
||||||
|
include_once App::filepath('include|custom|', 'top.php');
|
||||||
|
$img = App::getPaths()['img'];
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="box box-center-large box-danger">
|
||||||
|
<div class="box-header with-border text-center">
|
||||||
|
<img src="'.$img.'/logo_completo.png" width="300" alt="'.tr('OSM Logo').'">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="box box-center box-danger box-solid text-center">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">'.tr('Manutenzione in corso!').'</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<p>'.tr('Il software si trova attualmente in modalità manutenzione, siete pregati di attendere sino alla conclusione dell\'intervento').'.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
include_once App::filepath('include|custom|', 'bottom.php');
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
@ -76,6 +76,11 @@ if (Auth::check() && isset($dbo) && $dbo->isConnected() && $dbo->isInstalled())
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Modalità manutenzione
|
||||||
|
if (!empty($config['maintenance_ip'])) {
|
||||||
|
include_once base_dir().'/include/init/maintenance.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Procedura di installazione
|
// Procedura di installazione
|
||||||
include_once base_dir().'/include/init/configuration.php';
|
include_once base_dir().'/include/init/configuration.php';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user