• Модуль: transformer
  • Путь к файлу: ~/bitrix/modules/transformer/lib/filetransformer.php
  • Класс: BitrixTransformerFileTransformer
  • Вызов: FileTransformer::getCommandName
protected function getCommandName();

/**
 * Get information of the last transformation command of the file.
 * array
 *  status - int
 *  time - DateTime
 *  id - int
 *
 * @param int|string $file - ID in b_file or path.
 * @return bool|array
 */
public static function getTransformationInfoByFile($file)
{
	$foundFile = new File($file);
	$publicPath = $foundFile->getPublicPath();
	if(empty($publicPath))
	{
		return false;
	}
	$result = false;
	$cacheName = md5($file);
	$cachePath = self::CACHE_PATH;
	$cacheExpire = 604800;
	$cacheInstance = Cache::createInstance();
	if($cacheInstance->initCache($cacheExpire, $cacheName, $cachePath))
	{
		$result = $cacheInstance->getVars();
	}
	else
	{
		self::clearInfoCache($file);
		$cacheInstance->startDataCache($cacheExpire);
		$command = Command::getByFile($publicPath);
		if($command)
		{
			$result = array(
				'status' => $command->getStatus(),
				'time' => $command->getTime(),
				'id' => $command->getId(),
				'params' => $command->getParams(),
			);
		}
		$cacheInstance->endDataCache($result);
	}

	return $result;
}