/** * Basically a batch script to blindly send all current hubsite emails and * contactable/subscribing status to Sendy @ lists.moodle.org. * * This was created since running a long sync like this during a live upgrade * would be a little too silly. Hub will update the list on demand whenever a * site is modified. * * @copyright 2014 Aparup Banerjee */ define('CLI_SCRIPT', true); require '../../../../config.php'; require_once $CFG->libdir . '/clilib.php'; // cli only functions // now get cli options list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Execute subscribers sync to sendy on lists.moodle.org enmasse\n\nOptions:\n-h, --help Print out this help\n\nExample:\n\$sudo -u vh-moodlenet /usr/bin/php local/hub/admin/cli/syncsubscribers_sendy.php\n"; echo $help; die; } require $CFG->dirroot . '/local/hub/lib.php'; $hub = new local_hub(); raise_memory_limit(MEMORY_HUGE); $sites = $hub->get_sites(); update_sendy_list_batch($sites);
/** * Optionally subscribe/unsubscribe the contactemail to/from a sendy mailing list. * Loads all sites associated with the supplied site contactemail and passes them to update_sendy_list_batch(). * This is necessary because the emailalert property may be different on the various sites associated with a given email. * We can't subscribe or unsubscribe them based on a single site's value. * * @todo tobe in local_hub class or not? its a helper function for now for any functional expansion.. * * @param $site a row from hub_site_directory */ function update_sendy_list($site) { $hub = new local_hub(); $sites = $hub->get_sites(array('contactemail' => $site->contactemail)); update_sendy_list_batch($sites); }