function begin($user_url, $anonymous = false)
{
$openid_url = $user_url;
$disco = $this->getDiscoveryObject($this->session, $openid_url, $this->session_key_prefix);
// Set the 'stale' attribute of the manager. If discovery
// fails in a fatal way, the stale flag will cause the manager
// to be cleaned up next time discovery is attempted.
$m = $disco->getManager();
$loader = new Auth_Yadis_ManagerLoader();
if ($m) {
if ($m->stale) {
$disco->destroyManager();
} else {
$m->stale = true;
$disco->session->set($disco->session_key, serialize($loader->toSession($m)));
}
}
$endpoint = $disco->getNextService($this->discoverMethod, $this->consumer->fetcher);
// Reset the 'stale' attribute of the manager.
$m = $disco->getManager();
if ($m) {
$m->stale = false;
$disco->session->set($disco->session_key, serialize($loader->toSession($m)));
}
if ($endpoint === null) {
return null;
} else {
return $this->beginWithoutDiscovery($endpoint, $anonymous);
}
}