PenAtualizadorRN.php
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
* Atualizador abstrato para sistema do SEI para instalar/atualizar o módulo PEN
*
* @autor Join Tecnologia
*/
abstract class PenAtualizadorRN extends InfraRN {
protected $sei_versao;
/**
* @var string Versão mínima requirida pelo sistema para instalação do PEN
*/
protected $versaoMinRequirida;
/**
* @var InfraIBanco Instância da classe de persistência com o banco de dados
*/
protected $objBanco;
/**
* @var InfraMetaBD Instância do metadata do banco de dados
*/
protected $objMeta;
/**
* @var InfraDebug Instância do debuger
*/
protected $objDebug;
/**
* @var integer Tempo de execução do script
*/
protected $numSeg = 0;
protected $objInfraBanco ;
protected function inicializarObjInfraIBanco() {
if (empty($this->objInfraBanco)) {
$this->objInfraBanco = BancoSEI::getInstance();
$this->objInfraBanco->abrirConexao();
}
return $this->objInfraBanco;
}
/**
* Inicia a conexão com o banco de dados
*/
protected function inicializarObjMetaBanco() {
if (empty($this->objMeta)) {
$this->objMeta = new PenMetaBD($this->inicializarObjInfraIBanco());
}
return $this->objMeta;
}
/**
* Adiciona uma mensagem ao output para o usuário
*
* @return null
*/
protected function logar($strMsg) {
$this->objDebug->gravar($strMsg);
}
/**
* Inicia o script criando um contator interno do tempo de execução
*
* @return null
*/
protected function inicializar($strTitulo) {
$this->numSeg = InfraUtil::verificarTempoProcessamento();
$this->logar($strTitulo);
}
/**
* Finaliza o script informando o tempo de execução.
*
* @return null
*/
protected function finalizar($strMsg=null, $bolErro=false){
if (!$bolErro) {
$this->numSeg = InfraUtil::verificarTempoProcessamento($this->numSeg);
$this->logar('TEMPO TOTAL DE EXECUCAO: ' . $this->numSeg . ' s');
}else{
$strMsg = 'ERRO: '.$strMsg;
}
if ($strMsg!=null){
$this->logar($strMsg);
}
InfraDebug::getInstance()->setBolLigado(false);
InfraDebug::getInstance()->setBolDebugInfra(false);
InfraDebug::getInstance()->setBolEcho(false);
$this->numSeg = 0;
die;
}
/**
* Construtor
*
* @param array $arrArgs Argumentos enviados pelo script
*/
public function __construct() {
parent::__construct();
ini_set('max_execution_time', '0');
ini_set('memory_limit', '-1');
@ini_set('zlib.output_compression', '0');
@ini_set('implicit_flush', '1');
ob_implicit_flush();
$this->inicializarObjInfraIBanco();
$this->inicializarObjMetaBanco();
$this->objDebug = InfraDebug::getInstance();
$this->objDebug->setBolLigado(true);
$this->objDebug->setBolDebugInfra(true);
$this->objDebug->setBolEcho(true);
$this->objDebug->limpar();
}
}