function fetch_subscriber_count()
{
$subs_count = get_transient('wpcom_subscribers_total');
if (FALSE === $subs_count || 'failed' == $subs_count['status']) {
Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client(array('user_id' => JETPACK_MASTER_USER));
$xml->query('jetpack.fetchSubscriberCount');
if ($xml->isError()) {
// if we get an error from .com, set the status to failed so that we will try again next time the data is requested
$subs_count = array('status' => 'failed', 'code' => $xml->getErrorCode(), 'message' => $xml->getErrorMessage(), 'value' => isset($subs_count['value']) ? $subs_count['value'] : 0);
} else {
$subs_count = array('status' => 'success', 'value' => $xml->getResponse());
}
set_transient('wpcom_subscribers_total', $subs_count, 3600);
// try to cache the result for at least 1 hour
}
return $subs_count;
}