220 if ( is_object(
$title ) ) {
222 } elseif (
$title ===
null ) {
223 throw new MWException(
"WikiRevision given a null title in import. "
224 .
"You may need to adjust \$wgLegalTitleChars." );
226 throw new MWException(
"WikiRevision given non-object title in import." );
243 # 2003-08-05T18:30:02Z
252 $this->user_text = $user;
260 $this->userObj = $user;
268 $this->user_text = $ip;
295 $handler = ContentHandler::getForModelID( $this->model );
306 $this->slots->setContent( $role,
$content );
309 if ( $role === SlotRecord::MAIN ) {
322 $this->comment =
$text;
330 $this->minor = (bool)
$minor;
347 $this->fileSrc =
$src;
389 $this->size = intval(
$size );
421 $this->mNoUpdates = $noupdates;
479 if ( $this->contentHandler ===
null ) {
480 $this->contentHandler = MediaWikiServices::getInstance()
481 ->getContentHandlerFactory()
482 ->getContentHandler( $this->
getModel() );
494 return $this->slots->getContent( $role );
503 return $this->slots->getSlot( $role );
511 return $this->slots->getSlotRoles();
520 if ( $this->model ===
null ) {
521 $this->model = $this->
getTitle()->getContentModel();
533 if ( $this->format ===
null ) {
569 if ( $this->sha1base36 ) {
570 return Wikimedia\base_convert( $this->sha1base36, 36, 16 );
580 if ( $this->sha1base36 ) {
664 if ( $this->mNoUpdates ) {
665 $importer = MediaWikiServices::getInstance()->getWikiRevisionOldRevisionImporterNoUpdates();
667 $importer = MediaWikiServices::getInstance()->getWikiRevisionOldRevisionImporter();
669 return $importer->import( $this );
681 # @todo FIXME: This will not record autoblocks
683 wfDebug( __METHOD__ .
": skipping invalid {$this->type}/{$this->action} log time, timestamp " .
687 # Check if it exists already
689 $prior = $dbw->selectField(
'logging',
'1',
690 [
'log_type' => $this->
getType(),
692 'log_timestamp' => $dbw->timestamp( $this->timestamp ),
693 'log_namespace' => $this->getTitle()->getNamespace(),
694 'log_title' => $this->getTitle()->getDBkey(),
695 'log_params' => $this->params ],
701 .
": skipping existing item for Log:{$this->type}/{$this->action}, timestamp "
702 . $this->timestamp );
708 'log_timestamp' => $dbw->timestamp( $this->timestamp ),
709 'log_namespace' => $this->
getTitle()->getNamespace(),
710 'log_title' => $this->
getTitle()->getDBkey(),
712 ] + CommentStore::getStore()->insert( $dbw,
'log_comment', $this->
getComment() )
713 + ActorMigration::newMigration()->getInsertValues( $dbw,
'log_user', $user );
714 $dbw->insert(
'logging', $data, __METHOD__ );
725 $importer = MediaWikiServices::getInstance()->getWikiRevisionUploadImporter();
726 $statusValue = $importer->import( $this );
727 return $statusValue->isGood();
737 $this->config->get(
'EnableUploads' ),
738 LoggerFactory::getInstance(
'UploadRevisionImporter' )
740 return $importer->downloadSource( $this );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
A content handler knows how do deal with a specific type of content on a wiki page.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Represents a revision, log entry or upload during the import process.
setContent( $role, $content)
__construct(Config $config)
getContent( $role=SlotRecord::MAIN)
setArchiveName( $archiveName)
MutableRevisionSlots $slots
setSha1Base36( $sha1base36)
ContentHandler $contentHandler
setFileSrc( $src, $isTemp)
setNoUpdates( $noupdates)
Interface for configuration instances.
Base interface for content objects.
getModel()
Returns the ID of the content model used by this Content object.
serialize( $format=null)
Convenience method for serializing this Content object.
getDefaultFormat()
Convenience method that returns the default serialization format for the content model that this Cont...