+ /**
+ * Verify if a given title exists and the given user is allowed to view it
+ *
+ * @see EditPage::getPreloadedContent()
+ * @param Title|null $title
+ * @param User $user
+ * @return bool
+ * @throws Exception
+ */
+ private function isPageExistingAndViewable( $title, User $user ) {
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+
+ return $title && $title->exists() && $permissionManager->userCan( 'read', $user, $title );
+ }
+