GlisWeb framework
_default.strumenti.php
Vai alla documentazione di questo file.
1 <?php
2 
12  // TODO il framework dovrebbe poter funzionare anche su porte diverse dalla :80
13 
14  // TODO prelevare l'URL del sito correntemente gestito ($_SESSION['__view__']['__site__'])
15  // TODO provvisorio; a tendere bisognerebbe che ogni elemento di $cf['sites'] venisse processato
16  // e avesse quindi il suo URL calcolato, quindi poi $cf['site'] dovrebbe far riferimento all'elemento
17  // appropriato di $cf['sites']
18 # if( isset( $cf['sites'] ) && count( $cf['sites'] ) ) {
19 # $base = $cf['sites'][ $_SESSION['__view__']['__site__'] ]['protocols'][ $cf['site']['status'] ] . '://' .
20 # ( ( ! empty( $cf['sites'][ $_SESSION['__view__']['__site__'] ]['hosts'][ $cf['site']['status'] ] ) ) ? $cf['sites'][ $_SESSION['__view__']['__site__'] ]['hosts'][ $cf['site']['status'] ] . ((!empty($cf['sites'][ $_SESSION['__view__']['__site__'] ]['domains'][ $cf['site']['status'] ]))?'.':NULL) : NULL ).
21 # $cf['sites'][ $_SESSION['__view__']['__site__'] ]['domains'][ $cf['site']['status'] ] . '/' .
22 # ( ( isset( $cf['sites'][ $_SESSION['__view__']['__site__'] ]['folders'][ $cf['site']['status'] ] ) ) ? $cf['sites'][ $_SESSION['__view__']['__site__'] ]['folders'][ $cf['site']['status'] ] : NULL );
23 # } else {
24  $base = '/';
25 # }
26 
27  // NOTA la variabile $base causa problemi nel multi sito fatta in questo modo, per cui ho commentato tutto
28 
29  // gruppi di controlli
30  $ct['page']['contents']['metros'] = array(
31  'general' => array(
32  'label' => NULL
33  ),
34  'cache' => array(
35  'label' => 'gestione delle cache'
36  ),
37  'mail' => array(
38  'label' => 'gestione delle mail'
39  ),
40  'sms' => array(
41  'label' => 'gestione degli SMS'
42  ),
43  'log' => array(
44  'label' => 'gestione di log e storage'
45  )
46  );
47 
48  // aggiornamento cache
49  if( isset( $cf['memcache']['connection'] ) ) {
50  $ct['page']['contents']['metro']['cache'][] = array(
51  'ws' => $base . 'task/memcache.clean',
52  'icon' => NULL,
53  'fa' => 'fa-clock-o',
54  'title' => 'aggiornamento memcache',
55  'text' => 'forza il flush della cache dati'
56  );
57  timerCheck( $cf['speed'], '-> memcache' );
58  }
59  if( file_exists( DIRECTORY_BASE . DIRECTORY_CACHE . 'twig' ) ) {
60  $ct['page']['contents']['metro']['cache'][] = array(
61  'ws' => $base . 'task/cache.twig.clean',
62  'icon' => NULL,
63  'fa' => 'fa-recycle',
64  'title' => 'aggiornamento cache di Twig',
65  'text' => 'cancella la cache dei template'
66  );
67  timerCheck( $cf['speed'], '-> cache Twig' );
68  }
69  if( file_exists( DIRECTORY_BASE . DIRECTORY_CACHE . 'pages' ) ) {
70  $ct['page']['contents']['metro']['cache'][] = array(
71  'ws' => $base . 'task/cache.static.clean',
72  'icon' => NULL,
73  'fa' => 'fa-eraser',
74  'title' => 'aggiornamento cache pagine',
75  'text' => 'cancella la cache statica delle pagine'
76  );
77  timerCheck( $cf['speed'], '-> cache Twig' );
78  }
79  if( mysqlSelectValue( $cf['mysql']['connection'], 'SELECT count( id ) FROM mail_sent LIMIT 1' ) > 0 ) {
80  $ct['page']['contents']['metro']['mail'][] = array(
81  'ws' => $base . 'task/mail.queue.sent.clean',
82  'icon' => NULL,
83  'fa' => 'fa-envelope',
84  'title' => 'svuotamento coda mail inviate',
85  'text' => 'cancella la coda delle mail inviate'
86  );
87  timerCheck( $cf['speed'], '-> mail in uscita' );
88  }
89  if( mysqlSelectValue( $cf['mysql']['connection'], 'SELECT count( id ) FROM mail_out LIMIT 1' ) > 0 ) {
90  $ct['page']['contents']['metro']['mail'][] = array(
91  'ws' => $base . 'task/mail.queue.out.clean',
92  'icon' => NULL,
93  'fa' => 'fa-envelope-o',
94  'title' => 'svuotamento coda mail in uscita',
95  'text' => 'cancella la coda delle mail in uscita'
96  );
97  timerCheck( $cf['speed'], '-> mail inviate' );
98  }
99  if( mysqlSelectValue( $cf['mysql']['connection'], 'SELECT count( id ) FROM sms_sent LIMIT 1' ) > 0 ) {
100  $ct['page']['contents']['metro']['sms'][] = array(
101  'ws' => $base . 'task/sms.queue.sent.clean',
102  'icon' => NULL,
103  'fa' => 'fa-commenting',
104  'title' => 'svuotamento coda SMS inviati',
105  'text' => 'cancella la coda degli SMS inviati'
106  );
107  timerCheck( $cf['speed'], '-> SMS in uscita' );
108  }
109  if( mysqlSelectValue( $cf['mysql']['connection'], 'SELECT count( id ) FROM sms_out LIMIT 1' ) > 0 ) {
110  $ct['page']['contents']['metro']['sms'][] = array(
111  'ws' => $base . 'task/sms.queue.out.clean',
112  'icon' => NULL,
113  'fa' => 'fa-commenting-o',
114  'title' => 'svuotamento coda SMS in uscita',
115  'text' => 'cancella la coda degli SMS in uscita'
116  );
117  timerCheck( $cf['speed'], '-> SMS inviati' );
118  }
119  if( count( glob( DIRECTORY_BASE . DIRECTORY_LOG . '{*/,}*.log', GLOB_BRACE ) ) > 0 ) {
120  $ct['page']['contents']['metro']['log'][] = array(
121  'ws' => $base . 'task/log.clean',
122  'icon' => NULL,
123  'fa' => 'fa-trash-o',
124  'title' => 'eliminazione dei log',
125  'text' => 'cancella i log del framework'
126  );
127  timerCheck( $cf['speed'], '-> controllo log' );
128  }
129  if( defined( 'DIRECTORY_SESSION' ) && count( glob( DIRECTORY_BASE . DIRECTORY_SESSION . 'sess_*' ) ) > 0 ) {
130  $ct['page']['contents']['metro']['log'][] = array(
131  'ws' => $base . 'task/session.clean.old',
132  'icon' => NULL,
133  'fa' => 'fa-trash',
134  'title' => 'pulizia delle sessioni',
135  'text' => 'cancella i file di sessioni (escluse correnti)'
136  );
137  timerCheck( $cf['speed'], '-> controllo sessioni' );
138  }
139  if( count( glob( DIRECTORY_BASE . DIRECTORY_TEMPORANEA . '*' ) ) > 0 ) {
140  $ct['page']['contents']['metro']['log'][] = array(
141  'ws' => $base . 'task/temporary.clean',
142  'icon' => NULL,
143  'fa' => 'fa-hourglass-end',
144  'title' => 'pulizia dei file temporanei',
145  'text' => 'cancella i file temporanei'
146  );
147  timerCheck( $cf['speed'], '-> controllo file temporanei' );
148  }
149 
150  // debug
151  // print_r( $_SESSION );
152  // echo DIRECTORY_CACHE . 'twig';
153 
154 ?>
const DIRECTORY_CACHE
Definition: _config.php:265
const DIRECTORY_TEMPORANEA
Definition: _config.php:263
$cf['ricerca']['template']
Definition: _030.common.php:7
$ct['page']['contents']['metros']
mysqlSelectValue( $c, $q, $p=false, &$e=array())
const DIRECTORY_LOG
Definition: _config.php:267
const DIRECTORY_BASE
Definition: _osm.php:3
timerCheck(&$a, $c)