定时删除
parent
bef5eeb849
commit
1895a1bc38
|
@ -316,6 +316,7 @@ if (isset($_POST['del_version_file'])) {
|
|||
";
|
||||
}
|
||||
}
|
||||
auto_delete(); //定时删除
|
||||
?>
|
||||
<div class="row">
|
||||
<?php echo $config['set_notice']; ?>
|
||||
|
@ -568,13 +569,7 @@ if (isset($_POST['del_version_file'])) {
|
|||
</div>
|
||||
<div class="tab-pane fade" id="Content6">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
<h5 class="header-dividing">清理缓存 <small>已缓存: <?php echo getFileNumber(APP_ROOT . $config['path'] . 'cache/') . '文件 | 占用' . getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'cache/')); ?></small></h5>
|
||||
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<button type="submit" class="btn btn-success" name="delDir" value="cache/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复! ');"><i class="icon icon-trash"> 清理缓存</i></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5">
|
||||
<h5 class="header-dividing">上传日志 <small>需要开启上传日志</small></h5>
|
||||
<form class="form-inline" action="../application/viewlog.php" method="post" target="_blank">
|
||||
<div class="form-group">
|
||||
|
@ -585,6 +580,23 @@ if (isset($_POST['del_version_file'])) {
|
|||
<button type="submit" class="btn btn-primary">查看日志</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<h5 class="header-dividing" data-toggle="tooltip" title="仅限存储分类路径为 Y/m/d/ 格式<br/>且每天需要访问一次后台才生效<br/>超过定时日期前的不删除">定时删除 <small>数值为<code>0</code>时关闭</small></h5>
|
||||
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">天数</span>
|
||||
<input type="number" name="auto_delete" class="form-control" placeholder="0" value="<?php echo $config['auto_delete']; ?>">
|
||||
<span class="input-group-btn"><button class="btn btn-primary">设置</button></span>
|
||||
</div>
|
||||
<input type="hidden" class="form-control" name="update" value="<?php echo date("Y-m-d H:i:s"); ?>" placeholder="隐藏的保存">
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h5 class="header-dividing">清理缓存 <small>已缓存: <?php echo getFileNumber(APP_ROOT . $config['path'] . 'cache/') . '文件 | 占用' . getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'cache/')); ?></small></h5>
|
||||
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<button type="submit" class="btn btn-success" name="delDir" value="cache/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复! ');"><i class="icon icon-trash"> 清理缓存</i></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<h5 class="header-dividing">缩略图</h5>
|
||||
|
@ -984,6 +996,7 @@ if (isset($_POST['del_version_file'])) {
|
|||
<form action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<input class="form-control" type="hidden" name="del_version_file" value="/admin/logs/version/version.json" readonly>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-mini btn-primary" href="https://github.com/icret/EasyImages2.0/releases" target="_blank" data-toggle="tooltip" title="Github releases">Github</a>
|
||||
<a class="btn btn-mini btn-primary" href="<?php echo getVersion('zipball_url'); ?>" target="_blank" data-toggle="tooltip" title="① 下载后上传至网站更新">下载新版本</a>
|
||||
<button class="btn btn-mini btn-danger" data-toggle="tooltip" title="② 升级后获取新的版本信息">更新版本号</button>
|
||||
</div>
|
||||
|
|
|
@ -123,10 +123,10 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
|
|||
<input type="password" name="password" id="password" class="form-control" value="" placeholder="输入登录密码" autocomplete="off" required="required">
|
||||
<input type="hidden" name="password" id="md5_password">
|
||||
<?php if ($config['captcha']) : ?>
|
||||
<input class="form-control" type="text" name="code" value="" placeholder="输入下方4位数验证码" autocomplete="off" required="required" />
|
||||
<input class="form-control" type="text" name="code" value="" placeholder="请输入验证码" autocomplete="off" required="required" />
|
||||
<div class="form-group">
|
||||
<div class="col">
|
||||
<label><img src="../application/captcha.php" onClick="this.src='../application/captcha.php?nocache='+Math.random()" title="点击换一张" /></label>
|
||||
<label><img src="../application/captcha.php" width="185px" onClick="this.src='../application/captcha.php?nocache='+Math.random()" title="点击换一张" /></label>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -171,6 +171,7 @@ if ($handle->uploaded) {
|
|||
"thumb" => $handleThumb,
|
||||
"del" => $delUrl,
|
||||
"ID" => $tokenID, // 202-02-11 增加返回Token ID
|
||||
// "memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
|
||||
);
|
||||
echo json_encode($reJson, JSON_UNESCAPED_UNICODE);
|
||||
$handle->clean();
|
||||
|
@ -180,7 +181,7 @@ if ($handle->uploaded) {
|
|||
"result" => "failed",
|
||||
"code" => 206,
|
||||
"message" => $handle->error,
|
||||
"memory" => getDistUsed(memory_get_usage()), //内存使用率 2023-02-11
|
||||
"memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
|
||||
// 'log' => $handle->log,(仅用作调试用)
|
||||
);
|
||||
unset($handle);
|
||||
|
|
|
@ -1715,7 +1715,35 @@ function ip_upload_counts()
|
|||
$dir = APP_ROOT . '/admin/logs/ipcounts/';
|
||||
if (!is_dir($dir)) mkdir($dir, 0777);
|
||||
|
||||
$file = $dir . date('Ymd') . '.php';
|
||||
$file = $dir . date('Ymd') . '.php';
|
||||
file_put_contents($file, real_ip() . PHP_EOL, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动删除
|
||||
*/
|
||||
function auto_delete()
|
||||
{
|
||||
global $config;
|
||||
if ($config['auto_delete'] && $config['storage_path'] == 'Y/m/d/') {
|
||||
$dir = APP_ROOT . $config['path'] . date('Y/m/d/', strtotime(-$config['auto_delete'] . 'day'));
|
||||
if (is_dir($dir)) {
|
||||
try {
|
||||
if (deldir($dir)) {
|
||||
$log = date('Y-m-d H:i:s') . $dir . ' delete succees';
|
||||
} else {
|
||||
throw new Exception(date('Y-m-d H:i:s') . $dir . ' delete failed');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$log = $e->getMessage();
|
||||
}
|
||||
|
||||
if (!is_dir(APP_ROOT . '/admin/logs/tasks/')) {
|
||||
mkdir(APP_ROOT . '/admin/logs/tasks/', 0755, true);
|
||||
}
|
||||
|
||||
file_put_contents(APP_ROOT . '/admin/logs/tasks/auto_delete.php', $log . PHP_EOL, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,6 +190,7 @@ if ($handle->uploaded) {
|
|||
"srcName" => $handle->file_src_name_body,
|
||||
"thumb" => $handleThumb,
|
||||
"del" => $delUrl,
|
||||
// "memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
|
||||
);
|
||||
echo json_encode($reJson);
|
||||
$handle->clean(); // 如果取消上传生成缩略图需要恢复此选项功能
|
||||
|
@ -199,7 +200,7 @@ if ($handle->uploaded) {
|
|||
"result" => "failed",
|
||||
"code" => 206,
|
||||
"message" => $handle->error,
|
||||
"memory" => getDistUsed(memory_get_usage()), //内存使用率 2023-02-11
|
||||
"memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
|
||||
// 'log' => $handle->log,(仅用作调试用)
|
||||
);
|
||||
unset($handle);
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
|
@ -1,6 +1,7 @@
|
|||
![项目状态](https://repobeats.axiom.co/api/embed/0922803f14091f0686de26fee5196b9984b106a4.svg "Repobeats analytics image")
|
||||
|
||||
*2023-02-12 v2.7.5 dev
|
||||
- 增加定时删除上传文件
|
||||
- 更换检测最新版本方式
|
||||
- API上传增加返回Token ID
|
||||
- 优化显示
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
|
||||
| 支付宝支持 | 微信支持 |
|
||||
| :---------------------------------------: | :-------------------------------------: |
|
||||
| ![支付宝支持](../public/images/alipay.jpg) | ![微信支持](../public/images/wechat.jpg) |
|
||||
| ![支付宝支持](./images/alipay.jpg) | ![微信支持](./images/wechat.jpg) |
|
Loading…
Reference in New Issue