function flickr_photos_metadata_refresh(&$photo)
{
    $rsp = flickr_photos_metadata_fetch($photo);
    if ($rsp['ok']) {
        $meta = flickr_photos_metadata_path($photo);
        # don't look now but we're calling private functions
        # loadlib("flickr_photos_import");
        # _flickr_photos_import_store($meta, $rsp['data']);
        $cache_key = "photos_meta_{$photo['id']}";
        cache_unset($cache_key);
    }
    return $rsp;
}
function flickr_photos_update_photo(&$photo, $update)
{
    $cache_key = "photo_{$photo['id']}";
    #
    $lookup = flickr_photos_lookup_photo($photo['id']);
    if (!$lookup) {
        return;
    }
    $user = users_get_by_id($lookup['user_id']);
    $cluster_id = $user['cluster_id'];
    $enc_id = AddSlashes($photo['id']);
    $where = "id={$enc_id}";
    # see also: git:parallel-flickr/solr/conf/schema.xml
    $solr_fields = array('perms', 'geoperms', 'geocontext', 'media', 'latitude', 'longitude', 'accuracy', 'woeid', 'datetaken', 'dateupload', 'title', 'description');
    $solr_update = 0;
    $hash = array();
    foreach ($update as $k => $v) {
        $hash[$k] = AddSlashes($v);
        if (in_array($k, $solr_fields)) {
            $solr_update++;
        }
    }
    $rsp = db_update_users($cluster_id, 'FlickrPhotos', $hash, $where);
    if (!$rsp['ok']) {
        return $rsp;
    }
    cache_unset($cache_key);
    if ($GLOBALS['cfg']['enable_feature_solr'] && $solr_update) {
        $photo = flickr_photos_get_by_id($photo['id']);
        # This is a quick hack that may become permanent. Basically
        # we need to refetch the data in flickr.photos.getInfo in
        # order to update the solr db. Normally the _index_photo pulls
        # this information from disk; the files having been written
        # by the bin/backup_photos.php script. As I write this the www
        # server does not have write permissions on the static photos
        # directory. If it did, this whole problem would go away and in
        # the end that may be the simplest possible solution. Until then
        # we'll fetch the (meta) data directly from the API and force
        # feed it to the search indexer. If you're wondering: Yes, it means
        # that the local solr db and the actual JSON dump of photos.getInfo
        # will be out of sync but that will sort itself out the next
        # time bin/backup_photos.php is run (20111231/straup)
        loadlib("flickr_photos_metadata");
        $meta = flickr_photos_metadata_fetch($photo, 'inflate');
        flickr_photos_search_index_photo($photo, $meta);
    }
    return $rsp;
}