2

由于有人离开了我负责维护的公司,我收到了一些 ColdFusion 代码。问题是我最后一次查看一些 ColdFusion 代码是在大约 10 年前,所以我完全迷路了,我从头开始。

我的问题是我正在尝试找到组件或代码以及下面显示的代码中调用的任何内容。

<cfinvoke component="_admin_tools_kms" method="listKMSUsers" returnVariable="getKMSUsers">
    <cfinvokeargument name="argFullAccount" value="1" />
</cfinvoke>

我知道这将返回系统的用户列表,但我无法找到进行该调用的确切代码。该组件名称“_admin_tools_kms”应该是某处的cfm文件的名称,还是只是以某种方式创建的参考名称?

4

1 回答 1

4

Let's break this down:

<cfinvoke 
    component="someComponent" 
    method="someFunction" 
    returnVariable="someVariable">
    <cfinvokeargument name="someArgument" value="foo" />
</cfinvoke>

The attribute component is either name of a file with a .cfc extension or a variable containing an instance of that component. If it was a variable, it would be referenced as #someComponent#.

If there's just a simple value in there, odds are there's a file named someComponent.cfc in the same folder.

If there's a dot-separated value in there, like cfc.services.someComponent,

  • look for a folder at the web root named /cfc/ that contains another folder /services/ in which you'll find the file someComponent.cfc.
  • If you don't see that folder, look for a ColdFusion mapping in the root Application.cfc file that creates the alias cfc and maps it to the folders you want.
  • and if THAT's not there, then check your web server for folder aliases or mappings to see what the heck some psychopath did to hide where that code exists.

BUT, I prefer doing a simple text search for the method referenced instead of the component. That function could exist in another component or file than the one referenced.

Since a CFC can extend another CFC, there could be a parentComponent.cfc that someComponent extends which actually contains the method in question. Worse, the file someComponent.cfc could have other files included where one contains the method. The only downside is if the function is named something common like create.

于 2019-06-24T22:28:31.503 回答