需要能够通过HTTP或MySQL在openfire中插入/删除新组
我知道如何通过MySQL插入一个新的组,并且在一定程度上是有效的。问题是,如果手动插入组,则数据库更改不会加载到内存中。向进程发送HUP信号确实有效,但这是一种笨拙的操作。我渴望优雅:) 如果可能的话,我希望通过MySQL对组进行更改(添加/删除/更改),然后向openfire服务器发送HTTP请求以读取新的更改。或者,也可以添加/删除/修改与用户服务工作方式类似的组需要能够通过HTTP或MySQL在openfire中插入/删除新组,mysql,openfire,Mysql,Openfire,我知道如何通过MySQL插入一个新的组,并且在一定程度上是有效的。问题是,如果手动插入组,则数据库更改不会加载到内存中。向进程发送HUP信号确实有效,但这是一种笨拙的操作。我渴望优雅:) 如果可能的话,我希望通过MySQL对组进行更改(添加/删除/更改),然后向openfire服务器发送HTTP请求以读取新的更改。或者,也可以添加/删除/修改与用户服务工作方式类似的组 如果有人能帮助我,我将不胜感激。在我看来,如果发送HUP信号对您有效,那么这实际上是让Openfire读取新组的一种非常简单、优
如果有人能帮助我,我将不胜感激。在我看来,如果发送HUP信号对您有效,那么这实际上是让Openfire读取新组的一种非常简单、优雅和高效的方法,特别是如果您在Openfire服务器上使用以下命令(假设它运行的是Linux/Unix操作系统): 如果仍然希望发送HTTP请求以提示Openfire重新读取组,则应使用以下Python脚本执行此操作。它以OpenFire3.8.2为目标,并依赖于Python的mechanize库,该库在Ubuntu中随Python mechanize包一起安装。脚本登录到Openfire服务器,调出缓存摘要页面,选择组和组元数据缓存选项,启用提交按钮,然后提交表单以清除这两个缓存
#!/usr/bin/python
import mechanize
import cookielib
# Customize to suit your setup
of_host = 'http://openfire.server:9090'
of_user = 'admin_username'
of_pass = 'admin_password'
# Initialize browser and cookie jar
br = mechanize.Browser()
br.set_cookiejar(cookielib.LWPCookieJar())
# Log into Openfire server
br.open(of_host + '/login.jsp')
br.select_form('loginForm')
br.form['username'] = of_user
br.form['password'] = of_pass
br.submit()
# Select which cache items to clear in the Cache Summary page
# On my server, 13 is Group and 14 is Group Metadata Cache
br.open(of_host + '/system-cache.jsp')
br.select_form('cacheForm')
br.form['cacheID'] = ['13','14']
# Activate the submit button and submit the form
c = br.form.find_control('clear')
c.readonly = False
c.disabled = False
r = br.submit()
# Uncomment the following line if you want to view results
#print r.read()
Openfire附带了JSP中的web界面。你应该试着看看他们是如何在他们的网络应用中做到这一点的。祝你好运。布莱恩,谢谢你的回复——这肯定给了我一些如何处理的想法。您知道有没有一个类似的模块可以在PHP或Perl中提供相同的功能?有一个Perl的WWW::Mechanize模块可以与python Mechanize相媲美。不过,我还没有研究过PHP的类似问题。非常感谢你们,布莱恩——答案已被接受,奖金已颁发!
#!/usr/bin/python
import mechanize
import cookielib
# Customize to suit your setup
of_host = 'http://openfire.server:9090'
of_user = 'admin_username'
of_pass = 'admin_password'
# Initialize browser and cookie jar
br = mechanize.Browser()
br.set_cookiejar(cookielib.LWPCookieJar())
# Log into Openfire server
br.open(of_host + '/login.jsp')
br.select_form('loginForm')
br.form['username'] = of_user
br.form['password'] = of_pass
br.submit()
# Select which cache items to clear in the Cache Summary page
# On my server, 13 is Group and 14 is Group Metadata Cache
br.open(of_host + '/system-cache.jsp')
br.select_form('cacheForm')
br.form['cacheID'] = ['13','14']
# Activate the submit button and submit the form
c = br.form.find_control('clear')
c.readonly = False
c.disabled = False
r = br.submit()
# Uncomment the following line if you want to view results
#print r.read()