* MWMemcached and MemCachedClientforWiki classes (deprecated in 1.27) were removed.
The MemcachedClient class should be used instead.
* EditPage::isOouiEnabled() is deprecated and will always return true.
+* EditPage::getSummaryInput() and ::getSummaryInputOOUI() are deprecated. Please
+ use ::getSummaryInputWidget() instead.
* Parser::getRandomString() (deprecated in 1.26) was removed.
* Parser::uniqPrefix() (deprecated in 1.26) was removed.
* Parser::extractTagsAndParams() now only accepts three arguments. The fourth,
}
$row = $this->getDatabaseArray( $dbw );
- $row['ipb_id'] = $dbw->nextSequenceValue( "ipblocks_ipb_id_seq" );
$dbw->insert( 'ipblocks', $row, __METHOD__, [ 'IGNORE' ] );
$affected = $dbw->affectedRows();
__METHOD__
);
if ( !$comment->id ) {
- $comment->id = $dbw->nextSequenceValue( 'comment_comment_id_seq' );
$dbw->insert(
'comment',
[
- 'comment_id' => $comment->id,
'comment_hash' => $hash,
'comment_text' => $comment->text,
'comment_data' => $dbData,
];
}
+ /**
+ * Standard summary input and label (wgSummary), abstracted so EditPage
+ * subclasses may reorganize the form.
+ * Note that you do not need to worry about the label's for=, it will be
+ * inferred by the id given to the input. You can remove them both by
+ * passing [ 'id' => false ] to $userInputAttrs.
+ *
+ * @deprecated since 1.30 Use getSummaryInputWidget() instead
+ * @param string $summary The value of the summary input
+ * @param string $labelText The html to place inside the label
+ * @param array $inputAttrs Array of attrs to use on the input
+ * @param array $spanLabelAttrs Array of attrs to use on the span inside the label
+ * @return array An array in the format [ $label, $input ]
+ */
+ public function getSummaryInput( $summary = "", $labelText = null,
+ $inputAttrs = null, $spanLabelAttrs = null
+ ) {
+ wfDeprecated( __METHOD__, '1.30' );
+ $inputAttrs = $this->getSummaryInputAttributes( $inputAttrs );
+ $inputAttrs += Linker::tooltipAndAccesskeyAttribs( 'summary' );
+
+ $spanLabelAttrs = ( is_array( $spanLabelAttrs ) ? $spanLabelAttrs : [] ) + [
+ 'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary',
+ 'id' => "wpSummaryLabel"
+ ];
+
+ $label = null;
+ if ( $labelText ) {
+ $label = Xml::tags(
+ 'label',
+ $inputAttrs['id'] ? [ 'for' => $inputAttrs['id'] ] : null,
+ $labelText
+ );
+ $label = Xml::tags( 'span', $spanLabelAttrs, $label );
+ }
+
+ $input = Html::input( 'wpSummary', $summary, 'text', $inputAttrs );
+
+ return [ $label, $input ];
+ }
+
/**
* Builds a standard summary input with a label.
*
+ * @deprecated since 1.30 Use getSummaryInputWidget() instead
* @param string $summary The value of the summary input
* @param string $labelText The html to place inside the label
* @param array $inputAttrs Array of attrs to use on the input
* @return OOUI\FieldLayout OOUI FieldLayout with Label and Input
*/
function getSummaryInputOOUI( $summary = "", $labelText = null, $inputAttrs = null ) {
+ wfDeprecated( __METHOD__, '1.30' );
+ $this->getSummaryInputWidget( $summary, $labelText, $inputAttrs );
+ }
+
+ /**
+ * Builds a standard summary input with a label.
+ *
+ * @param string $summary The value of the summary input
+ * @param string $labelText The html to place inside the label
+ * @param array $inputAttrs Array of attrs to use on the input
+ *
+ * @return OOUI\FieldLayout OOUI FieldLayout with Label and Input
+ */
+ function getSummaryInputWidget( $summary = "", $labelText = null, $inputAttrs = null ) {
$inputAttrs = OOUI\Element::configFromHtmlAttributes(
$this->getSummaryInputAttributes( $inputAttrs )
);
}
$labelText = $this->context->msg( $isSubjectPreview ? 'subject' : 'summary' )->parse();
- $wgOut->addHTML( $this->getSummaryInputOOUI(
+ $wgOut->addHTML( $this->getSummaryInputWidget(
$summary,
$labelText,
[ 'class' => $summaryClass ]
# Record the text (or external storage URL) to the text table
if ( $this->mTextId === null ) {
- $old_id = $dbw->nextSequenceValue( 'text_old_id_seq' );
$dbw->insert( 'text',
[
- 'old_id' => $old_id,
'old_text' => $data,
'old_flags' => $flags,
], __METHOD__
}
# Record the edit in revisions
- $rev_id = $this->mId !== null
- ? $this->mId
- : $dbw->nextSequenceValue( 'revision_rev_id_seq' );
$row = [
- 'rev_id' => $rev_id,
'rev_page' => $this->mPage,
'rev_text_id' => $this->mTextId,
'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
? self::base36Sha1( $this->mText )
: $this->mSha1,
];
+ if ( $this->mId !== null ) {
+ $row['rev_id'] = $this->mId;
+ }
list( $commentFields, $commentCallback ) =
CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $this->mComment );
$dbw->insert( 'revision', $row, __METHOD__ );
if ( $this->mId === null ) {
- // Only if nextSequenceValue() was called
+ // Only if auto-increment was used
$this->mId = $dbw->insertId();
}
$commentCallback( $this->mId );
# Fixup database timestamps
$this->mAttribs['rc_timestamp'] = $dbw->timestamp( $this->mAttribs['rc_timestamp'] );
- $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' );
# # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
if ( $this->mAttribs['rc_cur_id'] == 0 ) {
unset( $row['rc_comment'], $row['rc_comment_text'], $row['rc_comment_data'] );
$row += CommentStore::newKey( 'rc_comment' )->insert( $dbw, $comment );
+ # Don't reuse an existing rc_id for the new row, if one happens to be
+ # set for some reason.
+ unset( $row['rc_id'] );
+
# Insert new row
$dbw->insert( 'recentchanges', $row, __METHOD__ );
foreach ( $diffs as $url => $dummy ) {
foreach ( wfMakeUrlIndexes( $url ) as $index ) {
$arr[] = [
- 'el_id' => $this->getDB()->nextSequenceValue( 'externallinks_el_id_seq' ),
'el_from' => $this->mId,
'el_to' => $url,
'el_index' => $index,
public function store( $location, $data ) {
$dbw = $this->getMaster( $location );
- $id = $dbw->nextSequenceValue( 'blob_blob_id_seq' );
$dbw->insert( $this->getTable( $dbw ),
- [ 'blob_id' => $id, 'blob_text' => $data ],
+ [ 'blob_text' => $data ],
__METHOD__ );
$id = $dbw->insertId();
if ( !$id ) {
. $this->timestamp . "\n" );
return false;
}
- $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
$data = [
- 'log_id' => $log_id,
'log_type' => $this->type,
'log_action' => $this->action,
'log_timestamp' => $dbw->timestamp( $this->timestamp ),
'job_title' => $job->getTitle()->getDBkey(),
'job_params' => self::makeBlob( $job->getParams() ),
// Additional job metadata
- 'job_id' => $dbw->nextSequenceValue( 'job_job_id_seq' ),
'job_timestamp' => $dbw->timestamp(),
'job_sha1' => Wikimedia\base_convert(
sha1( serialize( $job->getDeduplicationInfo() ) ),
/**
* Get the inserted value of an auto-increment row
*
- * The value inserted should be fetched from nextSequenceValue()
- *
- * Example:
- * $id = $dbw->nextSequenceValue( 'page_page_id_seq' );
- * $dbw->insert( 'page', [ 'page_id' => $id ] );
- * $id = $dbw->insertId();
+ * This should only be called after an insert that used an auto-incremented
+ * value. If no such insert was previously done in the current database
+ * session, the return value is undefined.
*
* @return int
*/
global $wgContLang;
$dbw = $dbw ?: wfGetDB( DB_MASTER );
- $id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
if ( $this->timestamp === null ) {
$this->timestamp = wfTimestampNow();
}
$data = [
- 'log_id' => $id,
'log_type' => $this->getType(),
'log_action' => $this->getSubtype(),
'log_timestamp' => $dbw->timestamp( $this->getTimestamp() ),
global $wgLogRestrictions;
$dbw = wfGetDB( DB_MASTER );
- $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
// @todo FIXME private/protected/public property?
$this->timestamp = $now = wfTimestampNow();
$data = [
- 'log_id' => $log_id,
'log_type' => $this->type,
'log_action' => $this->action,
'log_timestamp' => $dbw->timestamp( $now ),
* page ID is already in use.
*/
public function insertOn( $dbw, $pageId = null ) {
- $pageIdForInsert = $pageId ?: $dbw->nextSequenceValue( 'page_page_id_seq' );
+ $pageIdForInsert = $pageId ? [ 'page_id' => $pageId ] : [];
$dbw->insert(
'page',
[
- 'page_id' => $pageIdForInsert,
'page_namespace' => $this->mTitle->getNamespace(),
'page_title' => $this->mTitle->getDBkey(),
'page_restrictions' => '',
'page_touched' => $dbw->timestamp(),
'page_latest' => 0, // Fill this in shortly...
'page_len' => 0, // Fill this in shortly...
- ],
+ ] + $pageIdForInsert,
__METHOD__,
'IGNORE'
);
$dbw->insert(
'page_restrictions',
[
- 'pr_id' => $dbw->nextSequenceValue( 'page_restrictions_pr_id_seq' ),
'pr_page' => $id,
'pr_type' => $action,
'pr_level' => $restrictions,
'sites', $fields, [ 'site_id' => $rowId ], __METHOD__
) && $success;
} else {
- $rowId = $dbw->nextSequenceValue( 'sites_site_id_seq' );
- $fields['site_id'] = $rowId;
$success = $dbw->insert( 'sites', $fields, __METHOD__ ) && $success;
$rowId = $dbw->insertId();
}
}
$this->fileMetadata[$key] = [
- 'us_id' => $dbw->nextSequenceValue( 'uploadstash_us_id_seq' ),
'us_user' => $this->userId,
'us_key' => $key,
'us_orig_path' => $path,
unset( $params['options'] );
}
$dbw = wfGetDB( DB_MASTER );
- $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
$noPass = PasswordFactory::newInvalidPassword()->toString();
$fields = [
- 'user_id' => $seqVal,
'user_name' => $name,
'user_password' => $noPass,
'user_newpassword' => $noPass,
$noPass = PasswordFactory::newInvalidPassword()->toString();
$dbw = wfGetDB( DB_MASTER );
- $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
$dbw->insert( 'user',
[
- 'user_id' => $seqVal,
'user_name' => $this->mName,
'user_password' => $noPass,
'user_newpassword' => $noPass,
$db->insert( 'externallinks',
[
[
- 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
'el_from' => $row->el_from,
'el_to' => $row->el_to,
'el_index' => "http:{$row->el_index}",
],
[
- 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
'el_from' => $row->el_from,
'el_to' => $row->el_to,
'el_index' => "https:{$row->el_index}",
*/
/* Remember the collapse state of the legend on recent changes and watchlist pages. */
-( function ( mw, $ ) {
+( function ( mw ) {
var
cookieName = 'changeslist-state',
// Expanded by default
} );
};
- $( function () {
- mw.hook( 'wikipage.content' ).add( doCollapsibleLegend );
- } );
-}( mediaWiki, jQuery ) );
+ mw.hook( 'wikipage.content' ).add( doCollapsibleLegend );
+}( mediaWiki ) );
$this->assertArrayNotHasKey( "{$key}_id", $fields, "new field, stage=$writeStage" );
}
- $extraFields[$pk] = $this->db->nextSequenceValue( "{$table}_{$pk}_seq" );
$this->db->insert( $table, $extraFields + $fields, __METHOD__ );
$id = $this->db->insertId();
if ( $usesTemp ) {