<commit_before><?php


if ($argc > 1 && in_array($argv[1], array('--help', '-help', '-h', '-?')))
{
	echo "Usage:\n\t" . basename(__file__) . " <dryRun> <handleUnusedIndices>\n";
	die;
}

if($argc > 1)
{
	$dryRun = $argv[1];
}
else
{
	$dryRun = false;
}

if($argc > 2)
{
	$handleUnusedIndices = $argv[2];
}
else
{
	$handleUnusedIndices = false;
}

chdir(dirname(__FILE__));
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../../'));
require_once(ROOT_DIR . '/infra/KAutoloader.php');
require_once(ROOT_DIR . '/alpha/config/kConf.php');
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/elastic/' . basename(__FILE__) . '.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());

$beaconElasticConfig = kConf::getMap('beacon_rotation');
foreach ($beaconElasticConfig as $configSection)
{
	$rotationWorker = new BeaconsIndexesRotationWorker($configSection, $dryRun, $handleUnusedIndices);
	$rotationWorker->rotate();
}

KalturaLog::log("Done!");<commit_msg>PLAT-11117- adding section prefix filter to the beacon index rotation script (#9680)<commit_after><?php

if ($argc > 1 && in_array($argv[1], array('--help', '-help', '-h', '-?')))
{
	echo "Usage:\n\t" . basename(__file__) . " <dryRun> <handleUnusedIndices> <sectionPrefix>\n";
	die;
}

$dryRun = false;
$sectionPrefix = null;
$handleUnusedIndices = false;

if($argc > 1)
{
	$dryRun = $argv[1];
}

if($argc > 2)
{
	$handleUnusedIndices = $argv[2];
}

if($argc > 3)
{
	$sectionPrefix = $argv[3];
}

chdir(dirname(__FILE__));
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../../'));
require_once(ROOT_DIR . '/infra/KAutoloader.php');
require_once(ROOT_DIR . '/alpha/config/kConf.php');
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/elastic/' . basename(__FILE__) . '.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());

$beaconElasticConfig = kConf::getMap('beacon_rotation');
foreach ($beaconElasticConfig as $sectionName => $configSection)
{
	if($sectionPrefix && !kString::beginsWith($sectionName, $sectionPrefix))
	{
		KalturaLog::log("$sectionName does not start with $sectionPrefix, skipping");
		continue;
	}

	$rotationWorker = new BeaconsIndexesRotationWorker($configSection, $dryRun, $handleUnusedIndices);
	$rotationWorker->rotate();
}

KalturaLog::log("Done!");
{'fraction_non_alphanumeric': 0.1985121378230227, 'fraction_numerical': 0.009005481597494126, 'mean_word_length': 6.742424242424242, 'pattern_counts': {'":': 0, '<': 10, '<?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': '4733458', 'n_tokens_mistral': 959, 'n_tokens_neox': 938, 'n_words': 143}