r73782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73781‎ | r73782 | r73783 >
Date:16:27, 26 September 2010
Author:kwisatz
Status:deferred
Tags:
Comment:
QrCode: improved debugging statements, replaced deprecated call to User::isBot()
Modified paths:
  • /trunk/extensions/QrCode/QrCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/QrCode/QrCode.php
@@ -22,7 +22,7 @@
2323 $wgExtensionCredits['parserhook'][] = array(
2424 'path' => __FILE__,
2525 'name' => 'QrCode',
26 - 'version' => '0.06',
 26+ 'version' => '0.07',
2727 'author' => array( 'David Raison' ),
2828 'url' => 'http://www.mediawiki.org/wiki/Extension:QrCode',
2929 'descriptionmsg' => 'qrcode-desc'
@@ -149,7 +149,8 @@
150150 $tmpName = tempnam( $wgTmpDirectory, 'qrcode' );
151151
152152 QRcode::png( $this->_label, $tmpName, $this->_ecc, $this->_size, $this->_margin );
153 - wfDebug( "Generated qrcode file $tmpName with ecc ".$this->_ecc.", ".$this->_size." and boundary ".$this->_margin.".\n" );
 153+ wfDebug( "QrCode::_generate: Generated qrcode file $tmpName with ecc ".$this->_ecc
 154+ .", ".$this->_size." and boundary ".$this->_margin.".\n" );
154155
155156 return $this->_publish( $tmpName );
156157 }
@@ -162,14 +163,15 @@
163164 private function _getBot(){
164165 $bot = User::createNew( $this->_qrCodeBot );
165166 if( $bot != null ){
 167+ wfDebug( 'QrCode::_getBot: Created new user '.$this->_qrCodeBot."\n" );
166168 //$bot->setPassword( '' ); // doc says empty password disables, but this triggers an exception
167169 } else {
168170 $bot = User::newFromName( $this->_qrCodeBot );
169 - wfDebug( 'Created new user '.$this->_qrCodeBot );
170171 }
171 - if( !$bot->isBot() ) {
 172+
 173+ if( !$bot->isAllowed( 'bot' ) ) { // User::isBot() has been deprecated
172174 $bot->addGroup( 'bot' );
173 - wfDebug( 'Added user '.$this->_qrCodeBot.' to Bot group' );
 175+ wfDebug( 'QrCode::_getBot: Added user '.$this->_qrCodeBot.' to Bot group'."\n" );
174176 }
175177
176178 return $bot;
@@ -178,7 +180,7 @@
179181 /**
180182 * Handle mediawiki file repositories
181183 * @param $tmpName, the file's temporary name
182 - * @return boolean value for success or failure of file "upload"
 184+ * @return boolean false on failure or wikitext on success
183185 */
184186 private function _publish( $tmpName ){
185187 global $wgOut;

Status & tagging log