Skip to content

Commit

Permalink
Merge pull request #4729 from ms609/GlazerMann-patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann authored Dec 11, 2024
2 parents 2978e2c + 0268e2e commit 6420e90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 10 additions & 0 deletions constants/bad_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -13040,3 +13040,13 @@
'10.7759/cureus.',
'10.7766/',
];

const BAD_DOI_ARRAY = [
'10.1126/science' => true,
'' => true,
'10.7556/jaoa' => true,
'10.1267/science.040579197' => true,
'10.0000/Rubbish_bot_failure_test' => true,
'10.0000/Rubbish_bot_failure_test2' => true,
'10.0000/Rubbish_bot_failure_test.x' => true,
];
13 changes: 2 additions & 11 deletions expandFns.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ final class HandleCache {
// Greatly speed-up by having one array of each kind and only look for hash keys, not values
private const MAX_CACHE_SIZE = 100000;
public const MAX_HDL_SIZE = 1024;
private const BAD_DOI_ARRAY = [
'10.1126/science' => true,
'' => true,
'10.7556/jaoa' => true,
'10.1267/science.040579197' => true,
'10.0000/Rubbish_bot_failure_test' => true,
'10.0000/Rubbish_bot_failure_test2' => true,
'10.0000/Rubbish_bot_failure_test.x' => true,
];

/** @var array<bool> $cache_active */
public static array $cache_active = []; // DOI is in CrossRef and works
Expand All @@ -29,7 +20,7 @@ final class HandleCache {
/** @var array<string> $cache_hdl_loc */
public static array $cache_hdl_loc = []; // Final HDL location URL
/** @var array<bool> $cache_hdl_bad */
public static array $cache_hdl_bad = self::BAD_DOI_ARRAY; // HDL/DOI does not resolve to anything
public static array $cache_hdl_bad = BAD_DOI_ARRAY; // HDL/DOI does not resolve to anything
/** @var array<bool> $cache_hdl_null */
public static array $cache_hdl_null = []; // HDL/DOI resolves to null

Expand All @@ -49,7 +40,7 @@ public static function free_memory(): void {
self::$cache_inactive = [];
self::$cache_good = [];
self::$cache_hdl_loc = [];
self::$cache_hdl_bad = self::BAD_DOI_ARRAY;
self::$cache_hdl_bad = BAD_DOI_ARRAY;
self::$cache_hdl_null = [];
gc_collect_cycles();
}
Expand Down

0 comments on commit 6420e90

Please sign in to comment.