optimizer_plugin.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: optimizer_plugin.php 31344 2012-08-15 04:01:32Z zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class optimizer_plugin {
  12. public function __construct() {
  13. }
  14. public function check() {
  15. require_once libfile('function/admincp');
  16. require_once libfile('function/plugin');
  17. require_once libfile('function/cloudaddons');
  18. $pluginarray = C::t('common_plugin')->fetch_all_data();
  19. $addonids = array();
  20. foreach($pluginarray as $row) {
  21. if(ispluginkey($row['identifier'])) {
  22. $addonids[] = $row['identifier'].'.plugin';
  23. }
  24. }
  25. $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
  26. savecache('addoncheck_plugin', $checkresult);
  27. $newversion = 0;
  28. foreach($checkresult as $value) {
  29. list(, $newver) = explode(':', $value);
  30. if($newver) {
  31. $newversion++;
  32. }
  33. }
  34. if($newversion) {
  35. $return = array('status' => 1, 'type' =>'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion)));
  36. } else {
  37. $return = array('status' => 0, 'type' =>'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade'));
  38. }
  39. return $return;
  40. }
  41. public function optimizer() {
  42. $adminfile = defined(ADMINSCRIPT) ? ADMINSCRIPT : 'admin.php';
  43. dheader('Location: '.getglobal('siteurl').$adminfile.'?action=plugins');
  44. }
  45. }
  46. ?>