【发布时间】:2013-06-23 01:53:15
【问题描述】:
我需要记录用户在 sfDoctrineGuard 插件中所做的任何操作。基本上我需要登录:
module/action
date
IP from where users are accessing the application
任何插件?那可能吗?怎么样?
【问题讨论】:
标签: symfony1 symfony-1.4 sfdoctrineguard
我需要记录用户在 sfDoctrineGuard 插件中所做的任何操作。基本上我需要登录:
module/action
date
IP from where users are accessing the application
任何插件?那可能吗?怎么样?
【问题讨论】:
标签: symfony1 symfony-1.4 sfdoctrineguard
这可能是您需要的插件,sfDoctrineGuardLoginHistoryPlugin 并允许扩展您保存的信息。
查看更多插件here。
看一下插件的代码,你只需要更改以下文件:PluginUserLoginHistoryTable.class.php
在函数writeLoginHistory和createHistoryEntry中添加你想要的信息:
writeLoginHistory(sfEvent $event) {
//... same code than in the plugin
//lets save module and action
if (!isset($request) )
{
$sActionName = sfContext::getInstance()->getActionName();
$sModuleName = sfContext::getInstance()->getModuleName();
}
else
{
if (isset($request["module"]))
{
$sActionName = $request["action"];
$sModuleName = $request["module"];
}
}
//get values from the http bar URL
if (!isset($sModuleName))
{
$sFullURL = sfContext::getInstance()->getRouting()->getCurrentInternalUri();
///... strip action and module name from the above URL
}
}
请记住将这些值传递给 createHistoryEntry 函数,并使用要保存的更多输入值更新该函数。
【讨论】:
module/action 的例子吗?我的意思是我在哪里或更好地如何获得这部分