here’s a piece of php code, should anyone need it
function destroy_cache($password, $username, $domain, $cookie){
/*
$password = “your pass”;
$username = “your admin user”;
$domain = “http://your_domain:9090/”;
$cookie = “./cookie_openfire.txt”; //must exist here.
*/
$POST = “url=%2Findex.jsp&login=true&username=”.$username."&password=".$password;
$page_ = $domain.“login.jsp”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $page_);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POST);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
$data = curl_exec($ch);
curl_close($ch);
for($i = -1; $i<=32; $i++){
$cacheID[] = $i;
}
$POST = join("&cacheID=", $cacheID);
$POST = $POST."&clear=Clear+Selected";
$page_ = $domain.“system-cache.jsp”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $page_);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POST);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
$data = curl_exec($ch);
curl_close($ch);
}
destroy_cache($password, $username, $domain, $cookie);