BxDolCronProfile.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. class BxDolCronProfile extends BxDolCron
  10. {
  11. public function __construct()
  12. {
  13. parent::__construct();
  14. }
  15. public function processing()
  16. {
  17. $this->_processContentFilters();
  18. }
  19. protected function _processContentFilters()
  20. {
  21. $aProfileModules = bx_srv('system', 'get_modules_by_type', ['profile']);
  22. if(empty($aProfileModules) || !is_array($aProfileModules))
  23. return;
  24. $aProfileTypes = [];
  25. foreach($aProfileModules as $aProfileModule)
  26. $aProfileTypes[] = $aProfileModule['name'];
  27. $aProfiles = BxDolProfileQuery::getInstance()->getProfiles(['type' => 'active', 'types' => $aProfileTypes]);
  28. if(empty($aProfiles) || !is_array($aProfiles))
  29. return;
  30. $oCf = BxDolContentFilter::getInstance();
  31. foreach($aProfiles as $aProfile)
  32. $oCf->updateValuesByProfile($aProfile);
  33. }
  34. }
  35. /** @} */