r104581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104580‎ | r104581 | r104582 >
Date:19:10, 29 November 2011
Author:kwisatz
Status:deferred
Tags:
Comment:
changes to make qrcode compatible with mw 1.17
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.09',
 26+ 'version' => '0.10',
2727 'author' => array( 'David Raison' ),
2828 'url' => 'http://www.mediawiki.org/wiki/Extension:QrCode',
2929 'descriptionmsg' => 'qrcode-desc'
@@ -120,8 +120,8 @@
121121 * first generate then publish it.
122122 */
123123 public function showCode( $label = false ){
 124+
124125 // Check for a provided label and use the page URL as default.
125 - // Also strip all non-alphanumeric characters
126126 if ( $label ) {
127127 $this->_label = $label; // cannot remember why sanitizing this would make sense
128128 //$this->_label = preg_replace("/[^0-9a-zA-Z_]+/", "", $label);
@@ -140,7 +140,8 @@
141141 return $this->_displayImage( $file );
142142 } else {
143143 wfDebug( "QrCode::showCode: Requested file ".$this->_dstFileName." is new and needs to be generated.\n");
144 - return $this->_generate();
 144+ $this->_generate();
 145+ return;
145146 }
146147 }
147148
@@ -181,6 +182,7 @@
182183
183184
184185 public function __construct( $title, $params, $id = 0 ) {
 186+ wfDebug("QrCodeDebug::Creating Job\n");
185187 $this->_dstFileName = $params['dstName'];
186188 $this->_tmpName = $params['tmpName'];
187189 $this->_uploadComment = $params['comment'];
@@ -196,8 +198,11 @@
197199 global $wgOut;
198200
199201 $mUpload = new UploadFromFile();
200 - $mUpload->initialize( $this->_dstFileName, $this->_tmpName, null ); // we don't know the filesize, how could we?
201 -
 202+
 203+ wfDebug("QrCodeDebug::".$this->_dstFileName." ".$this->_tmpName."\n");
 204+ // $mUpload->initialize( $this->_dstFileName, $this->_tmpName, null ); // pre 1.17
 205+ $mUpload->initializePathInfo( $this->_dstFileName, $this->_tmpName, null ); // we don't know the filesize, how could we?
 206+ wfDebug("QrCodeDebug:: Intialization finished\n");
202207 $pageText = 'QrCode '.$this->_dstFileName.', generated on '.date( "r" )
203208 .' by the QrCode Extension for page [['.$this->title->getFullText().']].';
204209

Status & tagging log