#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); $shortoptions = 'i:n:a'; $longoptions = array('id=', 'nickname=', 'all'); $helptext = <<find()) { while ($user->fetch()) { updateOStatus($user); } } } else { show_help(); exit(1); } } catch (Exception $e) { print $e->getMessage()."\n"; exit(1); } function updateOStatus($user) { if (!have_option('q', 'quiet')) { echo "{$user->nickname}..."; } $up = $user->getProfile(); $sp = $user->getSubscriptions(); $rps = array(); while ($sp->fetch()) { $remote = Remote_profile::staticGet('id', $sp->id); if (!empty($remote)) { $rps[] = clone($sp); } } if (!have_option('q', 'quiet')) { echo count($rps) . "\n"; } foreach ($rps as $rp) { try { if (!have_option('q', 'quiet')) { echo "Checking {$rp->nickname}..."; } $op = Ostatus_profile::ensureProfile($rp->profileurl); if (empty($op)) { echo "can't convert.\n"; continue; } else { if (!have_option('q', 'quiet')) { echo "Converting..."; } Subscription::cancel($up, $rp); Subscription::start($up, $op->localProfile()); if (!have_option('q', 'quiet')) { echo "done.\n"; } } } catch (Exception $e) { if (!have_option('q', 'quiet')) { echo "fail.\n"; } continue; common_log(LOG_WARNING, "Couldn't convert OMB subscription (" . $up->nickname . ", " . $rp->nickname . ") to OStatus: " . $e->getMessage()); continue; } } }