cache_all.php 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. defined('IN_PHPCMS') or exit('No permission resources.');
  3. pc_base::load_app_class('admin','admin',0);
  4. class cache_all extends admin {
  5. private $cache_api;
  6. public function init() {
  7. if (isset($_POST['dosubmit']) || isset($_GET['dosubmit'])) {
  8. $page = $_GET['page'] ? intval($_GET['page']) : 0;
  9. $modules = array(
  10. array('name' => L('module'), 'function' => 'module'),
  11. array('name' => L('sites'), 'mod' => 'admin', 'file' => 'sites', 'function' => 'set_cache'),
  12. array('name' => L('category'), 'function' => 'category'),
  13. array('name' => L('downservers'), 'function' => 'downservers'),
  14. array('name' => L('badword_name'), 'function' => 'badword'),
  15. array('name' => L('ipbanned'), 'function' => 'ipbanned'),
  16. array('name' => L('keylink'), 'function' => 'keylink'),
  17. array('name' => L('linkage'), 'function' => 'linkage'),
  18. array('name' => L('position'), 'function' => 'position'),
  19. array('name' => L('admin_role'), 'function' => 'admin_role'),
  20. array('name' => L('urlrule'), 'function' => 'urlrule'),
  21. array('name' => L('sitemodel'), 'function' => 'sitemodel'),
  22. array('name' => L('type'), 'function' => 'type', 'param' => 'content'),
  23. array('name' => L('workflow'), 'function' => 'workflow'),
  24. array('name' => L('dbsource'), 'function' => 'dbsource'),
  25. array('name' => L('member_setting'), 'function' => 'member_setting'),
  26. array('name' => L('member_group'), 'function' => 'member_group'),
  27. array('name' => L('membermodel'), 'function' => 'membermodel'),
  28. array('name' => L('member_model_field'), 'function' => 'member_model_field'),
  29. array('name' => L('search_type'), 'function' => 'type', 'param' => 'search'),
  30. array('name' => L('search_setting'), 'function' => 'search_setting'),
  31. array('name' => L('update_vote_setting'), 'function' => 'vote_setting'),
  32. array('name' => L('update_link_setting'), 'function' => 'link_setting'),
  33. array('name' => L('special'), 'function' => 'special'),
  34. array('name' => L('setting'), 'function' => 'setting'),
  35. array('name' => L('database'), 'function' => 'database'),
  36. array('name' => L('update_formguide_model'), 'mod' => 'formguide', 'file' => 'formguide', 'function' => 'public_cache'),
  37. array('name' => L('cache_file'), 'function' => 'cache2database'),
  38. array('name' => L('cache_copyfrom'), 'function' => 'copyfrom'),
  39. array('name' => L('clear_files'), 'function' => 'del_file'),
  40. array('name' => L('video_category_tb'), 'function' => 'video_category_tb'),
  41. );
  42. $this->cache_api = pc_base::load_app_class('cache_api', 'admin');
  43. $m = $modules[$page];
  44. if ($m['mod'] && $m['function']) {
  45. if ($m['file'] == '') $m['file'] = $m['function'];
  46. $M = getcache('modules', 'commons');
  47. if (in_array($m['mod'], array_keys($M))) {
  48. $cache = pc_base::load_app_class($m['file'], $m['mod']);
  49. $cache->{$m['function']}();
  50. }
  51. } else if($m['target']=='iframe') {
  52. echo '<script type="text/javascript">window.parent.frames["hidden"].location="index.php?'.$m['link'].'";</script>';
  53. } else {
  54. $this->cache_api->cache($m['function'], $m['param']);
  55. }
  56. $page++;
  57. if (!empty($modules[$page])) {
  58. echo '<script type="text/javascript">window.parent.addtext("<li>'.L('update').$m['name'].L('cache_file_success').'..........</li>");</script>';
  59. showmessage(L('update').$m['name'].L('cache_file_success'), '?m=admin&c=cache_all&page='.$page.'&dosubmit=1&pc_hash='.$_SESSION['pc_hash'], 0);
  60. } else {
  61. echo '<script type="text/javascript">window.parent.addtext("<li>'.L('update').$m['name'].L('site_cache_success').'..........</li>")</script>';
  62. showmessage(L('update').$m['name'].L('site_cache_success'), 'blank');
  63. }
  64. } else {
  65. include $this->admin_tpl('cache_all');
  66. }
  67. }
  68. }
  69. ?>