Skip to content

Commit dcb787f

Browse files
authored
fix: edit items in place when stripping prefixes, do not use regex (#708)
* fix: edit items in place when stripping prefixes, do not use regex * docs: add changelog
1 parent 0101597 commit dcb787f

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# api
22

3-
## 8x.28.11 - 12 December 2023
4-
- Batches that are done shall never be marked failed
3+
## 8x.29.1 - 13 December 2023
4+
- Try to fix memory exhaustion issue when running wbs-qs:rebuild command
55

66
## 8x.29.0 - 13 December 2023
77
- Add command for rebuilding Queryservice data
88

9+
## 8x.28.11 - 12 December 2023
10+
- Batches that are done shall never be marked failed
11+
912
## 8x.28.10 - 29 November 2023
1013
- Requeueing should not select failed batches
1114

app/Console/Commands/RebuildQueryserviceData.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ private function getEntitiesForWiki (Wiki $wiki): array
9292
: [];
9393

9494
$merged = array_merge($items, $properties, $lexemes);
95-
return $this->stripPrefixes($merged);
95+
$this->stripPrefixes($merged);
96+
return $merged;
9697
}
9798

9899
private function getSparqlUrl (Wiki $wiki): string
@@ -154,10 +155,11 @@ private function fetchPagesInNamespace(string $wikiDomain, int $namespace): arra
154155
return $titles;
155156
}
156157

157-
private static function stripPrefixes (array $items): array
158+
private static function stripPrefixes (array &$items): void
158159
{
159-
return array_map(function (string $item) {
160-
return preg_replace('/^[a-zA-Z]+:/', '', $item);
161-
}, $items);
160+
foreach ($items as &$item) {
161+
$e = explode(':', $item);
162+
$item = end($e);
163+
}
162164
}
163165
}

0 commit comments

Comments
 (0)