<commit_before><?php

/**
 * This file contains background notification code
 *
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines https://www.simplemachines.org
 * @copyright 2020 Simple Machines and individual contributors
 * @license https://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 RC2
 */

/**
 * Class Birthday_Notify_Background
 */
class Birthday_Notify_Background extends SMF_BackgroundTask
{
    /**
     * This executes the task. It loads up the birthdays, figures out the greeting, etc.
     * @return bool Always returns true
     */
	public function execute()
 	{
		global $txt, $smcFunc, $txtBirthdayEmails, $modSettings, $sourcedir;

		$greeting = isset($modSettings['birthday_email']) ? $modSettings['birthday_email'] : 'happy_birthday';

		// Get the month and day of today.
		$month = date('n'); // Month without leading zeros.
		$day = date('j'); // Day without leading zeros.

		// So who are the lucky ones?  Don't include those who are banned and those who don't want them.
		$result = $smcFunc['db_query']('', '
			SELECT id_member, real_name, lngfile, email_address
			FROM {db_prefix}members
			WHERE is_activated < 10
				AND MONTH(birthdate) = {int:month}
				AND DAYOFMONTH(birthdate) = {int:day}
				AND YEAR(birthdate) > {int:year}',
			array(
				'year' => 1,
				'month' => $month,
				'day' => $day,
			)
		);

		// Group them by languages.
		$birthdays = array();
		while ($row = $smcFunc['db_fetch_assoc']($result))
		{
			if (!isset($birthdays[$row['lngfile']]))
				$birthdays[$row['lngfile']] = array();
			$birthdays[$row['lngfile']][$row['id_member']] = array(
				'name' => $row['real_name'],<commit_msg>Add index Support for Birthday task pg only<commit_after><?php

/**
 * This file contains background notification code
 *
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines https://www.simplemachines.org
 * @copyright 2020 Simple Machines and individual contributors
 * @license https://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 RC2
 */

/**
 * Class Birthday_Notify_Background
 */
class Birthday_Notify_Background extends SMF_BackgroundTask
{
    /**
     * This executes the task. It loads up the birthdays, figures out the greeting, etc.
     * @return bool Always returns true
     */
	public function execute()
 	{
		global $txt, $smcFunc, $txtBirthdayEmails, $modSettings, $sourcedir;

		$greeting = isset($modSettings['birthday_email']) ? $modSettings['birthday_email'] : 'happy_birthday';

		// Get the month and day of today.
		$month = date('n'); // Month without leading zeros.
		$day = date('j'); // Day without leading zeros.

		// So who are the lucky ones?  Don't include those who are banned and those who don't want them.
		$result = $smcFunc['db_query']('', '
			SELECT id_member, real_name, lngfile, email_address
			FROM {db_prefix}members
			WHERE is_activated < 10
				AND MONTH(birthdate) = {int:month}
				AND DAYOFMONTH(birthdate) = {int:day}
				AND YEAR(birthdate) > {int:year}
				' . ($smcFunc['db_title'] === POSTGRE_TITLE ? 'AND indexable_month_day(birthdate) = {date:bdate}' : ''),
			array(
				'year' => 1,
				'month' => $month,
				'day' => $day,
				'bdate' => '2020-' . $month . '-' . $day,
			)
		);

		// Group them by languages.
		$birthdays = array();
		while ($row = $smcFunc['db_fetch_assoc']($result))
		{
			if (!isset($birthdays[$row['lngfile']]))
				$birthdays[$row['lngfile']] = array();
			$birthdays[$row['lngfile']][$row['id_member']] = array(
				'name' => $row['real_name'],
{'fraction_non_alphanumeric': 0.15283598770606316, 'fraction_numerical': 0.006705783738474434, 'mean_word_length': 3.7925033467202143, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '4647900', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1185, 'n_words': 315}