Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Replace wfMsg* calls
......................................................................

Replace wfMsg* calls

Bug: T70750
Change-Id: Iadef688cd93f7de04feed36f9f55286feed55e6d
---
M UploadLocalDirectory.php
M UploadLocalForm.php
2 files changed, 35 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadLocal 
refs/changes/21/262121/1

diff --git a/UploadLocalDirectory.php b/UploadLocalDirectory.php
index 17aa001..1d2f3a8 100644
--- a/UploadLocalDirectory.php
+++ b/UploadLocalDirectory.php
@@ -20,7 +20,7 @@
                // this code.
                
                if( ! $wgEnableUploads ) {
-                       $wgOut->addWikiText( wfMsg( 'uploaddisabled' ) );
+                       $wgOut->addWikiText( wfMessage( 'uploaddisabled' 
)->text() );
                        return;
                }
                
@@ -37,18 +37,18 @@
                
                // check if both relevant directories are writeable
                if ( !is_writeable( $wgUploadDirectory ) ) {
-                       $wgOut->addWikiText( wfMsg( 
'upload_directory_read_only', $wgUploadDirectory ) );
+                       $wgOut->addWikiText( wfMessage( 
'upload_directory_read_only', $wgUploadDirectory )->text() );
                        return;
                }
                if ( !is_writeable($this->_directory) ) {
-                       $wgOut->addWikiText( wfMsg( 
'upload_directory_read_only', $this->_directory ) );
+                       $wgOut->addWikiText( wfMessage( 
'upload_directory_read_only', $this->_directory )->text() );
                        return;
                }
                
                // check if there are any files to upload
                if (empty($this->_available_files)) {
-                       $wgOut->addWikitext( wfMsg( 'uploadlocaltext' ) );
-                       $wgOut->addWikitext( wfMsg( 'nolocalfiles', 
htmlentities($this->_directory) ) );
+                       $wgOut->addWikitext( wfMessage( 'uploadlocaltext' 
)->text() );
+                       $wgOut->addWikitext( wfMessage( 'nolocalfiles', 
$this->_directory )->escaped() );
                        return;
                }
                
@@ -63,9 +63,9 @@
        function showForm() {
                global $wgOut;
                
-               $wgOut->setPageTitle( wfMsg('specialuploadlocal') );
+               $wgOut->setPageTitle( wfMessage('specialuploadlocal') );
                
-               $wgOut->addWikitext( wfMsg( 'uploadlocaltext' ) );
+               $wgOut->addWikitext( wfMessage( 'uploadlocaltext' )->text() );
                
                $titleObj = Title::makeTitle( NS_SPECIAL, 'UploadLocal' );
                $action = htmlspecialchars( $titleObj->getLocalURL() );
@@ -73,8 +73,8 @@
                $wgOut->addHTML('<form id="uploadlocal" method="post"'.
                        ' enctype="multipart/form-data" action="'.$action.'">');
                
-               $wgOut->addWikitext('==' . wfMsg('uploadlocal_file_list') . 
'==');
-               $wgOut->addWikitext(wfMsg('uploadlocal_file_list_explanation'));
+               $wgOut->addWikitext('==' . 
wfMessage('uploadlocal_file_list')->text() . '==');
+               
$wgOut->addWikitext(wfMessage('uploadlocal_file_list_explanation')->text());
                
                $html = '';
                
@@ -82,9 +82,9 @@
                $html .= '<theader>'.
                        '<tr><th style="width:1em;">X</th>'.
                        '<th style="width:1em;">W</th>'.
-                       '<th 
style="width:10em;text-align:left;">'.wfMsg('sourcefilename').'</th>'.
-                       '<th 
style="width:10em;text-align:left;">'.wfMsg('destfilename').'</th>'.
-                       '<th 
style="text-align:left;">'.wfMsg('filedesc').'</th></tr></theader>';
+                       '<th 
style="width:10em;text-align:left;">'.wfMessage('sourcefilename')->escaped().'</th>'.
+                       '<th 
style="width:10em;text-align:left;">'.wfMessage('destfilename')->escaped().'</th>'.
+                       '<th 
style="text-align:left;">'.wfMessage('filedesc')->escaped().'</th></tr></theader>';
                $html .= '<tbody>';
                $i = 1;
                foreach ($this->_available_files as $file) {
@@ -108,28 +108,28 @@
                $html .= '</tbody></table>';
                
                $wgOut->addHTML($html);
-               $wgOut->addWikitext('==' . wfMsg('uploadlocal_global_params') . 
'==');
-               
$wgOut->addWikitext(wfMsg('uploadlocal_global_params_explanation'));
+               $wgOut->addWikitext('==' . 
wfMessage('uploadlocal_global_params')->text() . '==');
+               
$wgOut->addWikitext(wfMessage('uploadlocal_global_params_explanation')->text());
                $html = '';
                
                $html .= '<table border="0" style="width:100%;">';
                $html .= '<tbody>'.
-                       '<tr><th 
style="text-align:right;width:25%;">'.wfMsg('uploadlocal_descriptions_prepend').'</th>'.
+                       '<tr><th 
style="text-align:right;width:25%;">'.wfMessage('uploadlocal_descriptions_prepend')->escaped().'</th>'.
                        '<td><textarea cols="70" rows="3" style="width:100%;" 
name="wpUploadDescriptionsPrepend"></textarea></td></tr>'.
                        
-                       '<tr><th 
style="text-align:right;">'.wfMsg('uploadlocal_descriptions_append').'</th>'.
+                       '<tr><th 
style="text-align:right;">'.wfMessage('uploadlocal_descriptions_append')->escaped().'</th>'.
                        '<td><textarea cols="70" rows="3" style="width:100%;" 
name="wpUploadDescriptionsAppend"></textarea></td></tr>'.
                        
-                       '<tr><th 
style="text-align:right;">'.wfMsg('uploadlocal_dest_file_prepend').'</th>'.
+                       '<tr><th 
style="text-align:right;">'.wfMessage('uploadlocal_dest_file_prepend')->escaped().'</th>'.
                        '<td><input type="text" style="width:100%;" 
name="wpDestFilesPrepend" /></td></tr>'.
                        
-                       '<tr><th 
style="text-align:right;">'.wfMsg('uploadlocal_dest_file_append').'</th>'.
+                       '<tr><th 
style="text-align:right;">'.wfMessage('uploadlocal_dest_file_append')->escaped().'</th>'.
                        '<td><input type="text" style="width:100%;" 
name="wpDestFilesAppend" /></td></tr>'.
                        
                        '</tbody>';
                $html .= '</table>';
                
-               $html .= '<input type="submit" name="wpUploadLocal" 
value="'.wfMsg('uploadlocalbtn').'" /></form>';
+               $html .= '<input type="submit" name="wpUploadLocal" 
value="'.wfMessage('uploadlocalbtn')->escaped().'" /></form>';
                
                $wgOut->addHTML($html);
        }
@@ -198,7 +198,7 @@
                }
                
                if (empty($forms)) {
-                       $wgOut->addWikitext( wfMsg( 'uploadednolocalfiles' ) );
+                       $wgOut->addWikitext( wfMessage( 'uploadednolocalfiles' 
)->text() );
                        return;
                }
                $no_error = true;
@@ -215,10 +215,10 @@
                $wgOut->redirect('');
                
                if (empty($errors)) {
-                       $wgOut->setPageTitle(wfMsg('allfilessuccessful'));
-                       $wgOut->addWikitext(wfMsg('allfilessuccessfultext'));
+                       $wgOut->setPageTitle(wfMessage('allfilessuccessful'));
+                       
$wgOut->addWikitext(wfMessage('allfilessuccessfultext')->text());
                } else {
-                       $wgOut->setPageTitle(wfMsg('uploadlocalerrors'));
+                       $wgOut->setPageTitle(wfMessage('uploadlocalerrors'));
                        $wgOut->addHTML('<ul>');
                        foreach ($errors as $name => $error) {
                                $wgOut->addHTML('<li>'.$name.' - 
'.$error.'</li>');
diff --git a/UploadLocalForm.php b/UploadLocalForm.php
index 1e698a5..be3c70b 100644
--- a/UploadLocalForm.php
+++ b/UploadLocalForm.php
@@ -43,7 +43,7 @@
                
                if( $title == null ) {
                        # We should check mTitleError or call validateName() 
here to get the specific problem with the file but since both are protected we 
can't. Protected === Bullshit.
-                       $this->uploadError( wfMsg( 
'uploadlocal_error_badtitle', $this->getFilename() ) );
+                       $this->uploadError( wfMessage( 
'uploadlocal_error_badtitle', $this->getFilename() )->escaped() );
                        return;
                }
                
@@ -51,10 +51,10 @@
                $warnings = $this->upload->checkWarnings();
                if ( $warnings && isset( $warnings['exists'] ) ) {
                        if( $warnings['exists']['warning'] == 'exists' || 
$warnings['exists']['warning'] == 'page-exists' ) {
-                               $this->uploadError( wfMsg( 
'uploadlocal_error_exists', $warnings['exists']['file']->getName() ) );
+                               $this->uploadError( wfMessage( 
'uploadlocal_error_exists', $warnings['exists']['file']->getName() )->escaped() 
);
                                return;
                        } elseif( $warnings['exists']['warning'] == 
'bad-prefix' ) {
-                               $this->uploadError( wfMsg( 
'uploadlocal_error_badprefix', $warnings['exists']['file']->getName() ) );
+                               $this->uploadError( wfMessage( 
'uploadlocal_error_badprefix', $warnings['exists']['file']->getName() 
)->escaped() );
                                return;
                        }
                }
@@ -69,32 +69,32 @@
                } else {
                        switch( $verification['status'] ) {
                                case UploadBase::EMPTY_FILE:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_empty' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_empty' )->escaped() );
                                        break;
                                case UploadBase::FILETYPE_MISSING:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_missing' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_missing' )->escaped() );
                                        break;
                                case UploadBase::FILETYPE_BADTYPE:
                                        global $wgFileExtensions;
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_badtype' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_badtype' )->escaped() );
                                        break;
                                case UploadBase::MIN_LENGTH_PARTNAME:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_tooshort' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_tooshort' )->escaped() );
                                        break;
                                case UploadBase::ILLEGAL_FILENAME:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_illegal' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_illegal' )->escaped() );
                                        break;
                                case UploadBase::OVERWRITE_EXISTING_FILE:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_overwrite' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_overwrite' )->escaped() );
                                        break;
                                case UploadBase::VERIFICATION_ERROR:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_verify', $verification['details'][0] ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_verify', $verification['details'][0] )->escaped() );
                                        break;
                                case UploadBase::HOOK_ABORTED:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_hook' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_hook' )->escaped() );
                                        break;
                                default:
-                                       $this->uploadError( wfMsg( 
'uploadlocal_error_unknown' ) );
+                                       $this->uploadError( wfMessage( 
'uploadlocal_error_unknown' )->escaped() );
                                        break;
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadef688cd93f7de04feed36f9f55286feed55e6d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadLocal
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

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

Reply via email to