From: Mikael Nordfeldth Date: Thu, 4 Feb 2016 11:05:58 +0000 (+0100) Subject: Fix issue #127 by catching exceptions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1f01356076ffcce777f5bc59af6aa7c943bb058a;p=quix0rs-gnu-social.git Fix issue #127 by catching exceptions update-profile-data.php threw exceptions on http connection issues --- 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;