PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/manager/actions/refresh_site.dynamic.php

https://github.com/good-web-master/modx.evo.custom
PHP | 35 lines | 24 code | 8 blank | 3 comment | 1 complexity | 9bcf9e0ea240b69ec95d9e83b5f11a17 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0, GPL-2.0, MIT, BSD-3-Clause
  1. <?php
  2. if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
  3. // (un)publishing of documents, version 2!
  4. // first, publish document waiting to be published
  5. $ctime = time();
  6. $sctable = $modx->getFullTableName('site_content');
  7. $sql = "UPDATE $sctable SET published=1 WHERE pub_date < ".$ctime." AND pub_date!=0 AND unpub_date > ".$ctime;
  8. $rs = mysql_query($sql);
  9. $num_rows_pub = mysql_affected_rows($modxDBConn);
  10. $sql = "UPDATE $sctable SET published=0 WHERE unpub_date < ".$ctime." AND unpub_date!=0 AND published=1";
  11. $rs = mysql_query($sql);
  12. $num_rows_unpub = mysql_affected_rows($modxDBConn);
  13. ?>
  14. <h1><?php echo $_lang['refresh_title']; ?></h1>
  15. <div class="sectionBody">
  16. <?php printf("<p>".$_lang["refresh_published"]."</p>", $num_rows_pub) ?>
  17. <?php printf("<p>".$_lang["refresh_unpublished"]."</p>", $num_rows_unpub) ?>
  18. <?php
  19. include_once "./processors/cache_sync.class.processor.php";
  20. $sync = new synccache();
  21. $sync->setCachepath("../assets/cache/");
  22. $sync->setReport(true);
  23. $sync->emptyCache();
  24. // invoke OnSiteRefresh event
  25. $modx->invokeEvent("OnSiteRefresh");
  26. ?>
  27. </div>