Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
PageMoveOperation.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use MediaWiki\Title\Title;
7
15 private Title $old;
16 private ?Title $new;
17 private ?Title $oldTalkpage = null;
18 private ?Title $newTalkpage = null;
19 private ?InvalidPageTitleRename $invalidPageTitleRename;
20 private bool $leaveRedirect = true;
21
22 public function __construct( Title $old, ?Title $new, ?InvalidPageTitleRename $e = null ) {
23 $this->old = $old;
24 $this->new = $new;
25 $this->invalidPageTitleRename = $e;
26 }
27
28 public function getOldTitle(): Title {
29 return $this->old;
30 }
31
32 public function getNewTitle(): ?Title {
33 return $this->new;
34 }
35
36 public function getOldTalkpage(): ?Title {
37 return $this->oldTalkpage;
38 }
39
40 public function getNewTalkpage(): ?Title {
41 return $this->newTalkpage;
42 }
43
44 public function shouldLeaveRedirect(): bool {
45 return $this->leaveRedirect;
46 }
47
48 public function setLeaveRedirect( bool $leaveRedirect ): void {
49 $this->leaveRedirect = $leaveRedirect;
50 }
51
52 public function hasTalkpage(): bool {
53 return $this->oldTalkpage !== null;
54 }
55
56 public function getRenameErrorCode(): int {
57 return $this->invalidPageTitleRename ?
58 $this->invalidPageTitleRename->getCode() : PageTitleRenamer::NO_ERROR;
59 }
60
61 public function setTalkpage( Title $oldTalkpage, ?Title $newTalkpage ): void {
62 $this->oldTalkpage = $oldTalkpage;
63 $this->newTalkpage = $newTalkpage;
64 }
65}
Represents a single page being moved including the talk page.