国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.9KB

  1. <?php
  2. /**
  3. * 更新缓存
  4. *
  5. * @version $id:sys_cache_up.php 16:22 2010年7月20日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('sys_ArcBatch');
  13. function clean_cachefiles($path) {
  14. $list = array();
  15. foreach (glob($path.'/*') as $item) {
  16. if(is_dir($item)) {
  17. $list = array_merge($list, clean_cachefiles($item));
  18. } else {
  19. $list[] = $item;
  20. }
  21. }
  22. foreach ($list as $tmpfile) {
  23. @unlink($tmpfile);
  24. }
  25. return true;
  26. }
  27. if (empty($dopost)) $dopost = '';
  28. if (empty($step)) $step = 1;
  29. if ($dopost == "ok") {
  30. if (empty($uparc)) $uparc = 0;
  31. if ($step == -1) {
  32. if ($uparc == 0) sleep(1);
  33. ShowMsg("全部缓存清理已完成", "javascript:;");
  34. exit();
  35. }
  36. //更新栏目缓存
  37. else if ($step == 1) {
  38. UpDateCatCache();
  39. ClearOptCache();
  40. ShowMsg("开始清理栏目缓存,继续清理枚举缓存", "sys_cache_up.php?dopost=ok&step=2&uparc=$uparc");
  41. exit();
  42. }
  43. //更新枚举缓存
  44. else if ($step == 2) {
  45. include_once(DEDEINC."/enums.func.php");
  46. WriteEnumsCache();
  47. ShowMsg("正在清理枚举缓存,继续清理调用缓存", "sys_cache_up.php?dopost=ok&step=3&uparc=$uparc");
  48. exit();
  49. }
  50. //清理arclist调用缓存、过期会员浏览历史、过期短信、之前15天流量统计
  51. else if ($step == 3) {
  52. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$cfg_soft_lang\">";
  53. $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache`");
  54. $msg = array();
  55. $msg[] = "继续清理arclist调用缓存,过期会员浏览历史";
  56. $oldtime = time() - (90 * 24 * 3600);
  57. $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_pms` WHERE sendtime<'$oldtime' ");
  58. $msg[] = "过期短信,错误文档";
  59. $limit = date('Ymd', strtotime('-15 days'));
  60. $dsql->ExecuteNoneQuery("DELETE FROM `#@__statistics_detail` WHERE created_date < '$limit'");
  61. $msg[] = "之前15天流量统计";
  62. $url = "sys_cache_up.php?dopost=ok&step=-1&uparc=$uparc";
  63. clean_cachefiles("../data/cache");
  64. clean_cachefiles("../data/tplcache");
  65. clean_cachefiles("../data/sessions");
  66. clean_cachefiles("../static/enums");
  67. if ($uparc == 1) {
  68. $url = "sys_cache_up.php?dopost=ok&step=9";
  69. }
  70. ShowMsg(implode(",", $msg), $url);
  71. exit();
  72. }
  73. //修正错误文档
  74. else if ($step == 9) {
  75. ShowMsg('清理错误文档已取消,建议用系统修复工具清理', 'sys_cache_up.php?dopost=ok&step=-1&uparc=1');
  76. exit();
  77. }
  78. }
  79. include DedeInclude('templets/sys_cache_up.htm');
  80. ?>