• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/update/taskchecklistconverter.php
  • Класс: BitrixTasksUpdateTaskCheckListConverter
  • Вызов: TaskCheckListConverter::execute
public function execute(array &$result)
{
	if (!(
		Loader::includeModule("tasks") &&
		Option::get("tasks", static::$needOptionName, 'Y') === 'Y'
	))
	{
		return false;
	}

	$return = false;
	$found = false;

	$params = static::getParams();

	if ($params["count"] > 0)
	{
		$result["progress"] = 1;
		$result["steps"] = "";
		$result["count"] = $params["count"];

		$time = time();

		$entitiesIdsToConvert = static::getEntitiesIdsToConvert();
		foreach ($entitiesIdsToConvert as $entityId)
		{
			static::runConversionByEntityId($entityId);

			$params["number"]++;
			$found = true;

			if (time() - $time > 3)
			{
				break;
			}
		}

		if ($found)
		{
			Option::set("tasks", static::$paramsOptionName, serialize($params));
			$return = true;
		}

		$result["progress"] = (int)($params["number"] * 100 / $params["count"]);
		$result["steps"] = $params["number"];
	}

	if ($found === false)
	{
		Option::delete("tasks", ["name" => static::$paramsOptionName]);
		Option::set("tasks", static::$needOptionName, "N");

		$entityItemsTableName = static::$entityItemsTableName;

		$connection = Application::getConnection();
		$connection->query("DELETE FROM {$entityItemsTableName} WHERE TITLE = '==='");
	}

	return $return;
}