$conditions,
__METHOD__,
array( 'LIMIT' => 1 ),
- array( 'page' => array( 'INNER JOIN', 'page_id = rev_page' ),
- 'user' => array( 'LEFT JOIN', 'rev_user != 0 AND user_id = rev_user' ) )
+ array( 'page' => self::pageJoinCond(), 'user' => self::userJoinCond() )
);
}
+ /**
+ * Return the value of a select() JOIN conds array for the user table.
+ * This will get user table rows for logged-in users.
+ * @return Array
+ */
+ public static function userJoinCond() {
+ return array( 'LEFT JOIN', array( 'rev_user != 0', 'user_id = rev_user' ) );
+ }
+
+ /**
+ * Return the value of a select() page conds array for the paeg table.
+ * This will assure that the revision(s) are not orphaned from live pages.
+ * @return Array
+ */
+ public static function pageJoinCond() {
+ return array( 'INNER JOIN', array( 'page_id = rev_page' ) );
+ }
+
/**
* Return the list of revision fields that should be selected to create
* a new revision.
$current = $dbw->selectRow(
array( 'page', 'revision' ),
- array( 'page_latest', 'rev_text_id', 'rev_len' ),
+ array( 'page_latest', 'rev_text_id', 'rev_len', 'rev_sha1' ),
array(
'page_id' => $pageId,
'page_latest=rev_id',
'minor_edit' => $minor,
'text_id' => $current->rev_text_id,
'parent_id' => $current->page_latest,
- 'len' => $current->rev_len
+ 'len' => $current->rev_len,
+ 'sha1' => $current->rev_sha1
) );
} else {
$revision = null;