Execute
string CPostingTemplate::Execute();
Method fetches a template for generating a subscription message according to schedule.
First, system retrieves all subscriptions marked as active or automatic. Next, each subscription is checked for a requirement to generate a message/post. As soon as such subscription is found, the method CPostingTemplate::AddPosting is called and the Execute function finalizes its operation.
This method is designed calling a scenario's cron or agent. Static method.
Parameters
None.
Returned value
If at least one active and automatic subscription was found, returns a string for calling from agent, otherwise returns an empty string.
Example of use case in PHP scenario for cron
#!/usr/bin/php <?php //Indicate your DOCUMENT_ROOT here! $_SERVER["DOCUMENT_ROOT"] = "/opt/www/html"; $DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"]; define("NO_KEEP_STATISTIC", true); define("NOT_CHECK_PERMISSIONS", true); set_time_limit(0); define("LANG", "com"); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); if (CModule::IncludeModule("subscribe")) CPostingTemplate::Execute(); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); ?>
© «Bitrix24», 2001-2024