4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
19 * Attribution notice: when this file was created, much of its content was taken
20 * from the Revision.php file as present in release 1.30. Refer to the history
21 * of that file for original authorship.
26 namespace MediaWiki\Storage
;
30 use Psr\Log\LoggerInterface
;
32 use Wikimedia\Assert\Assert
;
33 use Wikimedia\Rdbms\LoadBalancer
;
38 class RevisionStoreFactory
{
40 /** @var SqlBlobStore */
43 /** @var LoadBalancer */
44 private $loadBalancer;
46 /** @var WANObjectCache */
49 /** @var CommentStore */
50 private $commentStore;
52 /** @var ActorMigration */
53 private $actorMigration;
55 /** @var NameTableStore */
56 private $contentModelStore;
58 /** @var NameTableStore */
59 private $slotRoleStore;
61 /** @var int One of the MIGRATION_* constants */
62 private $mcrMigrationStage;
66 * @see $wgContentHandlerUseDB
68 private $contentHandlerUseDB;
70 /** @var LoggerInterface */
74 * @todo $blobStore should be allowed to be any BlobStore!
76 * @param LoadBalancer $loadBalancer
77 * @param SqlBlobStore $blobStore
78 * @param WANObjectCache $cache
79 * @param CommentStore $commentStore
80 * @param NameTableStore $contentModelStore
81 * @param NameTableStore $slotRoleStore
82 * @param int $migrationStage
83 * @param ActorMigration $actorMigration
84 * @param LoggerInterface $logger
85 * @param bool $contentHandlerUseDB see {@link $wgContentHandlerUseDB}
87 public function __construct(
88 LoadBalancer
$loadBalancer,
89 SqlBlobStore
$blobStore,
90 WANObjectCache
$cache,
91 CommentStore
$commentStore,
92 NameTableStore
$contentModelStore,
93 NameTableStore
$slotRoleStore,
95 ActorMigration
$actorMigration,
96 LoggerInterface
$logger,
99 Assert
::parameterType( 'integer', $migrationStage, '$migrationStage' );
101 $this->loadBalancer
= $loadBalancer;
102 $this->blobStore
= $blobStore;
103 $this->cache
= $cache;
104 $this->commentStore
= $commentStore;
105 $this->contentModelStore
= $contentModelStore;
106 $this->slotRoleStore
= $slotRoleStore;
107 $this->mcrMigrationStage
= $migrationStage;
108 $this->actorMigration
= $actorMigration;
109 $this->logger
= $logger;
110 $this->contentHandlerUseDB
= $contentHandlerUseDB;
116 * @param bool|string $wikiId false for the current domain / wikid
118 * @return RevisionStore for the given wikiId with all necessary services and a logger
120 public function getRevisionStore( $wikiId = false ) {
121 Assert
::parameterType( 'string|boolean', $wikiId, '$wikiId' );
123 $store = new RevisionStore(
128 $this->contentModelStore
,
129 $this->slotRoleStore
,
130 $this->mcrMigrationStage
,
131 $this->actorMigration
,
135 $store->setLogger( $this->logger
);
136 $store->setContentHandlerUseDB( $this->contentHandlerUseDB
);