#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); $shortoptions = 'i:n:a'; $longoptions = array('id=', 'nickname=', 'all'); $helptext = <<find()) { while ($user->fetch()) { try { updateOStatus($user); } catch (Exception $e) { common_log(LOG_NOTICE, "Couldn't convert OMB subscriptions ". "for {$user->nickname} to OStatus: " . $e->getMessage()); } } } } 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 = $up->getSubscribed(); $rps = array(); while ($sp->fetch()) { $remote = Remote_profile::getKV('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::ensureProfileURL($rp->profileurl); if (empty($op)) { echo "can't convert.\n"; continue; } else { if (!have_option('q', 'quiet')) { echo "Converting..."; } Subscription::start($up, $op->localProfile()); Subscription::cancel($up, $rp); if (!have_option('q', 'quiet')) { echo "done.\n"; } } } catch (Exception $e) { if (!have_option('q', 'quiet')) { echo "fail.\n"; } common_log(LOG_NOTICE, "Couldn't convert OMB subscription (" . $up->nickname . ", " . $rp->nickname . ") to OStatus: " . $e->getMessage()); continue; } } }