There's no good reason to ever do this, or to write code that lets it
happen. The revisions are just going to sit around in the DB, not
connected to anything (except maybe in some page's page_latest field,
if you're lucky). Any operations that do this should fail fast instead
of spamming the DB and appearing to "succeed".
Bug: T18674
Change-Id: I8219153a09adb1c556d0159a4fb0799895370a94
public function insertOn( $dbw ) {
global $wgDefaultExternalStore, $wgContentHandlerUseDB;
+ // Not allowed to have rev_page equal to 0, false, etc.
+ if ( !$this->mPage ) {
+ $title = $this->getTitle();
+ if ( $title instanceof Title ) {
+ $titleText = ' for page ' . $title->getPrefixedText();
+ } else {
+ $titleText = '';
+ }
+ throw new MWException( "Cannot insert revision$titleText: page ID must be nonzero" );
+ }
+
$this->checkContentModel();
$data = $this->mText;