MediaWiki  master
PageCommandFactory.php
Go to the documentation of this file.
1 <?php
2 
23 namespace MediaWiki\Page;
24 
34 use MergeHistory;
35 use MovePage;
36 use NamespaceInfo;
37 use RepoGroup;
38 use Title;
41 use WikiPage;
42 
50  private $options;
51 
53  private $loadBalancer;
54 
56  private $namespaceInfo;
57 
60 
63 
65  private $repoGroup;
66 
69 
71  private $revisionStore;
72 
74  private $spamChecker;
75 
77  private $hookContainer;
78 
81 
83  private $userFactory;
84 
88  public const CONSTRUCTOR_OPTIONS = [
89  'CategoryCollation'
90  ];
91 
92  public function __construct(
93  ServiceOptions $options,
94  ILoadBalancer $loadBalancer,
97  PermissionManager $permissionManager,
99  IContentHandlerFactory $contentHandlerFactory,
100  RevisionStore $revisionStore,
101  SpamChecker $spamChecker,
102  HookContainer $hookContainer,
104  UserFactory $userFactory
105  ) {
106  $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
107 
108  $this->options = $options;
109  $this->loadBalancer = $loadBalancer;
110  $this->namespaceInfo = $namespaceInfo;
111  $this->watchedItemStore = $watchedItemStore;
112  $this->permissionManager = $permissionManager;
113  $this->repoGroup = $repoGroup;
114  $this->contentHandlerFactory = $contentHandlerFactory;
115  $this->revisionStore = $revisionStore;
116  $this->spamChecker = $spamChecker;
117  $this->hookContainer = $hookContainer;
118  $this->wikiPageFactory = $wikiPageFactory;
119  $this->userFactory = $userFactory;
120  }
121 
128  public function newContentModelChange(
129  Authority $performer,
130  WikiPage $wikipage,
131  string $newContentModel
132  ) : ContentModelChange {
133  return new ContentModelChange(
134  $this->contentHandlerFactory,
135  $this->hookContainer,
136  $this->revisionStore,
137  $this->userFactory,
138  $performer,
139  $wikipage,
140  $newContentModel
141  );
142  }
143 
150  public function newMergeHistory(
151  Title $source,
152  Title $destination,
153  string $timestamp = null
154  ) : MergeHistory {
155  if ( $timestamp === null ) {
156  // For compatibility with MergeHistory constructor until it can be changed
157  $timestamp = false;
158  }
159  return new MergeHistory(
160  $source,
161  $destination,
162  $timestamp,
163  $this->loadBalancer,
164  $this->permissionManager,
165  $this->contentHandlerFactory,
166  $this->revisionStore,
167  $this->watchedItemStore,
168  $this->spamChecker,
169  $this->hookContainer,
170  $this->wikiPageFactory
171  );
172  }
173 
179  public function newMovePage( Title $from, Title $to ) : MovePage {
180  return new MovePage(
181  $from,
182  $to,
183  $this->options,
184  $this->loadBalancer,
185  $this->namespaceInfo,
186  $this->watchedItemStore,
187  $this->repoGroup,
188  $this->contentHandlerFactory,
189  $this->revisionStore,
190  $this->spamChecker,
191  $this->hookContainer,
192  $this->wikiPageFactory,
193  $this->userFactory
194  );
195  }
196 }
Page\PageCommandFactory\$hookContainer
HookContainer $hookContainer
Definition: PageCommandFactory.php:77
Page\PageCommandFactory\$options
ServiceOptions $options
Definition: PageCommandFactory.php:50
Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:89
Page\PageCommandFactory\$namespaceInfo
NamespaceInfo $namespaceInfo
Definition: PageCommandFactory.php:56
WikiPage
Class representing a MediaWiki article and history.
Definition: WikiPage.php:61
Page\PageCommandFactory\$spamChecker
SpamChecker $spamChecker
Definition: PageCommandFactory.php:74
Page\PageCommandFactory\newContentModelChange
newContentModelChange(Authority $performer, WikiPage $wikipage, string $newContentModel)
Definition: PageCommandFactory.php:128
Page\PageCommandFactory\$loadBalancer
ILoadBalancer $loadBalancer
Definition: PageCommandFactory.php:53
Page\PageCommandFactory\$userFactory
UserFactory $userFactory
Definition: PageCommandFactory.php:83
Page\PageCommandFactory\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: PageCommandFactory.php:88
Page\MergeHistoryFactory
Definition: MergeHistoryFactory.php:31
Page\PageCommandFactory\$watchedItemStore
WatchedItemStoreInterface $watchedItemStore
Definition: PageCommandFactory.php:59
Page\PageCommandFactory\newMovePage
newMovePage(Title $from, Title $to)
Definition: PageCommandFactory.php:179
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:27
MovePage
Handles the backend logic of moving a page from one title to another.
Definition: MovePage.php:47
Page\WikiPageFactory
Definition: WikiPageFactory.php:20
Page\PageCommandFactory\$wikiPageFactory
WikiPageFactory $wikiPageFactory
Definition: PageCommandFactory.php:80
MediaWiki\Permissions\Authority
Definition: Authority.php:30
Page\PageCommandFactory\$revisionStore
RevisionStore $revisionStore
Definition: PageCommandFactory.php:71
Page\PageCommandFactory\__construct
__construct(ServiceOptions $options, ILoadBalancer $loadBalancer, NamespaceInfo $namespaceInfo, WatchedItemStoreInterface $watchedItemStore, PermissionManager $permissionManager, RepoGroup $repoGroup, IContentHandlerFactory $contentHandlerFactory, RevisionStore $revisionStore, SpamChecker $spamChecker, HookContainer $hookContainer, WikiPageFactory $wikiPageFactory, UserFactory $userFactory)
Definition: PageCommandFactory.php:92
MediaWiki\Permissions\PermissionManager
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Definition: PermissionManager.php:51
Page\PageCommandFactory\$permissionManager
PermissionManager $permissionManager
Definition: PageCommandFactory.php:62
MediaWiki\Content\IContentHandlerFactory
Definition: IContentHandlerFactory.php:10
MediaWiki\EditPage\SpamChecker
Service to check if text (either content or a summary) qualifies as spam.
Definition: SpamChecker.php:14
Page\PageCommandFactory\$contentHandlerFactory
IContentHandlerFactory $contentHandlerFactory
Definition: PageCommandFactory.php:68
MergeHistory
Handles the backend logic of merging the histories of two pages.
Definition: MergeHistory.php:44
Page\MovePageFactory
Definition: MovePageFactory.php:30
Page\PageCommandFactory
Common factory to construct page handling classes.
Definition: PageCommandFactory.php:48
Title
Represents a title within MediaWiki.
Definition: Title.php:46
Page\ContentModelChangeFactory
Definition: ContentModelChangeFactory.php:32
RepoGroup
Prioritized list of file repositories.
Definition: RepoGroup.php:31
MediaWiki\Page
Definition: ContentModelChangeFactory.php:23
$source
$source
Definition: mwdoc-filter.php:34
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
Page\PageCommandFactory\newMergeHistory
newMergeHistory(Title $source, Title $destination, string $timestamp=null)
Definition: PageCommandFactory.php:150
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition: NamespaceInfo.php:35
WatchedItemStoreInterface
Definition: WatchedItemStoreInterface.php:30
MediaWiki\User\UserFactory
Creates User objects.
Definition: UserFactory.php:41
Page\PageCommandFactory\$repoGroup
RepoGroup $repoGroup
Definition: PageCommandFactory.php:65
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81
ContentModelChange
Helper class to change the content model of pages.
Definition: ContentModelChange.php:22