From 1f01356076ffcce777f5bc59af6aa7c943bb058a Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 4 Feb 2016 12:05:58 +0100 Subject: [PATCH] Fix issue #127 by catching exceptions update-profile-data.php threw exceptions on http connection issues --- .../OStatus/scripts/update-profile-data.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/OStatus/scripts/update-profile-data.php b/plugins/OStatus/scripts/update-profile-data.php index ca48dc34a7..97d44e3842 100755 --- a/plugins/OStatus/scripts/update-profile-data.php +++ b/plugins/OStatus/scripts/update-profile-data.php @@ -105,7 +105,12 @@ if (have_option('all')) { $oprofile->find(); echo "Found $oprofile->N profiles:\n\n"; while ($oprofile->fetch()) { - $ok = fixProfile($oprofile->uri) && $ok; + try { + $ok = fixProfile($oprofile->uri) && $ok; + } catch (Exception $e) { + $ok = false; + echo "Failed on URI=="._ve($oprofile->uri).": {$e->getMessage()}\n"; + } } } else if (have_option('suspicious')) { $oprofile = new Ostatus_profile(); @@ -114,11 +119,21 @@ if (have_option('all')) { $oprofile->find(); echo "Found $oprofile->N matching profiles:\n\n"; while ($oprofile->fetch()) { - $ok = fixProfile($oprofile->uri) && $ok; + try { + $ok = fixProfile($oprofile->uri) && $ok; + } catch (Exception $e) { + $ok = false; + echo "Failed on URI=="._ve($oprofile->uri).": {$e->getMessage()}\n"; + } } } else if (!empty($args[0]) && $validate->uri($args[0])) { $uri = $args[0]; - $ok = fixProfile($uri); + try { + $ok = fixProfile($oprofile->uri) && $ok; + } catch (Exception $e) { + $ok = false; + echo "Failed on URI=="._ve($oprofile->uri).": {$e->getMessage()}\n"; + } } else { print "$helptext"; $ok = false;