refresh_site.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. /**
  11. * Refreshes the site cache
  12. *
  13. * @package modx
  14. * @subpackage manager.controllers
  15. */
  16. if (!$modx->hasPermission('empty_cache')) return $modx->error->failure($modx->lexicon('permission_denied'));
  17. /* invoke OnBeforeCacheUpdate event */
  18. $modx->invokeEvent('OnBeforeCacheUpdate');
  19. $results= array();
  20. $modx->cacheManager->refresh(array(), $results);
  21. /* invoke OnSiteRefresh event */
  22. $modx->invokeEvent('OnSiteRefresh');
  23. $num_rows_pub = isset($results['publishing']['published']) ? $results['publishing']['published'] : 0;
  24. $num_rows_unpub = isset($results['publishing']['unpublished']) ? $results['publishing']['unpublished'] : 0;
  25. $modx->smarty->assign('published',$modx->lexicon('refresh_published',array('num' => $num_rows_pub)));
  26. $modx->smarty->assign('unpublished',$modx->lexicon('refresh_unpublished',array('num' => $num_rows_unpub)));
  27. $modx->smarty->assign('results', $results);
  28. $this->checkFormCustomizationRules();
  29. return $modx->smarty->fetch('system/refresh_site.tpl');