id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
17,600 | 06cdfb0bd6a24786e4a7cb1922f9dced | swh:1:cnt:d91d5143c4b74a6855adef81adf9ad539ec4cf1b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-29/ | 586ab8eece2109af7e424a81e4cf21f5190a1027 | ArticleGuidance | deployed | src/Hooks/PublishFollowUpHandler.php | PublishFollowUpHandler::onBeforePageDisplay( $out, $skin ) | function | /**
* Load the post-publish follow-up module after an ArticleGuidance publish.
*
* A session flag set by EditTagHandler signals that the current page view
* immediately follows an ArticleGuidance publish.
*
* @inheritDoc
*/
public function onBeforePageDisplay( $out, $skin ): void {
$session = $out->get... |
17,601 | e863fcda20c33032c1df5444737044c2 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=18-244/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler | type | class RedLinkRedirectHandler implements BeforeInitializeHook {
public function __construct(
private readonly TitleExtractor $titleExtractor,
private readonly Config $mainConfig,
private readonly TitleFactory $titleFactory,
private readonly ArticleGuidanceExperimentFactory $experimentFactory,
) {
}
/**
*... |
17,602 | 0177c51d5d45dab78d623c0cb76eb129 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=20-26/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::__construct(
private readonly TitleExtractor $titleExtractor,
private readonly Config $mainConfig,
private readonly TitleFactory $titleFactory,
private readonly ArticleGuidanceExperimentFactory $experimentFactory,
) | function | public function __construct(
private readonly TitleExtractor $titleExtractor,
private readonly Config $mainConfig,
private readonly TitleFactory $titleFactory,
private readonly ArticleGuidanceExperimentFactory $experimentFactory,
) {
} |
17,603 | 12303e645cd6e4cf20c16e6c2115b5b4 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=71-123/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::isRefererInScope( WebRequest $request ) | function | /**
* Check whether the request's referer page is within the configured experiment scope.
*
* Title matching normalises both sides to DB keys to handle spaces/underscores and namespace
* aliases. Category matching performs a DB query and only runs when the title list produces
* no match. If both lists are emp... |
17,604 | 4fa321653145bdf8398783c0e1713cb1 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=56-69/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::getRefererTitle( WebRequest $request ) | function | /**
* Resolve the referer URL from a request to a Title object.
*
* @param WebRequest $request
* @return Title|null
*/
private function getRefererTitle( WebRequest $request ): ?Title {
$refererUrl = $request->getHeader( 'Referer' );
$refererTitle = $this->titleExtractor->extractPageTitle( $refererUrl ?: ... |
17,605 | a4a709efeae20d2b0e7be3b71b642171 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=28-40/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::isArticleRedLink( Title $title, WebRequest $request ) | function | /**
* Check if a title is a red-link article edit request.
*
* @param Title $title
* @param WebRequest $request
* @return bool
*/
private function isArticleRedLink( Title $title, WebRequest $request ): bool {
return $request->getVal( 'action' ) === 'edit'
&& $request->getVal( 'redlink' ) === '1'
&&... |
17,606 | 49b90058371fc2168b1e4e8e17b29ef9 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=42-54/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::isInTreatmentGroup() | function | /**
* Check whether the user is in the experiment treatment group, or whether
* traffic splitting is disabled (no experiment configured or TestKitchen unavailable).
*
* @return bool
*/
private function isInTreatmentGroup(): bool {
$experiment = $this->experimentFactory->getExperiment();
if ( $experiment ... |
17,607 | 7f4bff1de8967f38b13b7cb59d8f61a0 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=125-133/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::isUserAllowed( User $user ) | function | /**
* Check whether the user is within the experiment's target audience.
*
* @param User $user
* @return bool
*/
private function isUserAllowed( User $user ): bool {
return $user->isAllowed( 'createpage' ) && $user->getBlock() === null;
} |
17,608 | dc7ec06579ebfba2ed0c7f5c5adfc8b6 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=135-145/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::performRedirect( OutputPage $output, array $params ) | function | /**
* Perform redirect to Special:NewArticle
*
* @param OutputPage $output
* @param array $params Parameters to pass to the URL (e.g. 'newarticletitle', 'source').
* @return void
*/
private function performRedirect( OutputPage $output, array $params ): void {
$specialPage = SpecialPage::getTitleFor( 'New... |
17,609 | 5227036e1f426b73ba229dd883cbd123 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=147-169/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::isEntryPointPage( Title $title ) | function | /**
* Check whether the current page is a configured entry-point title.
*
* @param Title $title
* @return bool
*/
private function isEntryPointPage( Title $title ): bool {
$entryPointTitles = $this->mainConfig->get( 'ArticleGuidanceExperimentEntryPointTitles' );
if ( !is_array( $entryPointTitles ) || $en... |
17,610 | e851183a995b4983551c4066146ef39c | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=171-176/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::sendExperimentExposure() | function | private function sendExperimentExposure(): void {
$experiment = $this->experimentFactory->getExperiment();
if ( $experiment !== null ) {
$experiment->sendExposure();
}
} |
17,611 | 54d86ca24bd588941b9acb86dd83fc32 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=178-187/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::sendEditingStartedEvent( Title $title ) | function | private function sendEditingStartedEvent( Title $title ): void {
$experiment = $this->experimentFactory->getExperiment();
if ( $experiment !== null ) {
$experiment->send( 'editing_start', [
'page' => [
'title' => $title->getPrefixedText(),
]
] );
}
} |
17,612 | 62e75b17450c805580653b51cf0dcf43 | swh:1:cnt:e2ddd3e39cb70338948b3199a3b5817b074f517e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=189-243/ | 4845591c4454ea474ec293be86dc918fe6302436 | ArticleGuidance | deployed | src/Hooks/RedLinkRedirectHandler.php | RedLinkRedirectHandler::onBeforeInitialize( $title, $unused, $output, $user, $request, $mediaWikiEntryPoint ) | function | /**
* @inheritDoc
*/
public function onBeforeInitialize( $title, $unused, $output, $user, $request, $mediaWikiEntryPoint ) {
if ( $title === null || $user->isAnon() ) {
return;
}
// Case 1: user arrived at the editor from Article Guidance
if ( $request->getCheck( 'articleguidance' )
&& ( $request->g... |
17,613 | fcd4847fab303c2f3c333ba57e9f047a | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-50/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler | type | /**
* REST handler for listing article guidance outlines
*/
class ListOutlinesHandler extends Handler {
public function __construct(
private readonly OutlineService $outlineService,
) {
}
/**
* @return Response
*/
public function execute(): Response {
$response = $this->getResponseFactory()->createJson... |
17,614 | 73614f078dee87a45e1d096b530455a2 | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=16-19/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler::__construct(
private readonly OutlineService $outlineService,
) | function | public function __construct(
private readonly OutlineService $outlineService,
) {
} |
17,615 | d6db358180523d675ec137e722ff2b36 | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=37-42/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler::needsWriteAccess() | function | /**
* @return bool
*/
public function needsWriteAccess(): bool {
return false;
} |
17,616 | b0a77f472d2fdd44b9208f4cdcf17623 | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=32-35/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler::getLastModified() | function | /** @inheritDoc */
protected function getLastModified() {
return $this->outlineService->getLastModified();
} |
17,617 | 48380fe1c9d8ebe9bc85f13a25684d97 | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=44-49/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler::getParamSettings() | function | /**
* @return array
*/
public function getParamSettings(): array {
return [];
} |
17,618 | 7ed25f6d31fdc1aa7b4f281c8a36967d | swh:1:cnt:a562cd5ba0cf876cd057706f0d7a71ad8b5eeaab;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=21-30/ | e225f89b6427bcccf5d62a92007ddf554ec703bf | ArticleGuidance | deployed | src/Rest/ListOutlinesHandler.php | ListOutlinesHandler::execute() | function | /**
* @return Response
*/
public function execute(): Response {
$response = $this->getResponseFactory()->createJson( [
'outlines' => $this->outlineService->getOutlines()
] );
$response->setHeader( 'Cache-Control', 'public, s-maxage=300' );
return $response;
} |
17,619 | 3d025425e8b6eb765dfab7ee5b5f4f1d | swh:1:cnt:a445ed6ce7108af7760be7f02ebe8b3e18eedcec;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=13-66/ | 536778329153553ee23028fbecf6bdb6772d789a | ArticleGuidance | deployed | src/Rest/ValidateSourceHandler.php | ValidateSourceHandler | type | /**
* REST handler for validating article sources
*/
class ValidateSourceHandler extends Handler {
public function __construct(
private readonly SourceValidator $sourceValidator,
) {
}
/**
* @return bool
*/
public function needsWriteAccess(): bool {
return false;
}
/**
* @return array
*/
public... |
17,620 | 58462e347fca1d8ea20a180e6b245b9c | swh:1:cnt:a445ed6ce7108af7760be7f02ebe8b3e18eedcec;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=18-21/ | 536778329153553ee23028fbecf6bdb6772d789a | ArticleGuidance | deployed | src/Rest/ValidateSourceHandler.php | ValidateSourceHandler::__construct(
private readonly SourceValidator $sourceValidator,
) | function | public function __construct(
private readonly SourceValidator $sourceValidator,
) {
} |
17,621 | d6db358180523d675ec137e722ff2b36 | swh:1:cnt:a445ed6ce7108af7760be7f02ebe8b3e18eedcec;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=23-28/ | 536778329153553ee23028fbecf6bdb6772d789a | ArticleGuidance | deployed | src/Rest/ValidateSourceHandler.php | ValidateSourceHandler::needsWriteAccess() | function | /**
* @return bool
*/
public function needsWriteAccess(): bool {
return false;
} |
17,622 | 22ed7bcfee62126145d72ddb5d71d55f | swh:1:cnt:a445ed6ce7108af7760be7f02ebe8b3e18eedcec;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=30-47/ | 536778329153553ee23028fbecf6bdb6772d789a | ArticleGuidance | deployed | src/Rest/ValidateSourceHandler.php | ValidateSourceHandler::getParamSettings() | function | /**
* @return array
*/
public function getParamSettings(): array {
return [
'url' => [
self::PARAM_SOURCE => 'query',
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true,
],
'outlineQId' => [
self::PARAM_SOURCE => 'query',
ParamValidator::PARAM_TYPE => 'str... |
17,623 | ecdeafca9280a04092485a397e65bf95 | swh:1:cnt:a445ed6ce7108af7760be7f02ebe8b3e18eedcec;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=49-65/ | 536778329153553ee23028fbecf6bdb6772d789a | ArticleGuidance | deployed | src/Rest/ValidateSourceHandler.php | ValidateSourceHandler::execute() | function | /**
* @return Response
*/
public function execute(): Response {
$url = $this->getValidatedParams()['url'];
$outlineQId = $this->getValidatedParams()['outlineQId'];
try {
$result = $this->sourceValidator->validate( $url, $outlineQId );
} catch ( InvalidArgumentException ) {
return $this->getResponseF... |
17,624 | fc98a5322e28e27741780e19d2517e5a | swh:1:cnt:4ff180f4fd8670f79fa0ec6c2a66362a38a8616a;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-26/ | 22e12bb6528506ca2817a79157423021df2491fd | ArticleGuidance | deployed | src/Services/ArticleGuidanceExperimentFactory.php | ArticleGuidanceExperimentFactory | type | class ArticleGuidanceExperimentFactory {
public function __construct(
private readonly Config $mainConfig,
private readonly ?ExperimentManagerInterface $experimentManager,
) {
}
public function getExperiment(): ?ExperimentInterface {
$experimentName = $this->mainConfig->get( 'ArticleGuidanceExperimentName' ... |
17,625 | 30a26829c2db1d4e9cb9f7b3336cf6df | swh:1:cnt:4ff180f4fd8670f79fa0ec6c2a66362a38a8616a;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=13-17/ | 22e12bb6528506ca2817a79157423021df2491fd | ArticleGuidance | deployed | src/Services/ArticleGuidanceExperimentFactory.php | ArticleGuidanceExperimentFactory::__construct(
private readonly Config $mainConfig,
private readonly ?ExperimentManagerInterface $experimentManager,
) | function | public function __construct(
private readonly Config $mainConfig,
private readonly ?ExperimentManagerInterface $experimentManager,
) {
} |
17,626 | aada52426cd0f0839af3b61bc95739dc | swh:1:cnt:4ff180f4fd8670f79fa0ec6c2a66362a38a8616a;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=19-25/ | 22e12bb6528506ca2817a79157423021df2491fd | ArticleGuidance | deployed | src/Services/ArticleGuidanceExperimentFactory.php | ArticleGuidanceExperimentFactory::getExperiment() | function | public function getExperiment(): ?ExperimentInterface {
$experimentName = $this->mainConfig->get( 'ArticleGuidanceExperimentName' );
if ( $this->experimentManager === null || $experimentName === '' ) {
return null;
}
return $this->experimentManager->getExperiment( $experimentName );
} |
17,627 | b408231d60e2b166a0ad1c1041092197 | swh:1:cnt:bc32c74d3a5f6794375682ed46b55a57a5250f53;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=10-233/ | 4d5fb08f48ddfb3671482ad08260f6c8337cfd3b | ArticleGuidance | deployed | src/Services/ArticleGuidanceRenderer.php | ArticleGuidanceRenderer | type | /**
* Renders HTML for ext-articleguidance tag
*/
class ArticleGuidanceRenderer {
/**
* Render the article guidance HTML
*
* @param string|null $wikidataId Wikidata Q ID
* @param string|null $wikidataLabel Label from Wikidata
* @param string|null $wikidataDescription Description from Wikidata
* @param s... |
17,628 | 55107506b3ec63d96137873d5e190676 | swh:1:cnt:bc32c74d3a5f6794375682ed46b55a57a5250f53;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=15-232/ | 4d5fb08f48ddfb3671482ad08260f6c8337cfd3b | ArticleGuidance | deployed | src/Services/ArticleGuidanceRenderer.php | ArticleGuidanceRenderer::render(
?string $wikidataId,
?string $wikidataLabel,
?string $wikidataDescription,
?string $articleType,
array $notabilityRisk,
array $invalidNotabilityRisk,
?string $instructionsHtml,
?array $recommendedSourcesHtml,
?array $discouragedSourcesHtml,
?string $wikidataImage = n... | function | /**
* Render the article guidance HTML
*
* @param string|null $wikidataId Wikidata Q ID
* @param string|null $wikidataLabel Label from Wikidata
* @param string|null $wikidataDescription Description from Wikidata
* @param string|null $articleType Raw article-type attribute (for error display)
* @param arra... |
17,629 | c7d4b1be23a8397495082dadeafd4cdf | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=12-135/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService | type | /**
* Service for managing article guidance outlines
*/
class OutlineService {
/** @var array{outlines: array, lastModified: string|null}|null */
private ?array $cache = null;
public function __construct(
private readonly TitleFactory $titleFactory,
private readonly PageProps $pageProps,
) {
}
/**
* Ge... |
17,630 | ee88848f659aa0ca16c87854b297d934 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=20-24/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::__construct(
private readonly TitleFactory $titleFactory,
private readonly PageProps $pageProps,
) | function | public function __construct(
private readonly TitleFactory $titleFactory,
private readonly PageProps $pageProps,
) {
} |
17,631 | da38c8efdeb337823ff93e34f0240035 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=60-66/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getData() | function | /**
* @return array{outlines: array, lastModified: string|null}
*/
private function getData(): array {
$this->cache ??= $this->fetchData();
return $this->cache;
} |
17,632 | ad4a50530f160bc7f4de3763b157496c | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=26-33/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getOutlines() | function | /**
* Get all outlines in the wiki.
*
* @return array Array of outline data
*/
public function getOutlines(): array {
return $this->getData()['outlines'];
} |
17,633 | d8a09b2b0cfe0072ece2a61bf9328d85 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=35-48/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getOutlineByQId( string $qId ) | function | /**
* Get a single outline by its Wikidata Q-ID, or null if not found.
*
* @param string $qId
* @return array|null
*/
public function getOutlineByQId( string $qId ): ?array {
foreach ( $this->getOutlines() as $outline ) {
if ( ( $outline['articleType'] ?? null ) === $qId ) {
return $outline;
}
... |
17,634 | 2d4c577085063338da7aa9adf2470305 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=50-58/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getLastModified() | function | /**
* Get the timestamp of the most recently touched category member.
* Used by the REST handler for Last-Modified / 304 support.
*
* @return string|null MW timestamp, or null if the category is empty
*/
public function getLastModified(): ?string {
return $this->getData()['lastModified'];
} |
17,635 | e98cbe500b7af614872b0021cbcd1e24 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=68-115/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::fetchData() | function | /**
* Fetch all outlines and the max page_touched timestamp from page props.
*
* @return array{outlines: array, lastModified: string|null}
*/
private function fetchData(): array {
$categoryTitle = $this->titleFactory->makeTitle( NS_CATEGORY, $this->getCategoryName() );
$members = $this->getCategoryMembers(... |
17,636 | 528c0cba4aee02838d95f42cd74a28dc | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=117-128/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getCategoryMembers( Title $categoryTitle ) | function | /**
* Get category members for the given category title.
*
* Protected to allow overriding in tests.
*
* @param Title $categoryTitle
* @return iterable<Title>
*/
protected function getCategoryMembers( Title $categoryTitle ): iterable {
$category = Category::newFromTitle( $categoryTitle );
return $cat... |
17,637 | 816f3800de11009713287cfb746bf907 | swh:1:cnt:13c334494090a1b99a5bf0c3c1a5f9b38a6c3120;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=130-134/ | 8f872e1184ed076f35081b88a1ffa009e13d7c77 | ArticleGuidance | deployed | src/Services/OutlineService.php | OutlineService::getCategoryName() | function | private function getCategoryName(): string {
return wfMessage( 'articleguidance-tracking-category' )
->inContentLanguage()
->text();
} |
17,638 | b08ad68ac891d4799f1ff5a4453d44bf | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-115/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator | type | /**
* Service for validating article sources.
*/
class SourceValidator {
public function __construct(
private readonly ?SpamBlacklist $spamBlacklist,
private readonly UserFactory $userFactory,
private readonly OutlineService $outlineService,
private readonly UrlAsciiEncoder $urlAsciiEncoder,
) {
}
/**
... |
17,639 | 39b440d111b071985ed535b537248677 | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=16-22/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator::__construct(
private readonly ?SpamBlacklist $spamBlacklist,
private readonly UserFactory $userFactory,
private readonly OutlineService $outlineService,
private readonly UrlAsciiEncoder $urlAsciiEncoder,
) | function | public function __construct(
private readonly ?SpamBlacklist $spamBlacklist,
private readonly UserFactory $userFactory,
private readonly OutlineService $outlineService,
private readonly UrlAsciiEncoder $urlAsciiEncoder,
) {
} |
17,640 | bfd94e0117fa966081e8802ed0d46c75 | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=78-100/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator::classifyDomain( string $domain, ?string $outlineQId ) | function | /**
* @param string $domain
* @param string|null $outlineQId
* @return string 'recommended', 'discouraged', or 'neutral'
*/
private function classifyDomain( string $domain, ?string $outlineQId ): string {
if ( $outlineQId === null ) {
return 'neutral';
}
$outline = $this->outlineService->getOutlineByQ... |
17,641 | 2061166e5a42aa3d308581db60efbba9 | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=102-114/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator::domainMatches( string $domain, array $allowedDomains ) | function | /**
* @param string $domain
* @param string[] $allowedDomains
* @return bool
*/
private function domainMatches( string $domain, array $allowedDomains ): bool {
foreach ( $allowedDomains as $allowed ) {
if ( $domain === $allowed || str_ends_with( $domain, '.' . $allowed ) ) {
return true;
}
}
re... |
17,642 | 55d9db1968e72795d06c4a01d7213774 | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=62-76/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator::titleFromPath( string $url ) | function | /**
* Derive a human-readable title from the last path segment of a URL.
* e.g. "/posts/my-article-slug" → "My article slug"
*
* @param string $url
* @return string|null
*/
private function titleFromPath( string $url ): ?string {
$path = parse_url( $url, PHP_URL_PATH ) ?? '';
$slug = basename( $path );... |
17,643 | 74a8bba43c89662305e4a21c8d62d343 | swh:1:cnt:278fb5b6c4c17cb6dbfaedfaf33dbde527c47372;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=24-60/ | aaefd1958c814e919cd3d75c71ce4c2250f5cc8a | ArticleGuidance | deployed | src/Services/SourceValidator.php | SourceValidator::validate( string $url, ?string $outlineQId = null ) | function | /**
* Validate a URL and return a result array with domain, classification, and title.
*
* @param string $url
* @param string|null $outlineQId Q-ID of the selected outline, for domain classification
* @return array{domain: string, classification: string, title: string|null}
* @throws InvalidArgumentExceptio... |
17,644 | c3ffd800c6259146a2ed31b92aeb40b3 | swh:1:cnt:de0121015f9c479301464e95f48fcef833c122d1;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=7-57/ | 432215279283e34264177333ae1b1f31f71ae934 | ArticleGuidance | deployed | src/Services/TagContentExtractorService.php | TagContentExtractorService | type | /**
* Service for extracting sources and instructions from wikitext or HTML content.
*/
class TagContentExtractorService {
/**
* Extract a list of sources from a pseudo-tag in raw wikitext.
*
* @param string $wikitext The raw wikitext
* @param string $tagName The tag name to extract (e.g., 'recommended-sourc... |
17,645 | cf42fe7f2fc73fd36f3f6d162950b627 | swh:1:cnt:de0121015f9c479301464e95f48fcef833c122d1;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-43/ | 432215279283e34264177333ae1b1f31f71ae934 | ArticleGuidance | deployed | src/Services/TagContentExtractorService.php | TagContentExtractorService::extractSources( string $wikitext, string $tagName ) | function | /**
* Extract a list of sources from a pseudo-tag in raw wikitext.
*
* @param string $wikitext The raw wikitext
* @param string $tagName The tag name to extract (e.g., 'recommended-sources')
* @return array List of sources (strings) divided into info and URLs
*/
public function extractSources( string $wiki... |
17,646 | b869c0efbacf6fa95ce36abc4279dcd1 | swh:1:cnt:de0121015f9c479301464e95f48fcef833c122d1;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=45-56/ | 432215279283e34264177333ae1b1f31f71ae934 | ArticleGuidance | deployed | src/Services/TagContentExtractorService.php | TagContentExtractorService::extractInstructions( string $content ) | function | /**
* Extract the raw text instructions from a pseudo-tag in wikitext or HTML.
*
* @param string $content The wikitext or HTML content
* @return string|null The raw text inside the tag, or null if not found
*/
public function extractInstructions( string $content ): ?string {
if ( preg_match( '/<instruction... |
17,647 | 74f88da46fd4ca59d7ecf564da17755a | swh:1:cnt:b0cbb9e2a224c8830a7d540dbf68b9c106d65b59;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=7-39/ | cba653c10f6e8566e9e17700e012506829ae040c | ArticleGuidance | deployed | src/Services/TitleExtractor.php | TitleExtractor | type | class TitleExtractor {
/**
* Extract the page title from a MediaWiki URL.
*
* Handles both pretty URLs (/wiki/Article_Title) and
* script URLs (/w/index.php?title=Article_Title).
*
* @param string $url The URL to parse
* @return string|null The page title, or null if not found
*/
public function extr... |
17,648 | aedff03ad138e59d8f8c07bad210e66b | swh:1:cnt:b0cbb9e2a224c8830a7d540dbf68b9c106d65b59;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=9-38/ | cba653c10f6e8566e9e17700e012506829ae040c | ArticleGuidance | deployed | src/Services/TitleExtractor.php | TitleExtractor::extractPageTitle( string $url ) | function | /**
* Extract the page title from a MediaWiki URL.
*
* Handles both pretty URLs (/wiki/Article_Title) and
* script URLs (/w/index.php?title=Article_Title).
*
* @param string $url The URL to parse
* @return string|null The page title, or null if not found
*/
public function extractPageTitle( string $url... |
17,649 | 20b1a86836aec3b17e3482aa4ffe4962 | swh:1:cnt:54c8764cbf95eae878b4908636ee183dd1d29de8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=7-95/ | c079d551abadf240845caaf90c4ec56740dec052 | ArticleGuidance | deployed | src/Services/UrlAsciiEncoder.php | UrlAsciiEncoder | type | /**
* Encodes URLs to ASCII so that filter_var( FILTER_VALIDATE_URL ) accepts them.
*/
class UrlAsciiEncoder {
/**
* Encode a URL to ASCII so that filter_var( FILTER_VALIDATE_URL ) accepts it.
*
* Two transformations are applied:
* 1. IDN hostname → punycode via idn_to_ascii(), so non-ASCII labels such as
... |
17,650 | 135cd39337ef4d5d4a9d4f98d493a1cc | swh:1:cnt:54c8764cbf95eae878b4908636ee183dd1d29de8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=12-52/ | c079d551abadf240845caaf90c4ec56740dec052 | ArticleGuidance | deployed | src/Services/UrlAsciiEncoder.php | UrlAsciiEncoder::encode( string $url ) | function | /**
* Encode a URL to ASCII so that filter_var( FILTER_VALIDATE_URL ) accepts it.
*
* Two transformations are applied:
* 1. IDN hostname → punycode via idn_to_ascii(), so non-ASCII labels such as
* "bücher" or "ουτοπία" become their xn-- equivalents.
* 2. Non-ASCII bytes in the path, query, and fragme... |
17,651 | ff1e44754f02bc0d9dae5a00dfb87c21 | swh:1:cnt:54c8764cbf95eae878b4908636ee183dd1d29de8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=54-94/ | c079d551abadf240845caaf90c4ec56740dec052 | ArticleGuidance | deployed | src/Services/UrlAsciiEncoder.php | UrlAsciiEncoder::buildUrl( array $parts ) | function | /**
* Reconstruct a URL string from the array returned by parse_url().
*
* @param array $parts
* @return string
*/
private function buildUrl( array $parts ): string {
$url = '';
if ( isset( $parts['scheme'] ) ) {
$url .= $parts['scheme'] . '://';
}
if ( isset( $parts['user'] ) ) {
$url .= $pa... |
17,652 | a89f3e6d4b22a6a9908aac3f13a23889 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=13-334/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher | type | /**
* Service for fetching Wikidata entity information including labels, descriptions,
* images, and hierarchy depth via concurrent API calls
*/
class WikidataInfoFetcher {
private const THUMB_WIDTH = 60;
public function __construct(
private readonly HttpRequestFactory $httpRequestFactory,
private readonly L... |
17,653 | 7526cdc386bc390a15ce89eb687a98a2 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=21-30/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::__construct(
private readonly HttpRequestFactory $httpRequestFactory,
private readonly Language $contentLanguage,
private readonly LoggerInterface $logger,
private readonly WANObjectCache $cache,
private readonly array $matchViaRules,
private readonly string $userAgent,
private readon... | function | public function __construct(
private readonly HttpRequestFactory $httpRequestFactory,
private readonly Language $contentLanguage,
private readonly LoggerInterface $logger,
private readonly WANObjectCache $cache,
private readonly array $matchViaRules,
private readonly string $userAgent,
private readonly st... |
17,654 | 67e5efd26aa34835edd9a1956e7751ad | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=158-207/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::processWbgetentitiesResponse( array $response, string $wikidataId, string $languageCode ) | function | /**
* Process wbgetentities API response
*
* @param array $response Response array from MultiHttpClient
* @param string $wikidataId Wikidata ID being fetched
* @param string $languageCode Language code
* @return array|null Array with label, description, and image, or null on failure
*/
private function p... |
17,655 | 3680101e2134f39a446409015a92d730 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=32-56/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::getCommonsImageUrl( string $filename ) | function | /**
* Convert a Wikimedia Commons image filename to a thumbnail URL
*
* @param string $filename Image filename from Wikidata
* @return string Thumbnail URL
*/
private function getCommonsImageUrl( string $filename ): string {
// Replace spaces with underscores
$filename = str_replace( ' ', '_', $filename ... |
17,656 | 0e9a5afb03ca26f4e5136744bd385785 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=209-227/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::buildSparqlRequest( string $sparqlQuery ) | function | /**
* Build a SPARQL HTTP request array for MultiHttpClient
*
* @param string $sparqlQuery SPARQL query string
* @return array Request array
*/
private function buildSparqlRequest( string $sparqlQuery ): array {
return [
'method' => 'GET',
'url' => rtrim( $this->sparqlEndpoint, '/' ) . '?' . http_bui... |
17,657 | 1ee08a496f1fe6b0f2113428f920bdf0 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=58-156/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::fetchEntityCached( string $wikidataId, string $languageCode, ?string $matchVia = null ) | function | /**
* Fetch a single Wikidata entity with caching, including hierarchy depth and match-via.
*
* Fetches label, description, image, hierarchy depth, and match-via concurrently
* using MultiHttpClient for optimal performance.
*
* When $matchVia is null, the match-via property is inferred from Wikidata supercl... |
17,658 | c99a326167221d51fbc244b451350819 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=229-269/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::buildInferenceAndDepthSparql( string $wikidataId ) | function | /**
* Build a SPARQL query that infers match-via from superclasses and computes
* both P279 and P171 ancestor depths in one request.
*
* Rules from $this->matchViaRules are evaluated in config order via wdt:P31/wdt:P279*;
* the first matching superclass wins. An 'exclude' condition prevents a rule from
* fi... |
17,659 | 0fb914ae7d6126f9711ad1e0c6c606dd | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=271-305/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::processInferenceAndDepthSparqlResponse( array $response ) | function | /**
* Process the combined inference+depth SPARQL response.
* Returns inferred match-via (null means default) and the depth along the correct chain.
*
* @param array $response Response array from MultiHttpClient
* @return array{matchVia: string|null, hierarchyDepth: int|null}
*/
private function processInf... |
17,660 | 97c20b14fef2177b8a6133e898e67265 | swh:1:cnt:15e460d3d152e5230a58d50e1b9a91adc496b33c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=307-333/ | 0c8e74ad636da6eaca1abadd85dec3fe8b9c3dad | ArticleGuidance | deployed | src/Services/WikidataInfoFetcher.php | WikidataInfoFetcher::processSparqlResponse( array $response ) | function | /**
* Process SPARQL response for hierarchy depth with graceful degradation
*
* @param array $response Response array from MultiHttpClient
* @return int|null Hierarchy depth (ancestor count along the relevant property chain), or null on failure
*/
private function processSparqlResponse( array $response ): ?i... |
17,661 | af387bbd0443f6ebb0d4054b029c33fd | swh:1:cnt:a47006bd3910c5c2be03b8cf4f52d5e869618d20;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-76/ | 6c61af8980b5769347e8d9b89093b87e7d40914b | ArticleGuidance | deployed | src/Specials/SpecialNewArticle.php | SpecialNewArticle | type | class SpecialNewArticle extends UnlistedSpecialPage {
public function __construct(
private readonly Language $contentLanguage,
private readonly Config $config,
) {
parent::__construct( 'NewArticle' );
}
/**
* @param string|null $subPage
*/
public function execute( $subPage ) {
$this->setHeaders();
... |
17,662 | 903d4ffae18e3e1970c9f2b04f43c14e | swh:1:cnt:a47006bd3910c5c2be03b8cf4f52d5e869618d20;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=13-18/ | 6c61af8980b5769347e8d9b89093b87e7d40914b | ArticleGuidance | deployed | src/Specials/SpecialNewArticle.php | SpecialNewArticle::__construct(
private readonly Language $contentLanguage,
private readonly Config $config,
) | function | public function __construct(
private readonly Language $contentLanguage,
private readonly Config $config,
) {
parent::__construct( 'NewArticle' );
} |
17,663 | 7a638a6ea057a8f264db54ab36ec9875 | swh:1:cnt:a47006bd3910c5c2be03b8cf4f52d5e869618d20;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=20-48/ | 6c61af8980b5769347e8d9b89093b87e7d40914b | ArticleGuidance | deployed | src/Specials/SpecialNewArticle.php | SpecialNewArticle::execute( $subPage ) | function | /**
* @param string|null $subPage
*/
public function execute( $subPage ) {
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->setPageTitle( $this->msg( 'articleguidance-specialnewarticle-title' )->text() );
$out->addJsConfigVars( 'wgArticleGuidanceDraftTitlePrefix', $this->getD... |
17,664 | 2fbced8feb9e076efadb572de7ce27dd | swh:1:cnt:a47006bd3910c5c2be03b8cf4f52d5e869618d20;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=70-75/ | 6c61af8980b5769347e8d9b89093b87e7d40914b | ArticleGuidance | deployed | src/Specials/SpecialNewArticle.php | SpecialNewArticle::getGroupName() | function | /**
* @return string
*/
protected function getGroupName() {
return 'pages';
} |
17,665 | b7ced2ebea4bb65790920697ff509533 | swh:1:cnt:a47006bd3910c5c2be03b8cf4f52d5e869618d20;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=50-68/ | 6c61af8980b5769347e8d9b89093b87e7d40914b | ArticleGuidance | deployed | src/Specials/SpecialNewArticle.php | SpecialNewArticle::getDraftTitlePrefix() | function | /**
* Build the prefix that goes before the article title when creating a draft.
*
* Uses the Draft namespace (ID 118) when the wiki defines one.
* Falls back to a sub-page of the current user's namespace (ID 2),
* using the SandboxLink subpage name when that extension is present.
*
* @return string e.g. ... |
17,666 | 82f6465845065363550207a889f20f9b | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=11-59/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest | type | /**
* @covers \MediaWiki\Extension\ArticleGuidance\Hooks\PreloadCleanupHandler
*/
class PreloadCleanupHandlerTest extends MediaWikiUnitTestCase {
private function getHandler(): PreloadCleanupHandler {
return new PreloadCleanupHandler();
}
private function runCleanup( string $text ): string {
$title = $this->... |
17,667 | 88fe0fb5421cb49bf853faf156e79a48 | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=16-18/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::getHandler() | function | private function getHandler(): PreloadCleanupHandler {
return new PreloadCleanupHandler();
} |
17,668 | 7c269ac0889c65f46dcfaeecf90e0b7c | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=20-24/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::runCleanup( string $text ) | function | private function runCleanup( string $text ): string {
$title = $this->createMock( Title::class );
$this->getHandler()->onEditFormPreloadText( $text, $title );
return $text;
} |
17,669 | badc8edf1d66d535c17eb7598b6bbe31 | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=34-39/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::testCategoryIsAppendedWhenPresent() | function | public function testCategoryIsAppendedWhenPresent(): void {
$input = "<article-guidance article-type=\"Q5\" category=\"Actors\">\n</article-guidance>\nArticle body.";
$result = $this->runCleanup( $input );
$this->assertStringNotContainsString( '<article-guidance', $result );
$this->assertStringContainsString( '... |
17,670 | a41d1fd29f1b6167983d6a224c53207a | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=26-32/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::testTagIsRemovedWhenNoCategory() | function | public function testTagIsRemovedWhenNoCategory(): void {
$input = "<article-guidance article-type=\"Q5\">\nSome content\n</article-guidance>\nArticle body.";
$result = $this->runCleanup( $input );
$this->assertStringNotContainsString( '<article-guidance', $result );
$this->assertStringContainsString( 'Article b... |
17,671 | 522d0e1abae291be6dfdd2480e54a80e | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=41-45/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::testEmptyCategoryProducesNoLink() | function | public function testEmptyCategoryProducesNoLink(): void {
$input = "<article-guidance article-type=\"Q5\" category=\"\">\n</article-guidance>\nArticle body.";
$result = $this->runCleanup( $input );
$this->assertStringNotContainsString( '[[Category:', $result );
} |
17,672 | cf03e134b478e855201db14b120a832f | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=47-52/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::testCategoryWithInjectionCharsIsSanitized() | function | public function testCategoryWithInjectionCharsIsSanitized(): void {
$input = "<article-guidance category=\"Act]]ors[[evil\">\n</article-guidance>";
$result = $this->runCleanup( $input );
$this->assertStringContainsString( '[[Category:Actorsevil]]', $result );
$this->assertStringNotContainsString( ']][[', $resul... |
17,673 | e5cb5577924ddb6a62ce0e15a12b0947 | swh:1:cnt:62005c0276cd9530bdc84623726282584adcd6fb;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=54-58/ | 271105928845b8b40cc3f5114da2fd525333e389 | ArticleGuidance | deployed | tests/phpunit/unit/PreloadCleanupHandlerTest.php | PreloadCleanupHandlerTest::testTextWithoutTagIsUnchanged() | function | public function testTextWithoutTagIsUnchanged(): void {
$input = "Just some plain article text ending with some whitepace. ";
$result = $this->runCleanup( $input );
$this->assertSame( $input, $result );
} |
17,674 | 0759e751c152b8a7b3b9010f092ebabe | swh:1:cnt:7358cf691f1f1a7d9426a5d2e418c4e034a4e8a8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=10-156/ | 2298e5dc22dd7c2515640f86b9450b72ad28112d | ArticleGuidance | deployed | tests/phpunit/unit/TagContentExtractorServiceTest.php | TagContentExtractorServiceTest | type | /**
* @covers \MediaWiki\Extension\ArticleGuidance\Services\TagContentExtractorService
*/
class TagContentExtractorServiceTest extends MediaWikiUnitTestCase {
public function testExtractorsBasicInputOutput() {
$input = <<<EOT
<article-guidance article-type="Q515" notability-risk="wikidata">
<instructions>
M... |
17,675 | 76a162aa930d85cc9fb9192146aef11b | swh:1:cnt:7358cf691f1f1a7d9426a5d2e418c4e034a4e8a8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=15-60/ | 2298e5dc22dd7c2515640f86b9450b72ad28112d | ArticleGuidance | deployed | tests/phpunit/unit/TagContentExtractorServiceTest.php | TagContentExtractorServiceTest::testExtractorsBasicInputOutput() | function | public function testExtractorsBasicInputOutput() {
$input = <<<EOT
<article-guidance article-type="Q515" notability-risk="wikidata">
<instructions>
Make sure you provide comprehensive coverage of the [[city]]'s geography,
history, and demographics using reliable sources. [[Documentation]]
</instructions>
... |
17,676 | d2c1efefdb47217a7ef91247f280fdf7 | swh:1:cnt:7358cf691f1f1a7d9426a5d2e418c4e034a4e8a8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=122-155/ | 2298e5dc22dd7c2515640f86b9450b72ad28112d | ArticleGuidance | deployed | tests/phpunit/unit/TagContentExtractorServiceTest.php | TagContentExtractorServiceTest::testExtractSourcesWithSourceTags() | function | public function testExtractSourcesWithSourceTags() {
$input = <<<EOT
<article-guidance article-type="Q515" notability-risk="wikidata">
<instructions>
Make sure you provide comprehensive coverage of the [[city]]'s geography,
history, and demographics using reliable sources. [[Documentation]]
</instructions>
... |
17,677 | fb032c0dc73b6549cf4edf99c6991a19 | swh:1:cnt:7358cf691f1f1a7d9426a5d2e418c4e034a4e8a8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=99-120/ | 2298e5dc22dd7c2515640f86b9450b72ad28112d | ArticleGuidance | deployed | tests/phpunit/unit/TagContentExtractorServiceTest.php | TagContentExtractorServiceTest::testExtractorsNoSources() | function | public function testExtractorsNoSources() {
$inputNoSources = <<<EOT
<article-guidance article-type="Q515" notability-risk="wikidata">
<instructions>
Make sure you provide comprehensive coverage of the [[city]]'s geography,
history, and demographics using reliable sources. [[Documentation]]
</instructions>
... |
17,678 | e36b31988d50d89473ed82d232b333e9 | swh:1:cnt:7358cf691f1f1a7d9426a5d2e418c4e034a4e8a8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=62-97/ | 2298e5dc22dd7c2515640f86b9450b72ad28112d | ArticleGuidance | deployed | tests/phpunit/unit/TagContentExtractorServiceTest.php | TagContentExtractorServiceTest::testExtractorsNoDiscouragedSources() | function | public function testExtractorsNoDiscouragedSources() {
$inputNoDiscouraged = <<<EOT
<article-guidance article-type="Q571" notability-risk="sources wikidata">
<instructions>
Ensure the book meets Wikipedia's [[WP:NBOOK|notability guidelines for books]].
Use reliable secondary sources for criticism and receptio... |
17,679 | 73b14658a585a8fc54ee6fdcbad81ab1 | swh:1:cnt:c56c4195f2ebed4bd1655e4778522d5e853f9106;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=10-62/ | 13e98e7c1a81ebe0f1bd46352034218b29d1ed82 | ArticleGuidance | deployed | tests/phpunit/unit/TitleExtractorTest.php | TitleExtractorTest | type | /**
* @covers \MediaWiki\Extension\ArticleGuidance\Services\TitleExtractor
*/
class TitleExtractorTest extends MediaWikiUnitTestCase {
public static function provideExtractPageTitle(): iterable {
yield 'pretty URL' => [
'https://en.wikipedia.org/wiki/Foo',
'Foo',
];
yield 'pretty URL with encoded spaces... |
17,680 | ae397ca4af706be6b4f98d5c2b7c429c | swh:1:cnt:c56c4195f2ebed4bd1655e4778522d5e853f9106;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=15-52/ | 13e98e7c1a81ebe0f1bd46352034218b29d1ed82 | ArticleGuidance | deployed | tests/phpunit/unit/TitleExtractorTest.php | TitleExtractorTest::provideExtractPageTitle() | function | public static function provideExtractPageTitle(): iterable {
yield 'pretty URL' => [
'https://en.wikipedia.org/wiki/Foo',
'Foo',
];
yield 'pretty URL with encoded spaces' => [
'https://en.wikipedia.org/wiki/Foo%20Bar',
'Foo Bar',
];
yield 'pretty URL with underscores' => [
'https://en.wikipedia... |
17,681 | 5e5603fce1796d915ba14c29c9a5029c | swh:1:cnt:c56c4195f2ebed4bd1655e4778522d5e853f9106;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=54-60/ | 13e98e7c1a81ebe0f1bd46352034218b29d1ed82 | ArticleGuidance | deployed | tests/phpunit/unit/TitleExtractorTest.php | TitleExtractorTest::testExtractPageTitle( string $url, ?string $expected ) | function | /**
* @dataProvider provideExtractPageTitle
*/
public function testExtractPageTitle( string $url, ?string $expected ): void {
$extractor = new TitleExtractor();
$this->assertSame( $expected, $extractor->extractPageTitle( $url ) );
} |
17,682 | 18edc5ec99ddd0cf2f5d950826ea437b | swh:1:cnt:ede35174dbb7559e6ea9df6cd35eb9a72034c756;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=10-58/ | f9723f8cb042c7bbb0db2e6be015e5279875b94e | ArticleGuidance | deployed | tests/phpunit/unit/UrlAsciiEncoderTest.php | UrlAsciiEncoderTest | type | /**
* @covers \MediaWiki\Extension\ArticleGuidance\Services\UrlAsciiEncoder
*/
class UrlAsciiEncoderTest extends MediaWikiUnitTestCase {
/**
* @dataProvider provideNormalizeUrl
*/
public function testNormalizeUrl( string $input, string $expected ) {
$this->assertSame( $expected, ( new UrlAsciiEncoder() )->en... |
17,683 | ea01a94ccd8dac77549bf438e56c1ce2 | swh:1:cnt:ede35174dbb7559e6ea9df6cd35eb9a72034c756;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=15-20/ | f9723f8cb042c7bbb0db2e6be015e5279875b94e | ArticleGuidance | deployed | tests/phpunit/unit/UrlAsciiEncoderTest.php | UrlAsciiEncoderTest::testNormalizeUrl( string $input, string $expected ) | function | /**
* @dataProvider provideNormalizeUrl
*/
public function testNormalizeUrl( string $input, string $expected ) {
$this->assertSame( $expected, ( new UrlAsciiEncoder() )->encode( $input ) );
} |
17,684 | 62d49a96fac44458df93ae1e7240fd22 | swh:1:cnt:ede35174dbb7559e6ea9df6cd35eb9a72034c756;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=22-57/ | f9723f8cb042c7bbb0db2e6be015e5279875b94e | ArticleGuidance | deployed | tests/phpunit/unit/UrlAsciiEncoderTest.php | UrlAsciiEncoderTest::provideNormalizeUrl() | function | public static function provideNormalizeUrl(): array {
return [
'plain ASCII URL is unchanged' => [
'https://example.com/article',
'https://example.com/article',
],
'Latin IDN hostname is converted to punycode' => [
'https://bücher.example/page',
'https://xn--bcher-kva.example/page',
],
... |
17,685 | 2e3fe5d62f3517538174795bb3cc65a2 | swh:1:cnt:082b437f32e3b737688c700c405e4bddfa072df0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=22-159/ | ffa1b6dcc4364ee94b93afea0d98e642a630e72b | AutoModerator | deployed | maintenance/CheckRevision.php | CheckRevision | type | // @codeCoverageIgnoreEnd
/**
* Check a revision to see if it would be reverted
*/
class CheckRevision extends Maintenance {
public function __construct() {
parent::__construct();
$this->requireExtension( 'AutoModerator' );
$this->addDescription(
'Check a revision and report if it would be reverted based ... |
17,686 | 7e26d6d0ea7088473b66f7ee2ca5ccdf | swh:1:cnt:082b437f32e3b737688c700c405e4bddfa072df0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=29-37/ | ffa1b6dcc4364ee94b93afea0d98e642a630e72b | AutoModerator | deployed | maintenance/CheckRevision.php | CheckRevision::__construct() | function | public function __construct() {
parent::__construct();
$this->requireExtension( 'AutoModerator' );
$this->addDescription(
'Check a revision and report if it would be reverted based on scoring from a machine learning model.'
);
$this->addOption( 'revid', 'Revision ID', true, true );
$this->addOption( 'cli... |
17,687 | b9bddc5141f7ae65906feddf56af07b9 | swh:1:cnt:082b437f32e3b737688c700c405e4bddfa072df0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=39-158/ | ffa1b6dcc4364ee94b93afea0d98e642a630e72b | AutoModerator | deployed | maintenance/CheckRevision.php | CheckRevision::execute() | function | public function execute() {
if ( !ctype_digit( $this->getOption( 'revid' ) ) ) {
$this->output( "'revid' must be an integer\n" );
return;
}
$revId = (int)$this->getOption( 'revid' );
if ( $revId === 0 ) {
$this->output( "'revid' must be greater than zero\n" );
return;
}
// setup dependencies th... |
17,688 | 1580cd16eb734f86c05a7037f89e30d3 | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=30-196/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient | type | class ApiClient {
/**
* Make a single call to MediaWiki API discussiontoolsfindcomment and return the decoded result.
*
* @param string $commentHeader
* @param Title $userTalkPageTitle
*
* @return array Decoded response
*/
public function findComment( string $commentHeader, Title $userTalkPageTitle ) {... |
17,689 | 1c517e2e817ee1b8ddcecb3bf6ccab8a | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=32-66/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::findComment( string $commentHeader, Title $userTalkPageTitle ) | function | /**
* Make a single call to MediaWiki API discussiontoolsfindcomment and return the decoded result.
*
* @param string $commentHeader
* @param Title $userTalkPageTitle
*
* @return array Decoded response
*/
public function findComment( string $commentHeader, Title $userTalkPageTitle ) {
try {
$context... |
17,690 | 2f89483873472afe731ef5b9f4d7252a | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=156-176/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::executeApiQuery( DerivativeContext $context, array $queryParams ) | function | /**
* @param DerivativeContext $context
* @param array $queryParams
*
* @return array $data
*/
private function executeApiQuery( DerivativeContext $context, array $queryParams ) {
$context->setRequest(
new DerivativeRequest(
$context->getRequest(),
$queryParams
)
);
$api = new ApiMain(
... |
17,691 | a55cc953f3c0de14806b4b24888c45f6 | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=68-86/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::getUserTalkPageInfo( Title $userTalkPageTitle ) | function | /**
* @param Title $userTalkPageTitle
*
* @return array Decoded response
*/
public function getUserTalkPageInfo( Title $userTalkPageTitle ) {
$context = new DerivativeContext( RequestContext::getMain() );
$queryParams = [
"action" => "discussiontoolspageinfo",
"format" => "json",
"page" => $userTa... |
17,692 | f5fd699b76d67a0b31d8e9aa16ec5f45 | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=121-154/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::addTopic( string $commentHeader, Title $userTalkPageTitle, string $talkPageMessage,
string $editSummary, User $autoModeratorUser ) | function | /**
* Make a single call to MediaWiki API discussiontoolsfindcomment and return the decoded result.
*
* @param string $commentHeader
* @param Title $userTalkPageTitle
* @param string $talkPageMessage
* @param string $editSummary
* @param User $autoModeratorUser
*
* @return array Decoded response
*/
... |
17,693 | b988a5cdaf9e8007cb1183c6e64d943d | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=88-119/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::addFollowUpComment( string $commentId, Title $userTalkPageTitle, string $followUpComment,
User $autoModeratorUser ) | function | /**
* Make a single call to MediaWiki API discussiontoolsfindcomment and return the decoded result.
*
* @param string $commentId
* @param Title $userTalkPageTitle
* @param string $followUpComment
* @param User $autoModeratorUser
*
* @return array Decoded response
*/
public function addFollowUpComment... |
17,694 | 2ddcd36dbe518025d56a8709e272bd82 | swh:1:cnt:d9af11eb93c94f2c79c47a9fc4b488254290568d;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=178-195/ | f4fd9c6ba28748d9f90910e45c731117e6e2a55f | AutoModerator | deployed | src/ApiClient.php | ApiClient::checkCommentRedirects( array $comments, string $userTalkPageString ) | function | /**
* Parses the discussiontoolsfindcomment API response array to check if there are any comments
* where we can append a follow-up message. If one exists, it returns true and the id
* @param array $comments
* @param string $userTalkPageString
* @return array
*/
private function checkCommentRedirects( arra... |
17,695 | 2bc2f44ccd207f52281f5a53dbc99844 | swh:1:cnt:0f517cb8ebb1adf7b56954659710299bc6c1a5cc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=7-22/ | 3bcfd02dfacb9cd21405b53583bc45132b073b7e | AutoModerator | deployed | src/AutoModeratorLogFormatter.php | AutoModeratorLogFormatter | type | class AutoModeratorLogFormatter extends LogFormatter {
/** @inheritDoc */
protected function getActionMessage() {
$params = parent::extractParameters();
$revId = $params[3] ?? "";
$user = $params[4] ?? "";
$score = $params[5] ?? "";
$actionMessage = parent::getActionMessage();
return $actionMessage->text(... |
17,696 | f4a68b65c7308190b2da421701102b8d | swh:1:cnt:0f517cb8ebb1adf7b56954659710299bc6c1a5cc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=8-21/ | 3bcfd02dfacb9cd21405b53583bc45132b073b7e | AutoModerator | deployed | src/AutoModeratorLogFormatter.php | AutoModeratorLogFormatter::getActionMessage() | function | /** @inheritDoc */
protected function getActionMessage() {
$params = parent::extractParameters();
$revId = $params[3] ?? "";
$user = $params[4] ?? "";
$score = $params[5] ?? "";
$actionMessage = parent::getActionMessage();
return $actionMessage->text() . ' '
. wfMessage( 'logentry-automoderator-revert_d... |
17,697 | df9b1b89a68ff6378aea66e1d4f1403c | swh:1:cnt:04765ef415a785f93d293bc15b3c024bbf780961;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=10-79/ | 0278ce668841f70e5993c032012cae797a965e9f | AutoModerator | deployed | src/AutoModeratorRevisionStore.php | AutoModeratorRevisionStore | type | class AutoModeratorRevisionStore {
/** @var IReadableDatabase */
private IReadableDatabase $dbr;
/** @var UserIdentity */
private UserIdentity $user;
/** @var UserIdentity */
private UserIdentity $autoModeratorUser;
/** @var int */
private int $wikiPageId;
/** @var RevisionStore */
private RevisionStore ... |
17,698 | a585921cf1beb27bb28ca5a8722bf14c | swh:1:cnt:04765ef415a785f93d293bc15b3c024bbf780961;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=30-46/ | 0278ce668841f70e5993c032012cae797a965e9f | AutoModerator | deployed | src/AutoModeratorRevisionStore.php | AutoModeratorRevisionStore::__construct( IReadableDatabase $dbr, UserIdentity $user,
UserIdentity $autoModeratorUser, int $wikiPageId, RevisionStore $revisionStore, int $maxReverts ) | function | /**
* @param IReadableDatabase $dbr
* @param UserIdentity $user
* @param UserIdentity $autoModeratorUser
* @param int $wikiPageId
* @param RevisionStore $revisionStore
* @param int $maxReverts
*/
public function __construct( IReadableDatabase $dbr, UserIdentity $user,
UserIdentity $autoModeratorUser, i... |
17,699 | 845759b13a0ab1c28240aafe26f0ddec | swh:1:cnt:04765ef415a785f93d293bc15b3c024bbf780961;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoModerator.git;lines=62-78/ | 0278ce668841f70e5993c032012cae797a965e9f | AutoModerator | deployed | src/AutoModeratorRevisionStore.php | AutoModeratorRevisionStore::hasReachedMaxRevertsForUser() | function | /**
* @return bool
*/
public function hasReachedMaxRevertsForUser(): bool {
$autoModeratorReverts = $this->getAutoModeratorReverts();
if ( $autoModeratorReverts->count() < $this->maxReverts ) {
return false;
}
$numberOfReverts = 0;
foreach ( $autoModeratorReverts as $revision ) {
$parentRevision = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.