您应该能够为此使用 ColdFusion 管理员 API。当然,您需要安全/权限才能使用它。如果您使用沙盒安全性,请启用对 cf_web_root/CFIDE/adminapi 目录的访问以使用管理员 API。基本上,管理员 API 可以让您以编程方式访问大部分 ColdFusion 管理员设置。
From the documentation:
您可以使用管理员 API 以编程方式执行大多数 ColdFusion 管理员任务。管理员 API 由一组 ColdFusion 组件 (CFC) 组成,其中包含您调用以执行管理员任务的方法。
用于管理调试设置的 CFC 是 debugging.cfc。
这是一些伪代码(尚未测试):
<cfscript>
// Instantiate the administrator.cfc
adminObj = createObject("component","cfide.adminapi.administrator");
// Call the administrator.cfc login method, passing the ColdFusion Administrator password
adminObj.login("#password#","#username#");
// Instantiate the debugging CFC
debugObj = createObject("component","cfide.adminapi.debugging");
// Call the desired CFC method
if (debugObj.isLineDebuggerEnabled()) {
if (debugObj.isLineDebuggerRunning()) {
// Stop line debugger
debugObj.stopLineDebugger();
}
// Disable the line debugger
debugObj.setLineDebuggerEnabled(enabled="false");
}
</cfscript>
这应该让你开始。 Here is some documentation on the debugging.cfc and it's methods.
Manages debug settings.
hierarchy: WEB-INF.cftags.component
CFIDE.adminapi.base
CFIDE.adminapi.debugging
path: {web-root}\CFIDE\adminapi\debugging.cfc
serializable: Yes
properties:
methods: addDebugEvent,
deleteIP,
getCurrentIP,
getDebugProperty,
getDebugRecordset,
getIPList,
getLineDebuggerPort,
getLogProperty,
getMaxDebuggingSessions,
isLineDebuggerEnabled,
isLineDebuggerRunning,
restartLineDebugger,
setDebugProperty,
setIP,
setLineDebuggerEnabled,
setLineDebuggerPort,
setLogProperty,
setMaxDebuggingSessions,
startLineDebugger,
stopLineDebugger,
validateIP*
inherited methods: dump,
getEdition,
getInstallType,
getJRunRootDir,
isAdminUser,
RDSInvoker,
setJrunSN