Fix issue #127 by catching exceptions

update-profile-data.php threw exceptions on http connection issues
This commit is contained in:
Mikael Nordfeldth 2016-02-04 12:05:58 +01:00
parent 60804d1902
commit 1f01356076
1 changed files with 18 additions and 3 deletions

View File

@ -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;