128 if ( is_object(
$title ) ) {
130 } elseif ( is_null(
$title ) ) {
131 throw new MWException(
"WikiRevision given a null title in import. "
132 .
"You may need to adjust \$wgLegalTitleChars." );
134 throw new MWException(
"WikiRevision given non-object title in import." );
149 # 2003-08-05T18:30:02Z
157 $this->user_text =
$user;
164 $this->userObj =
$user;
171 $this->user_text = $ip;
199 $this->comment =
$text;
206 $this->minor = (bool)
$minor;
221 $this->fileSrc =
$src;
250 $this->size = intval(
$size );
278 $this->mNoUpdates = $noupdates;
322 ContentHandler::deprecated( __METHOD__,
'1.21' );
331 if ( is_null( $this->contentHandler ) ) {
332 $this->contentHandler = ContentHandler::getForModelID( $this->
getModel() );
342 if ( is_null( $this->
content ) ) {
354 if ( is_null( $this->model ) ) {
355 $this->model = $this->
getTitle()->getContentModel();
365 if ( is_null( $this->
format ) ) {
397 if ( $this->sha1base36 ) {
398 return Wikimedia\base_convert( $this->sha1base36, 36, 16 );
465 # Sneak a single revision into place
468 $userId = intval(
$user->getId() );
469 $userText =
$user->getName();
480 $page->loadPageData(
'fromdbmaster' );
481 if ( !
$page->exists() ) {
483 $pageId =
$page->insertOn( $dbw );
485 $oldcountable = null;
487 $pageId =
$page->getId();
490 $prior = $dbw->selectField(
'revision',
'1',
491 [
'rev_page' => $pageId,
492 'rev_timestamp' => $dbw->timestamp( $this->timestamp ),
493 'rev_user_text' => $userText,
499 wfDebug( __METHOD__ .
": skipping existing revision for [[" .
500 $this->
title->getPrefixedText() .
"]], timestamp " . $this->timestamp .
"\n" );
508 wfDebug( __METHOD__ .
': got invalid $pageId when importing revision of [[' .
509 $this->
title->getPrefixedText() .
']], timestamp ' . $this->timestamp .
"\n" );
516 $prevId = $dbw->selectField(
'revision',
'rev_id',
518 'rev_page' => $pageId,
519 'rev_timestamp <= ' . $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) ),
523 'rev_timestamp DESC',
529 # @todo FIXME: Use original rev_id optionally (better for backups)
532 'title' => $this->
title,
534 'content_model' => $this->
getModel(),
540 'user_text' => $userText,
541 'timestamp' => $this->timestamp,
542 'minor_edit' => $this->minor,
543 'parent_id' => $prevId,
545 $revision->insertOn( $dbw );
546 $changed =
$page->updateIfNewerOn( $dbw, $revision );
548 if ( $changed !==
false && !$this->mNoUpdates ) {
549 wfDebug( __METHOD__ .
": running updates\n" );
551 $page->doEditUpdates(
554 [
'created' => $created,
'oldcountable' =>
'no-change' ]
566 $userId = intval(
$user->getId() );
567 $userText =
$user->getName();
573 # @todo FIXME: This will not record autoblocks
575 wfDebug( __METHOD__ .
": skipping invalid {$this->type}/{$this->action} log time, timestamp " .
576 $this->timestamp .
"\n" );
579 # Check if it exists already
581 $prior = $dbw->selectField(
'logging',
'1',
582 [
'log_type' => $this->
getType(),
584 'log_timestamp' => $dbw->timestamp( $this->timestamp ),
585 'log_namespace' => $this->
getTitle()->getNamespace(),
586 'log_title' => $this->
getTitle()->getDBkey(),
588 # 'log_user_text' => $this->user_text,
595 .
": skipping existing item for Log:{$this->type}/{$this->action}, timestamp "
596 . $this->timestamp .
"\n" );
599 $log_id = $dbw->nextSequenceValue(
'logging_log_id_seq' );
604 'log_timestamp' => $dbw->timestamp( $this->timestamp ),
605 'log_user' => $userId,
606 'log_user_text' => $userText,
607 'log_namespace' => $this->
getTitle()->getNamespace(),
608 'log_title' => $this->
getTitle()->getDBkey(),
612 $dbw->insert(
'logging', $data, __METHOD__ );
624 wfDebug( __METHOD__ .
"Importing archived file as $archiveName\n" );
630 wfDebug( __METHOD__ .
'Importing new file as ' . $file->getName() .
"\n" );
631 if ( $file->exists() && $file->getTimestamp() > $this->
getTimestamp() ) {
632 $archiveName = $file->getTimestamp() .
'!' . $file->getName();
635 wfDebug( __METHOD__ .
"File already exists; importing as $archiveName\n" );
643 # Get the file source or download if necessary
648 $autoDeleteSource =
true;
651 wfDebug( __METHOD__ .
": Could not fetch remote file.\n" );
656 if ( $autoDeleteSource ) {
657 $tmpFile->autocollect();
660 $sha1File = ltrim( sha1_file(
$source ),
'0' );
662 if ( $sha1 && ( $sha1 !== $sha1File ) ) {
663 wfDebug( __METHOD__ .
": Corrupt file $source.\n" );
669 # Do the actual upload
680 wfDebug( __METHOD__ .
": Successful\n" );
692 if ( !$this->config->get(
'EnableUploads' ) ) {
696 $tempo = tempnam(
wfTempDir(),
'download' );
697 $f = fopen( $tempo,
'wb' );
699 wfDebug(
"IMPORT: couldn't write to temp file $tempo\n" );
707 wfDebug(
"IMPORT: couldn't fetch source $src\n" );
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
setFileSrc($src, $isTemp)
per default it will return the text for text based content
static newFromArchiveName($title, $repo, $archiveName)
This class is used to hold the location and do limited manipulation of files stored temporarily (this...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
wfLocalFile($title)
Get an object referring to a locally registered file.
setSha1Base36($sha1base36)
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfTempDir()
Tries to get the system directory for temporary files.
Interface for configuration instances.
static singleton()
Get a RepoGroup instance.
Represents a revision, log entry or upload during the import process.
setArchiveName($archiveName)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
ContentHandler $contentHandler
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
__construct(Config $config)
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
static get($url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
if the prop value should be in the metadata multi language array format
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page