+ $revOpts = [ 'page' ];
+ if ( $this->text != self::STUB ) {
+ $revOpts[] = 'text';
+ }
+ $revQuery = Revision::getQueryInfo( $revOpts );
+
+ // We want page primary rather than revision
+ $tables = array_merge( [ 'page' ], array_diff( $revQuery['tables'], [ 'page' ] ) );
+ $join = $revQuery['joins'] + [
+ 'revision' => $revQuery['joins']['page']
+ ];
+ unset( $join['page'] );
+
+ $fields = array_merge( $revQuery['fields'], [ 'page_restrictions' ] );
+
+ $conds = [];
+ if ( $cond !== '' ) {
+ $conds[] = $cond;
+ }