MarkAHershberger has uploaded a new change for review.

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


Change subject: Allow this to work even during imports when $wgOut->getTitle() 
returns null
......................................................................

Allow this to work even during imports when $wgOut->getTitle() returns null

Change-Id: Ie252aa6cbbe9bcea2a7b4098b993923ac5a801d3
---
M Comment.php
1 file changed, 17 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Comments 
refs/changes/57/63257/1

diff --git a/Comment.php b/Comment.php
index 46e0208..b7a4093 100644
--- a/Comment.php
+++ b/Comment.php
@@ -134,22 +134,26 @@
                $voting = $args['voting'];
        }
 
-       $comment = new Comment( $wgOut->getTitle()->getArticleID() );
-       $comment->setAllow( $allow );
-       $comment->setVoting( $voting );
+       $title = $wgOut->getTitle();
+       $output = null;
+       if( $title ) {
+               $comment = new Comment( $title->getArticleID() );
+               $comment->setAllow( $allow );
+               $comment->setVoting( $voting );
 
-       // This was originally commented out, I don't know why.
-       // Uncommented to prevent E_NOTICE.
-       $output = $comment->displayOrderForm();
+               // This was originally commented out, I don't know why.
+               // Uncommented to prevent E_NOTICE.
+               $output = $comment->displayOrderForm();
 
-       $output .= '<div id="allcomments">' . $comment->display() . '</div>';
+               $output .= '<div id="allcomments">' . $comment->display() . 
'</div>';
 
-       // If the database is in read-only mode, display a message informing the
-       // user about that, otherwise allow them to comment
-       if( !wfReadOnly() ) {
-               $output .= $comment->displayForm();
-       } else {
-               $output .= wfMsg( 'comments-db-locked' );
+               // If the database is in read-only mode, display a message 
informing the
+               // user about that, otherwise allow them to comment
+               if( !wfReadOnly() ) {
+                       $output .= $comment->displayForm();
+               } else {
+                       $output .= wfMsg( 'comments-db-locked' );
+               }
        }
 
        wfProfileOut( __METHOD__ );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie252aa6cbbe9bcea2a7b4098b993923ac5a801d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Comments
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>

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

Reply via email to