dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Move section ID fallbacks into headers themselves"
[lhc/web/wiklou.git]
/
includes
/
Revision.php
diff --git
a/includes/Revision.php
b/includes/Revision.php
index
c6b50f4
..
ff4a284
100644
(file)
--- a/
includes/Revision.php
+++ b/
includes/Revision.php
@@
-192,7
+192,9
@@
class Revision implements IDBAccessObject {
$attribs = $overrides + [
'page' => isset( $row->ar_page_id ) ? $row->ar_page_id : null,
'id' => isset( $row->ar_rev_id ) ? $row->ar_rev_id : null,
$attribs = $overrides + [
'page' => isset( $row->ar_page_id ) ? $row->ar_page_id : null,
'id' => isset( $row->ar_rev_id ) ? $row->ar_rev_id : null,
- 'comment' => $row->ar_comment,
+ 'comment' => CommentStore::newKey( 'ar_comment' )
+ // Legacy because $row probably came from self::selectArchiveFields()
+ ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text,
'user' => $row->ar_user,
'user_text' => $row->ar_user_text,
'timestamp' => $row->ar_timestamp,
'user' => $row->ar_user,
'user_text' => $row->ar_user_text,
'timestamp' => $row->ar_timestamp,
@@
-443,6
+445,8
@@
class Revision implements IDBAccessObject {
/**
* Return the list of revision fields that should be selected to create
* a new revision.
/**
* Return the list of revision fields that should be selected to create
* a new revision.
+ * @todo Deprecate this in favor of a method that returns tables and joins
+ * as well, and use CommentStore::getJoin().
* @return array
*/
public static function selectFields() {
* @return array
*/
public static function selectFields() {
@@
-453,7
+457,6
@@
class Revision implements IDBAccessObject {
'rev_page',
'rev_text_id',
'rev_timestamp',
'rev_page',
'rev_text_id',
'rev_timestamp',
- 'rev_comment',
'rev_user_text',
'rev_user',
'rev_minor_edit',
'rev_user_text',
'rev_user',
'rev_minor_edit',
@@
-463,6
+466,8
@@
class Revision implements IDBAccessObject {
'rev_sha1',
];
'rev_sha1',
];
+ $fields += CommentStore::newKey( 'rev_comment' )->getFields();
+
if ( $wgContentHandlerUseDB ) {
$fields[] = 'rev_content_format';
$fields[] = 'rev_content_model';
if ( $wgContentHandlerUseDB ) {
$fields[] = 'rev_content_format';
$fields[] = 'rev_content_model';
@@
-474,6
+479,8
@@
class Revision implements IDBAccessObject {
/**
* Return the list of revision fields that should be selected to create
* a new revision from an archive row.
/**
* Return the list of revision fields that should be selected to create
* a new revision from an archive row.
+ * @todo Deprecate this in favor of a method that returns tables and joins
+ * as well, and use CommentStore::getJoin().
* @return array
*/
public static function selectArchiveFields() {
* @return array
*/
public static function selectArchiveFields() {
@@
-485,7
+492,6
@@
class Revision implements IDBAccessObject {
'ar_text',
'ar_text_id',
'ar_timestamp',
'ar_text',
'ar_text_id',
'ar_timestamp',
- 'ar_comment',
'ar_user_text',
'ar_user',
'ar_minor_edit',
'ar_user_text',
'ar_user',
'ar_minor_edit',
@@
-495,6
+501,8
@@
class Revision implements IDBAccessObject {
'ar_sha1',
];
'ar_sha1',
];
+ $fields += CommentStore::newKey( 'ar_comment' )->getFields();
+
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
@@
-568,7
+576,9
@@
class Revision implements IDBAccessObject {
$this->mId = intval( $row->rev_id );
$this->mPage = intval( $row->rev_page );
$this->mTextId = intval( $row->rev_text_id );
$this->mId = intval( $row->rev_id );
$this->mPage = intval( $row->rev_page );
$this->mTextId = intval( $row->rev_text_id );
- $this->mComment = $row->rev_comment;
+ $this->mComment = CommentStore::newKey( 'rev_comment' )
+ // Legacy because $row probably came from self::selectFields()
+ ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text;
$this->mUser = intval( $row->rev_user );
$this->mMinorEdit = intval( $row->rev_minor_edit );
$this->mTimestamp = $row->rev_timestamp;
$this->mUser = intval( $row->rev_user );
$this->mMinorEdit = intval( $row->rev_minor_edit );
$this->mTimestamp = $row->rev_timestamp;
@@
-752,7
+762,7
@@
class Revision implements IDBAccessObject {
* This should only be used for proposed revisions that turn out to be null edits
*
* @since 1.28
* This should only be used for proposed revisions that turn out to be null edits
*
* @since 1.28
- * @param int
eger
$id User ID
+ * @param int $id User ID
* @param string $name User name
*/
public function setUserIdAndName( $id, $name ) {
* @param string $name User name
*/
public function setUserIdAndName( $id, $name ) {
@@
-860,7
+870,7
@@
class Revision implements IDBAccessObject {
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the ID regardless of permissions
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the ID regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User
|null
$user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return int
*/
* to the $audience parameter
* @return int
*/
@@
-894,7
+904,7
@@
class Revision implements IDBAccessObject {
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the text regardless of permissions
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the text regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User
|null
$user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return string
*/
* to the $audience parameter
* @return string
*/
@@
-938,7
+948,7
@@
class Revision implements IDBAccessObject {
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the text regardless of permissions
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the text regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User
|null
$user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return string
*/
* to the $audience parameter
* @return string
*/
@@
-1002,7
+1012,7
@@
class Revision implements IDBAccessObject {
return RecentChange::newFromConds(
[
return RecentChange::newFromConds(
[
- 'rc_user_text' => $this->getUserText(
Revision
::RAW ),
+ 'rc_user_text' => $this->getUserText(
self
::RAW ),
'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
'rc_this_oldid' => $this->getId()
],
'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
'rc_this_oldid' => $this->getId()
],
@@
-1307,7
+1317,7
@@
class Revision implements IDBAccessObject {
* data is compressed, and 'utf-8' if we're saving in UTF-8
* mode.
*
* data is compressed, and 'utf-8' if we're saving in UTF-8
* mode.
*
- * @param mixed $text Reference to a text
+ * @param mixed
&
$text Reference to a text
* @return string
*/
public static function compressRevisionText( &$text ) {
* @return string
*/
public static function compressRevisionText( &$text ) {
@@
-1455,7
+1465,6
@@
class Revision implements IDBAccessObject {
'rev_id' => $rev_id,
'rev_page' => $this->mPage,
'rev_text_id' => $this->mTextId,
'rev_id' => $rev_id,
'rev_page' => $this->mPage,
'rev_text_id' => $this->mTextId,
- 'rev_comment' => $this->mComment,
'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
'rev_user' => $this->mUser,
'rev_user_text' => $this->mUserText,
'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
'rev_user' => $this->mUser,
'rev_user_text' => $this->mUserText,
@@
-1466,10
+1475,14
@@
class Revision implements IDBAccessObject {
? $this->getPreviousRevisionId( $dbw )
: $this->mParentId,
'rev_sha1' => $this->mSha1 === null
? $this->getPreviousRevisionId( $dbw )
: $this->mParentId,
'rev_sha1' => $this->mSha1 === null
- ?
Revision
::base36Sha1( $this->mText )
+ ?
self
::base36Sha1( $this->mText )
: $this->mSha1,
];
: $this->mSha1,
];
+ list( $commentFields, $commentCallback ) =
+ CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $this->mComment );
+ $row += $commentFields;
+
if ( $wgContentHandlerUseDB ) {
// NOTE: Store null for the default model and format, to save space.
// XXX: Makes the DB sensitive to changed defaults.
if ( $wgContentHandlerUseDB ) {
// NOTE: Store null for the default model and format, to save space.
// XXX: Makes the DB sensitive to changed defaults.
@@
-1498,6
+1511,7
@@
class Revision implements IDBAccessObject {
// Only if nextSequenceValue() was called
$this->mId = $dbw->insertId();
}
// Only if nextSequenceValue() was called
$this->mId = $dbw->insertId();
}
+ $commentCallback( $this->mId );
// Assertion to try to catch T92046
if ( (int)$this->mId === 0 ) {
// Assertion to try to catch T92046
if ( (int)$this->mId === 0 ) {
@@
-1555,7
+1569,7
@@
class Revision implements IDBAccessObject {
}
}
}
}
- $content = $this->getContent(
Revision
::RAW );
+ $content = $this->getContent(
self
::RAW );
$prefixedDBkey = $title->getPrefixedDBkey();
$revId = $this->mId;
$prefixedDBkey = $title->getPrefixedDBkey();
$revId = $this->mId;
@@
-1584,7
+1598,7
@@
class Revision implements IDBAccessObject {
* Get the text cache TTL
*
* @param WANObjectCache $cache
* Get the text cache TTL
*
* @param WANObjectCache $cache
- * @return int
eger
+ * @return int
*/
private static function getCacheTTL( WANObjectCache $cache ) {
global $wgRevisionCacheExpiry;
*/
private static function getCacheTTL( WANObjectCache $cache ) {
global $wgRevisionCacheExpiry;