国内流行的内容管理系统(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.

72 lines
2.7KB

  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. } else if ($step == 1) {
  36. UpDateCatCache();
  37. ClearOptCache();
  38. ShowMsg("完成所有栏目缓存清理,开始清理枚举缓存", "sys_cache_up.php?dopost=ok&step=2&uparc=$uparc");
  39. exit();
  40. } else if ($step == 2) {
  41. include_once(DEDEINC."/enums.func.php");
  42. WriteEnumsCache();
  43. ShowMsg("正在清理枚举缓存,继续清理文档调用缓存", "sys_cache_up.php?dopost=ok&step=3&uparc=$uparc");
  44. exit();
  45. } else if ($step == 3) {
  46. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$cfg_soft_lang\">";
  47. $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache`");
  48. $msg = array();
  49. $msg[] = "正在清理文档调用,过期会员浏览记录";
  50. $oldtime = time() - (90 * 24 * 3600);
  51. $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_pms` WHERE sendtime<'$oldtime' ");
  52. $msg[] = "过期会员短信";
  53. $limit = date('Ymd', strtotime('-15 days'));
  54. $dsql->ExecuteNoneQuery("DELETE FROM `#@__statistics_detail` WHERE created_date<'$limit' ");
  55. $msg[] = "过期流量统计等缓存";
  56. $url = "sys_cache_up.php?dopost=ok&step=-1&uparc=$uparc";
  57. clean_cachefiles("../data/cache");
  58. clean_cachefiles("../data/tplcache");
  59. clean_cachefiles("../data/sessions");
  60. clean_cachefiles("../static/enums");
  61. if ($uparc == 1) {
  62. $url = "sys_cache_up.php?dopost=ok&step=9";
  63. }
  64. ShowMsg(implode(",", $msg), $url);
  65. exit();
  66. } else if ($step == 9) {
  67. ShowMsg('已取消清理错误文档,建议用系统修复工具', 'sys_cache_up.php?dopost=ok&step=-1&uparc=1');
  68. exit();
  69. }
  70. }
  71. include DedeInclude('templets/sys_cache_up.htm');
  72. ?>