Browse Source

lorsque les fichiers sont dupplique ont l'indique en bdd

master
Cabillot Julien 6 years ago
parent
commit
dd885857a7
3 changed files with 38 additions and 3 deletions
  1. 3
      controller/status.php
  2. 14
      lib/Download.php
  3. 24
      templates/status.php

3
controller/status.php

@ -13,6 +13,9 @@ function getStatus()
$listDownloaded = $coll->find(
['cstate' => 'downloaded']
);
$listDupp = $coll->find(
['cstate' => 'dupp']
);
$infos = PremiumizeMe::getStatus();
include dirname(__FILE__).'/../templates/status.php';
}

14
lib/Download.php

@ -89,8 +89,18 @@ class Download {
set_time_limit(0);
if (file_exists(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$this->filename) || file_exists(DOWNLOADEDDIR.DIRECTORY_SEPARATOR.$this->filename)) {
echo 'le fichier existe deja, exit';
exit();
$this->addEvent([
'timestamp' => time(),
'state' => 'dupp'
]);
$db = DbMongo::get();
$coll = $db->download;
$dbRet = $coll->update(
['_id' => $this->_id],
['$set' => ['cstate' => 'dupp']]
);
return false;
}
// On le creer tout de suite pour eviter des conflits de process
touch(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$this->filename);

24
templates/status.php

@ -79,6 +79,28 @@ foreach ($listDownloaded as $result) {
?>
</tbody>
</table>
Liste des fichiers duppliqu&eacute;s :<br>
<table>
<thead>
<tr>
<th>Date</td>
<th>Filename</td>
<th>IP</td>
</tr>
</thead>
<tbody>
<?php
foreach ($listDupp as $result) {
?>
<tr>
<td><?= $result['timestamp']; ?></td>
<td><?= $result['filename']; ?></td>
<td><?= $result['event'][0]['ip']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</body>
</html>
Loading…
Cancel
Save