• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/database/structure/closuretree.php
  • Класс: BitrixTasksInternalsDataBaseStructureClosureTree
  • Вызов: ClosureTree::ensureNodeExists
static function ensureNodeExists($id)
{
	$pCName = static::getParentNodeColumnName();
	$cName = static::getNodeColumnName();
	$tableName = static::getTableName();

	$connection = MainHttpApplication::getConnection();

	try
	{
		$connection->query("insert into ".$tableName." (".$cName.", ".$pCName.", DIRECT) values (
			".intval($id).", ".intval($id).", '0'
		)");
	}
	catch(DBSqlException $e)
	{
		return false;
	}

	return true;
}