1 | <?php |
||
27 | class UpdateRepoOnMoveJob extends UpdateRepoJob { |
||
28 | |||
29 | /** |
||
30 | * @var SiteLookup |
||
31 | */ |
||
32 | private $siteLookup; |
||
33 | |||
34 | /** |
||
35 | * @var string|bool|null |
||
36 | */ |
||
37 | private $normalizedPageName = null; |
||
38 | |||
39 | /** |
||
40 | * Constructs a UpdateRepoOnMoveJob propagating a page move to the repo |
||
41 | * |
||
42 | * @note This is for use by Job::factory, don't call it directly; |
||
43 | * use newFrom*() instead. |
||
44 | * |
||
45 | * @note the constructor's signature is dictated by Job::factory, so we'll have to |
||
46 | * live with it even though it's rather ugly for our use case. |
||
47 | * |
||
48 | * @see Job::factory |
||
49 | * @see UpdateRepoJob::__construct |
||
50 | * |
||
51 | * @param Title $title |
||
52 | * @param array $params |
||
53 | */ |
||
54 | public function __construct( Title $title, array $params = [] ) { |
||
55 | parent::__construct( 'UpdateRepoOnMove', $title, $params ); |
||
56 | |||
57 | $this->initRepoJobServicesFromGlobalState(); |
||
58 | } |
||
59 | |||
60 | protected function initRepoJobServicesFromGlobalState() { |
||
61 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
||
62 | $this->initServices( |
||
63 | $wikibaseRepo->getEntityLookup( Store::LOOKUP_CACHING_DISABLED, LookupConstants::LATEST_FROM_MASTER ), |
||
64 | $wikibaseRepo->getEntityStore(), |
||
65 | $wikibaseRepo->getSummaryFormatter(), |
||
66 | LoggerFactory::getInstance( 'UpdateRepo' ), |
||
67 | $wikibaseRepo->getSiteLookup(), |
||
68 | $wikibaseRepo->newEditEntityFactory() |
||
69 | ); |
||
70 | } |
||
71 | |||
72 | public function initServices( |
||
89 | |||
90 | /** |
||
91 | * Get a SiteLink for a specific item and site |
||
92 | * |
||
93 | * @param Item $item |
||
94 | * @param string $globalId |
||
95 | * |
||
96 | * @return SiteLink|null |
||
97 | */ |
||
98 | private function getSiteLink( Item $item, $globalId ) { |
||
105 | |||
106 | /** |
||
107 | * Get a Summary object for the edit |
||
108 | * |
||
109 | * @return Summary |
||
110 | */ |
||
111 | public function getSummary() { |
||
127 | |||
128 | /** |
||
129 | * @return string|bool False in case the normalization failed |
||
130 | */ |
||
131 | private function getNormalizedPageName() { |
||
154 | |||
155 | /** |
||
156 | * Whether the propagated update is valid (and thus should be applied) |
||
157 | * |
||
158 | * @param Item $item |
||
159 | * |
||
160 | * @return bool |
||
161 | */ |
||
162 | protected function verifyValid( Item $item ) { |
||
187 | |||
188 | /** |
||
189 | * @inheritDoc |
||
190 | */ |
||
191 | protected function applyChanges( Item $item ) { |
||
207 | |||
208 | } |
||
209 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.