#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'i:n:a'; $longoptions = array('id=', 'nickname=', 'all'); $helptext = <<find()) { while ($user->fetch()) { updateProfileURL($user); } } } else { show_help(); exit(1); } } catch (Exception $e) { print $e->getMessage()."\n"; exit(1); } function updateProfileURL($user) { $profile = $user->getProfile(); if (empty($profile)) { throw new Exception("Can't find profile for user $user->nickname ($user->id)"); } $orig = clone($profile); $profile->profileurl = common_profile_url($user->nickname); if (!have_option('q', 'quiet')) { print "Updating profile url for $user->nickname ($user->id) ". "from $orig->profileurl to $profile->profileurl..."; } $result = $profile->update($orig); if (!$result) { print "FAIL.\n"; common_log_db_error($profile, 'UPDATE', __FILE__); throw new Exception("Can't update profile for user $user->nickname ($user->id)"); } common_broadcast_profile($profile); print "OK.\n"; }