Coquille sur la date de suppresison des archives
This commit is contained in:
parent
9089f59a44
commit
8b1f32b4eb
7 changed files with 50 additions and 10 deletions
|
@ -126,6 +126,7 @@ USER="web242"
|
||||||
|
|
||||||
* Futur :
|
* Futur :
|
||||||
* Orientation "serveur dédier" limiter a une liste de @domaine et ou un serveur
|
* Orientation "serveur dédier" limiter a une liste de @domaine et ou un serveur
|
||||||
|
* Mode backup et non archive... en tout cas permettre la modification des texte de présentation... / incrustation dans le html...
|
||||||
* BUG index.html si eml masque lien des archives !
|
* BUG index.html si eml masque lien des archives !
|
||||||
* MAX usage... par IP et/ou cookies... ? (pour éviter que le service ne soit détourné)
|
* MAX usage... par IP et/ou cookies... ? (pour éviter que le service ne soit détourné)
|
||||||
* Estimer temps/durée (avant validation)
|
* Estimer temps/durée (avant validation)
|
||||||
|
|
1
archive
Symbolic link
1
archive
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/mnt/f2l/lighten-mailbox-archive/
|
21
body-end.php
Normal file
21
body-end.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Matomo -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _paq = window._paq = window._paq || [];
|
||||||
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||||
|
_paq.push(["setCookieDomain", "*.lighten-mailbox.zici.fr"]);
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
(function() {
|
||||||
|
var u="//www.piwik.zici.fr/";
|
||||||
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', '25']);
|
||||||
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
|
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<noscript><p><img src="//www.piwik.zici.fr/matomo.php?idsite=25&rec=1" style="border:0;" alt="" /></p></noscript>
|
||||||
|
<!-- End Matomo Code -->
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"require": {
|
"require": {
|
||||||
"league/oauth2-client": "^2.4",
|
"league/oauth2-client": "^2.4",
|
||||||
"league/oauth2-google": "^3.0",
|
"league/oauth2-google": "^3.0",
|
||||||
"pear/net_dns2": "^1.4",
|
"pear/net_dns2": "^1.5",
|
||||||
"phpmailer/phpmailer": "^6.1"
|
"phpmailer/phpmailer": "^6.8",
|
||||||
|
"php-mime-mail-parser/php-mime-mail-parser": "^7.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
daemon.note
Normal file
2
daemon.note
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
su - web242 -s /bin/bash -c "php /var/www/lighten-mailbox.zici.fr/web/daemon.php -d /var/www/lighten-mailbox.zici.fr/web"
|
||||||
|
|
28
daemon.php
28
daemon.php
|
@ -80,9 +80,9 @@ while (true) {
|
||||||
// copy($config['dir']['templateTab']['html'], $config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
// copy($config['dir']['templateTab']['html'], $config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
||||||
// toLog(5, $config['dir']['templateTab']['html'] . '-'. $config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
// toLog(5, $config['dir']['templateTab']['html'] . '-'. $config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
||||||
// Copy asset (lib)
|
// Copy asset (lib)
|
||||||
recurse_copy($config['dir']['templateTab'], $config['dir']['archive']."/".$spoolerNextArray['session_id']);
|
recurse_copy($config['dir']['absolut'].'/'.$config['dir']['templateTab'], $config['dir']['absolut'].'/'.$config['dir']['archive']."/".$spoolerNextArray['session_id']);
|
||||||
// On zip
|
// On zip
|
||||||
if (Zip($config['dir']['archive']."/".$spoolerNextArray['session_id']."/", $config['dir']['archive']."/".$fileNameGen)) {
|
if (Zip($config['dir']['absolut'].'/'.$config['dir']['archive']."/".$spoolerNextArray['session_id']."/", $config['dir']['absolut'].'/'.$config['dir']['archive']."/".$fileNameGen)) {
|
||||||
toLog(2, "Le ZIP est fait, on l'enregistre : ".$fileNameGen);
|
toLog(2, "Le ZIP est fait, on l'enregistre : ".$fileNameGen);
|
||||||
// Enregistrement de l'archive :
|
// Enregistrement de l'archive :
|
||||||
$req = $db->prepare("INSERT INTO archive (session_id, file) VALUES (:session_id, :file)");
|
$req = $db->prepare("INSERT INTO archive (session_id, file) VALUES (:session_id, :file)");
|
||||||
|
@ -94,7 +94,7 @@ while (true) {
|
||||||
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
||||||
$req->execute();
|
$req->execute();
|
||||||
// Ménage
|
// Ménage
|
||||||
rrmdir($config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
rrmdir($config['dir']['absolut'].'/'.$config['dir']['archive']."/".$spoolerNextArray['session_id']."/");
|
||||||
|
|
||||||
// Notification archive prête
|
// Notification archive prête
|
||||||
$urlSpool=$config['baseUrl'].'spool_'.$spoolerNextArray['session_id'];
|
$urlSpool=$config['baseUrl'].'spool_'.$spoolerNextArray['session_id'];
|
||||||
|
@ -117,12 +117,24 @@ while (true) {
|
||||||
$req = $db->prepare("UPDATE spooler SET status = 0 WHERE id = :id");
|
$req = $db->prepare("UPDATE spooler SET status = 0 WHERE id = :id");
|
||||||
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
||||||
$req->execute();
|
$req->execute();
|
||||||
|
$mailSend_return = mailSend(username2email($spoolerNextArray['user'], $spoolerNextArray['domain']), _('Archive error'), _('Hello').'<br /></br>
|
||||||
|
|
||||||
|
'._('Sorry but the archiving encountered too many errors for you to download.'));
|
||||||
|
if ($mailSend_return != true) {
|
||||||
|
toLog(1, 'Erreur mailSend '.$mailSend_return);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toLog(2, "Erreur dans le spooler sur la session ".$spoolerNextArray['session_id']);
|
toLog(2, "Erreur dans le spooler sur la session ".$spoolerNextArray['session_id'].' : '.$imapGetData_return['resultMsg']);
|
||||||
$req = $db->prepare("UPDATE spooler SET status = 0 WHERE session_id = :id");
|
$req = $db->prepare("UPDATE spooler SET status = 0 WHERE id = :id");
|
||||||
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
$req->bindParam('id', $spoolerNextArray['id'], PDO::PARAM_INT);
|
||||||
$req->execute();
|
$req->execute();
|
||||||
|
$mailSend_return = mailSend(username2email($spoolerNextArray['user'], $spoolerNextArray['domain']), _('Archive error'), _('Hello').'<br /></br>
|
||||||
|
|
||||||
|
'._('Sorry but the archiving encountered too many errors for you to download.'));
|
||||||
|
if ($mailSend_return != true) {
|
||||||
|
toLog(1, 'Erreur mailSend '.$mailSend_return);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if ($spoolerNextArray['task'] == 2) {
|
} else if ($spoolerNextArray['task'] == 2) {
|
||||||
toLog(3, "Suppression demandé dans le spooler pour la session ".$spoolerNextArray['session_id']);
|
toLog(3, "Suppression demandé dans le spooler pour la session ".$spoolerNextArray['session_id']);
|
||||||
|
@ -152,8 +164,8 @@ while (true) {
|
||||||
// Ménage dans els
|
// Ménage dans els
|
||||||
try {
|
try {
|
||||||
$archive = $db->prepare("SELECT session_id, file
|
$archive = $db->prepare("SELECT session_id, file
|
||||||
FROM archive
|
FROM archive
|
||||||
WHERE dateCreate < '".date('Y-m-d', time()-$config['archive']['life'])."'");
|
WHERE dateCreate < '".date('Y-m-d', time()-$config['archive']['life']*86400)."'");
|
||||||
$archive->execute();
|
$archive->execute();
|
||||||
} catch ( PDOException $e ) {
|
} catch ( PDOException $e ) {
|
||||||
toLog(1, "SELECT archive, error : ".$e->getMessage(), 0);
|
toLog(1, "SELECT archive, error : ".$e->getMessage(), 0);
|
||||||
|
@ -164,7 +176,7 @@ while (true) {
|
||||||
} else {
|
} else {
|
||||||
foreach($archiveArrayFetch as $archiveFetch) {
|
foreach($archiveArrayFetch as $archiveFetch) {
|
||||||
toLog(2, 'Suppression de l\'archives expiré : '.$archiveFetch['file']);
|
toLog(2, 'Suppression de l\'archives expiré : '.$archiveFetch['file']);
|
||||||
unlink($config['dir']['archive'].'/'.$archiveFetch['file']);
|
unlink($config['dir']['absolut'].'/'.$config['dir']['archive'].'/'.$archiveFetch['file']);
|
||||||
$req = $db->prepare("DELETE FROM archive WHERE session_id = :session_id");
|
$req = $db->prepare("DELETE FROM archive WHERE session_id = :session_id");
|
||||||
$req->bindParam('session_id', $archiveFetch['session_id'], PDO::PARAM_INT);
|
$req->bindParam('session_id', $archiveFetch['session_id'], PDO::PARAM_INT);
|
||||||
$req->execute();
|
$req->execute();
|
||||||
|
|
|
@ -14,6 +14,7 @@ function cleanTxt($char) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function folderCleanName($folderName) {
|
function folderCleanName($folderName) {
|
||||||
|
#$folderName = utf8_encode(imap_utf7_decode());
|
||||||
$folderName = preg_replace(
|
$folderName = preg_replace(
|
||||||
"(\[|\])",
|
"(\[|\])",
|
||||||
'',
|
'',
|
||||||
|
@ -529,6 +530,7 @@ function imapGetData($mod, $session_id, $server, $port, $user, $password, $secur
|
||||||
foreach($imapfolder as $folder) {
|
foreach($imapfolder as $folder) {
|
||||||
// Connexion sur le dossier
|
// Connexion sur le dossier
|
||||||
toLog(5, "Connexion sur le dossier ".$folder);
|
toLog(5, "Connexion sur le dossier ".$folder);
|
||||||
|
toLog(5, "Connexion sur le dossier ".folderCleanName($folder));
|
||||||
$serverImapOpenString = serverImapOpenString($server, $port, $secure, $auth, $cert, $folder, $format);
|
$serverImapOpenString = serverImapOpenString($server, $port, $secure, $auth, $cert, $folder, $format);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
imap_reopen($mailbox, $serverImapOpenString, null, 0);
|
imap_reopen($mailbox, $serverImapOpenString, null, 0);
|
||||||
|
|
Loading…
Reference in a new issue