Skip to content

Commit

Permalink
Update Template.php
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann authored Feb 3, 2024
1 parent b24ac93 commit 8159cf6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -6619,11 +6619,12 @@ public function verify_doi() : bool {
if (!$doi) return FALSE;
if ($this->doi_valid) return TRUE;
if ($last_doi === $doi) {
report_info("Rechecking if DOI " . echoable($doi) . " is operational..."); // Sometimes we get NULL, so check again for FALSE/TRUE
$chatty = FALSE;
} else {
$last_doi = $doi;
report_info("Checking that DOI " . echoable($doi) . " is operational...");
$chatty = TRUE;
}
if ($chatty) report_info("Checking that DOI " . echoable($doi) . " is operational...");
$trial = get_possible_dois($doi);
foreach ($trial as $try) {
// Check that it begins with 10.
Expand All @@ -6633,7 +6634,7 @@ public function verify_doi() : bool {
$this->doi_valid = TRUE;
foreach (DOI_BROKEN_ALIASES as $alias) $this->forget($alias);
if ($doi === $try) {
report_inline('DOI ok.');
if ($chatty) report_inline('DOI ok.');
} else {
report_info("Modified DOI: " . echoable($try) . " is operational...");
}
Expand All @@ -6648,7 +6649,7 @@ public function verify_doi() : bool {
$this->doi_valid = TRUE;
foreach (DOI_BROKEN_ALIASES as $alias) $this->forget($alias);
if ($doi === $try) {
report_inline('DOI ok.');
if ($chatty) report_inline('DOI ok.');
} else {
report_info("Modified DOI: " . echoable($try) . " is operational...");
}
Expand All @@ -6660,15 +6661,15 @@ public function verify_doi() : bool {
report_warning("DOI status unknown. doi.org failed to respond to: " . doi_link($doi)); // @codeCoverageIgnore
return FALSE; // @codeCoverageIgnore
} elseif ($doi_status === FALSE) {
report_inline("It's not...");
if ($chatty) report_inline("It's not...");
$this->add_if_new('doi-broken-date', date("Y-m-d"));
return FALSE;
} else {
// Only get to this code if we got NULL earlier and now suddenly get OK
// @codeCoverageIgnoreStart
foreach (DOI_BROKEN_ALIASES as $alias) $this->forget($alias);
$this->doi_valid = TRUE;
report_inline('DOI ok.');
if ($chatty) report_inline('DOI ok.');
return TRUE;
// @codeCoverageIgnoreEnd
}
Expand Down

0 comments on commit 8159cf6

Please sign in to comment.