http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99627
Revision: 99627
Author: questpc
Date: 2011-10-12 09:49:23 +0000 (Wed, 12 Oct 2011)
Log Message:
-----------
Fixed qp_PollStore::getInterpTitle() logic to work correctly in
Special:Pollresults
Modified Paths:
--------------
trunk/extensions/QPoll/model/qp_pollstore.php
trunk/extensions/QPoll/specials/qp_results.php
Modified: trunk/extensions/QPoll/model/qp_pollstore.php
===================================================================
--- trunk/extensions/QPoll/model/qp_pollstore.php 2011-10-12 09:24:23 UTC
(rev 99626)
+++ trunk/extensions/QPoll/model/qp_pollstore.php 2011-10-12 09:49:23 UTC
(rev 99627)
@@ -254,9 +254,9 @@
}
/**
- * @return mixed Title instance of interpretation template
+ * @return mixed Title instance of interpretation template (existing or
not)
* false, when no interpretation template is defined in
poll header
- * null, when interpretation template does not exist
(error)
+ * null, when the title parts are invalid (error)
*/
function getInterpTitle() {
if ( is_null( $this->interpDBkey ) ) {
@@ -266,7 +266,7 @@
return false;
}
$title = Title::newFromText( $this->interpDBkey,
$this->interpNS );
- return ( $title instanceof Title ) ? ( $title->exists() ?
$title : null ) : null;
+ return ( $title instanceof Title ) ? $title : null;
}
// warning: will work only after successful loadUserAlreadyVoted() or
loadUserVote()
@@ -889,9 +889,10 @@
$this->interpResult = new qp_InterpResult();
$interpTitle = $this->getInterpTitle();
if ( $interpTitle === false ) {
+ # this poll has no interpretation script
return;
}
- if ( $interpTitle === null ) {
+ if ( !( $interpTitle instanceof Title ) ||
!$interpTitle->exists() ) {
$this->interpResult->storeErroneous = false;
$this->interpResult->setError( wfMsg(
'qp_error_no_interpretation' ) );
return;
Modified: trunk/extensions/QPoll/specials/qp_results.php
===================================================================
--- trunk/extensions/QPoll/specials/qp_results.php 2011-10-12 09:24:23 UTC
(rev 99626)
+++ trunk/extensions/QPoll/specials/qp_results.php 2011-10-12 09:49:23 UTC
(rev 99627)
@@ -182,7 +182,7 @@
array( '__tag' => 'div', 'style' =>
'font-weight:bold;', wfMsg( 'qp_results_submit_attempts', intval(
$pollStore->attempts ) ) )
);
$interpTitle = $pollStore->getInterpTitle();
- if ( $interpTitle === null ) {
+ if ( !( $interpTitle instanceof Title ) ) {
$tags[] = wfMsg( 'qp_poll_has_no_interpretation' );
return $tags;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs