831 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
4 |
// //
|
|
|
5 |
// Copyright (C) 2006 Phorum Development Team //
|
|
|
6 |
// http://www.phorum.org //
|
|
|
7 |
// //
|
|
|
8 |
// This program is free software. You can redistribute it and/or modify //
|
|
|
9 |
// it under the terms of either the current Phorum License (viewable at //
|
|
|
10 |
// phorum.org) or the Phorum License that was distributed with this file //
|
|
|
11 |
// //
|
|
|
12 |
// This program is distributed in the hope that it will be useful, //
|
|
|
13 |
// but WITHOUT ANY WARRANTY, without even the implied warranty of //
|
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
|
|
|
15 |
// //
|
|
|
16 |
// You should have received a copy of the Phorum License //
|
|
|
17 |
// along with this program. //
|
|
|
18 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
19 |
|
|
|
20 |
if(!defined("PHORUM_ADMIN")) return;
|
|
|
21 |
|
|
|
22 |
include_once("./include/format_functions.php");
|
|
|
23 |
|
|
|
24 |
// Execute file purging.
|
|
|
25 |
if(count($_POST))
|
|
|
26 |
{
|
|
|
27 |
// Run a hook, so file purging can work for alternative
|
|
|
28 |
// file storage systems as well.
|
|
|
29 |
if (isset($PHORUM["hooks"]["admin_file_purge"])) {
|
|
|
30 |
$stale_files = phorum_db_file_purge_stale_files();
|
|
|
31 |
phorum_hook("admin_file_purge", $stale_files);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
// Purge stale files from the database.
|
|
|
35 |
phorum_db_file_purge_stale_files(true);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
// Get a list of stale files.
|
|
|
39 |
$purge_files = phorum_db_file_purge_stale_files();
|
|
|
40 |
|
|
|
41 |
include_once "./include/admin/PhorumInputForm.php";
|
|
|
42 |
$frm =& new PhorumInputForm ("", "post", count($purge_files) ? "Purge stale files now" : "Refresh screen");
|
|
|
43 |
|
|
|
44 |
$frm->hidden("module", "file_purge");
|
|
|
45 |
|
|
|
46 |
$frm->addbreak("Purging stale files...");
|
|
|
47 |
$frm->addmessage("If users write messages with attachments, but do not post them in the end, the attachment files will be left behind in the database. Using this maintenance tool, you can purge those stale files from your database.");
|
|
|
48 |
|
|
|
49 |
if (count($purge_files)) {
|
|
|
50 |
$frm->addbreak("There are currently " . count($purge_files) .
|
|
|
51 |
" stale files in the database");
|
|
|
52 |
foreach($purge_files as $id => $file) {
|
|
|
53 |
$frm->addrow(htmlspecialchars($file["filename"]), phorum_filesize($file["filesize"]));
|
|
|
54 |
}
|
|
|
55 |
} else {
|
|
|
56 |
$frm->addmessage("There are currently no stale files in the database");
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
$frm->show();
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
?>
|