Foxtrott has submitted this change and it was merged.

Change subject: fix bug 47150 (sfEditFormPreloadText no longer works as it used 
to)
......................................................................


fix bug 47150 (sfEditFormPreloadText no longer works as it used to)

Special:FormEdit explicitly turned preloading off if it was unset by the 
request.
It now leaves the setting alone.

Change-Id: I080bd4473635c26e8a8b853d5272f892ed00b639
---
M includes/SF_AutoeditAPI.php
M specials/SF_FormEdit.php
2 files changed, 10 insertions(+), 6 deletions(-)

Approvals:
  Cariaso: Looks good to me, but someone else must approve
  Foxtrott: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/includes/SF_AutoeditAPI.php b/includes/SF_AutoeditAPI.php
index da7dafa..ac498c5 100644
--- a/includes/SF_AutoeditAPI.php
+++ b/includes/SF_AutoeditAPI.php
@@ -770,18 +770,23 @@
                // preload data if not explicitly excluded and if the preload 
page exists
                if ( !isset( $this->mOptions[ 'preload' ] ) || $this->mOptions[ 
'preload' ] !== false ) {
 
-                       if ( !isset( $this->mOptions[ 'preload' ] ) || 
$this->mOptions[ 'preload' ] === true ) {
-                               $preloadTitle = Title::newFromText( $targetName 
);
-                       } else {
+                       if ( isset( $this->mOptions[ 'preload' ] ) && 
is_string( $this->mOptions[ 'preload' ] ) ) {
                                $preloadTitle = Title::newFromText( 
$this->mOptions[ 'preload' ] );
+                       } else {
+                               $preloadTitle = Title::newFromText( $targetName 
);
                        }
 
                        if ( $preloadTitle !== null && $preloadTitle->exists() 
) {
 
                                // the content of the page that was specified 
to be used for preloading
                                $preloadContent = WikiPage::factory( 
$preloadTitle )->getRawText();
+                       } else {
+                               $preloadContent = null;
+                       }
 
-                               wfRunHooks( 'sfEditFormPreloadText', array( 
&$preloadContent, $targetTitle, $formTitle ) );
+                       wfRunHooks( 'sfEditFormPreloadText', array( 
&$preloadContent, $targetTitle, $formTitle ) );
+
+                       if ( $preloadContent !== null ) {
 
                                $pageExists = true;
 
diff --git a/specials/SF_FormEdit.php b/specials/SF_FormEdit.php
index 2414a91..cbef163 100644
--- a/specials/SF_FormEdit.php
+++ b/specials/SF_FormEdit.php
@@ -83,8 +83,7 @@
                        // if page does not exist and preload parameter is set, 
pass that on
                        $module->setOption( 'preload', $wgRequest->getText( 
'preload' ) );
                } else {
-                       // nothing set, so do not preload
-                       $module->setOption( 'preload', false );                 
+                       // nothing set, so do not set preload
                }
 
                $module->execute();

-- 
To view, visit https://gerrit.wikimedia.org/r/61815
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I080bd4473635c26e8a8b853d5272f892ed00b639
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>
Gerrit-Reviewer: Cariaso <[email protected]>
Gerrit-Reviewer: Foxtrott <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to