| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Deferred\LinksUpdate; |
| 4 |
|
| 5 |
use MediaWiki\Config\Config; |
| 6 |
use MediaWiki\Config\ServiceOptions; |
| 7 |
use MediaWiki\MainConfigNames; |
| 8 |
use MediaWiki\Parser\ParserOutput; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class PageLinksTable extends GenericPageLinksTable { |
| 14 |
private const CONSTRUCTOR_OPTIONS = [ |
| 15 |
MainConfigNames::PageLinksSchemaMigrationStage, |
| 16 |
]; |
| 17 |
|
| 18 |
|
| 19 |
private $migrationStage; |
| 20 |
|
| 21 |
public function __construct( Config $config ) { |
| 22 |
$options = new ServiceOptions( self::CONSTRUCTOR_OPTIONS, $config ); |
| 23 |
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); |
| 24 |
|
| 25 |
$this->migrationStage = $options->get( MainConfigNames::PageLinksSchemaMigrationStage ); |
| 26 |
} |
| 27 |
|
| 28 |
public function setParserOutput( ParserOutput $parserOutput ) { |
| 29 |
$this->newLinks = $parserOutput->getLinks(); |
| 30 |
} |
| 31 |
|
| 32 |
protected function getTableName() { |
| 33 |
return 'pagelinks'; |
| 34 |
} |
| 35 |
|
| 36 |
protected function getFromField() { |
| 37 |
return 'pl_from'; |
| 38 |
} |
| 39 |
|
| 40 |
protected function getNamespaceField() { |
| 41 |
return 'pl_namespace'; |
| 42 |
} |
| 43 |
|
| 44 |
protected function getTitleField() { |
| 45 |
return 'pl_title'; |
| 46 |
} |
| 47 |
|
| 48 |
protected function getFromNamespaceField() { |
| 49 |
return 'pl_from_namespace'; |
| 50 |
} |
| 51 |
|
| 52 |
protected function getTargetIdField() { |
| 53 |
return 'pl_target_id'; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
protected function linksTargetNormalizationStage(): int { |
| 61 |
return $this->migrationStage; |
| 62 |
} |
| 63 |
} |