Ljonka has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311143

Change subject: BSApiWikiPageTasks: improve error handling on empty title object
......................................................................

BSApiWikiPageTasks: improve error handling on empty title object

Change-Id: I0cb41b6626fc07d7467af2cc7875e61e8a0fe3c4
---
M includes/api/BSApiWikiPageTasks.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/43/311143/1

diff --git a/includes/api/BSApiWikiPageTasks.php 
b/includes/api/BSApiWikiPageTasks.php
index 0d96a6f..39a5bf3 100644
--- a/includes/api/BSApiWikiPageTasks.php
+++ b/includes/api/BSApiWikiPageTasks.php
@@ -51,6 +51,10 @@
 
                $oTitle = Title::newFromID( $oTaskData->page_id );
                if ( $oTitle instanceof Title === false ) {
+                       $oTitle = Title::newFromText( $oTaskData->page_title );
+               }
+
+               if ( $oTitle instanceof Title === false ) {
                        $oResponse->message = wfMessage( 
'bs-wikipage-tasks-error-page-not-valid' )->plain();
                        return $oResponse;
                }
@@ -86,7 +90,12 @@
 
                $oWikiPage = WikiPage::factory( $oTitle );
                if ( $oWikiPage->getContentModel() === CONTENT_MODEL_WIKITEXT ){
-                       $sText = $oWikiPage->getContent()->getNativeData();
+                       $oContent = $oWikiPage->getContent();
+                       $sText = '';
+                       if( $oContent instanceof Content ) {
+                               $sText = $oContent->getNativeData();
+                       }
+
                }
                else {
                        $oResponse->message = wfMessage( 
'bs-wikipage-tasks-error-contentmodel' )->plain();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cb41b6626fc07d7467af2cc7875e61e8a0fe3c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Ljonka <l.verhovs...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to