<commit_before><?php
/**
 * @package tikiwiki
 */
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

include('tiki-setup.php');

$access->check_feature('feature_newsletters');

if (php_sapi_name() != 'cli') {
	$access->check_permission('tiki_p_send_newsletters');
}

global $nllib; include_once('lib/newsletters/nllib.php');

function display_usage() 
{
	$helpMsg = "\nUsage: php tiki-batch_send_newsletter.php editionId=X\n"
		. "Usage: http://path_to_tiki/tiki-batch_send_newsletter.php?editionId=X\n";
		
	if (php_sapi_name() == 'cli') {
		echo $helpMsg;
	} else {
		echo nl2br($helpMsg);
	}
	die;
}
error_reporting(E_ALL);

$request = new Tiki_Request();

$editionId = $request->getProperty('editionId'); 

if (empty($editionId)) {
	display_usage();
}

if (!($edition_info = $nllib->get_edition($editionId))) {
	echo "Incorrect editionId: $editionId";
	die;
}
if (!($nl_info = $nllib->get_newsletter($edition_info['nlId']))) {
	echo 'Incorrect nlId: '.$edition_info['nlId'];
}
$edition_info['editionId'] = 0;
$sent = $errors = array();
$logFileName = '';
$edition_info['begin'] = 'y';
$nllib->send($nl_info, $edition_info, false, $sent, $errors, $logFileName);
if (!empty($errors)) {
	echo "Errors\n";
	foreach ($errors as $error) {<commit_msg>[MRG] Automatic merge, branches/17.x 62755 to 62757<commit_after><?php
/**
 * @package tikiwiki
 */
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

$inputConfiguration = [[
	'staticKeyFilters'	=> [
		'editionId'		=> 'int',
	]],[
	'catchAllUnset' => null
	]];

include('tiki-setup.php');

$access->check_feature('feature_newsletters');

if (php_sapi_name() != 'cli') {
	$access->check_permission('tiki_p_send_newsletters');
}

global $nllib;

include_once('lib/newsletters/nllib.php');

function display_usage() 
{
	$helpMsg = "\nUsage: php tiki-batch_send_newsletter.php editionId=X\n"
		. "Usage: http://path_to_tiki/tiki-batch_send_newsletter.php?editionId=X\n";
		
	if (php_sapi_name() == 'cli') {
		echo $helpMsg;
	} else {
		echo nl2br($helpMsg);
	}
	die;
}
error_reporting(E_ALL);

$request = new Tiki_Request();

$editionId = $request->getProperty('editionId');

if (empty($editionId)) {
	display_usage();
}

if (!($edition_info = $nllib->get_edition($editionId))) {
	echo "Incorrect editionId: $editionId";
	die;
}
if (!($nl_info = $nllib->get_newsletter($edition_info['nlId']))) {
	echo 'Incorrect nlId: '.$edition_info['nlId'];
}
$edition_info['editionId'] = 0;
$sent = $errors = array();
$logFileName = '';
$edition_info['begin'] = 'y';
$nllib->send($nl_info, $edition_info, false, $sent, $errors, $logFileName);
if (!empty($errors)) {
	echo "Errors\n";
	foreach ($errors as $error) {
{'fraction_non_alphanumeric': 0.18057366362451108, 'fraction_numerical': 0.010430247718383311, 'mean_word_length': 5.276073619631902, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4987382', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1160, 'n_words': 240}