Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | * Returns true if there was an error, false otherwise |
128 | 128 | */ |
129 | 129 | private function curlCopy( $url, $dest ) { |
130 | | - global $wgMaxUploadSize, $wgUser; |
| 130 | + global $wgMaxUploadSize, $wgUser, $wgOut; |
131 | 131 | |
132 | 132 | if( !$wgUser->isAllowed( 'upload_by_url' ) ) { |
133 | 133 | $wgOut->permissionRequired( 'upload_by_url' ); |
— | — | @@ -137,6 +137,7 @@ |
138 | 138 | $url = trim( $url ); |
139 | 139 | if( stripos($url, 'http://') !== 0 && stripos($url, 'ftp://') !== 0 ) { |
140 | 140 | # Only HTTP or FTP URLs |
| 141 | + $wgOut->errorPage( 'upload-proto-error', 'upload-proto-error-text' ); |
141 | 142 | return true; |
142 | 143 | } |
143 | 144 | |
— | — | @@ -144,6 +145,7 @@ |
145 | 146 | $this->mUploadTempFile = @fopen( $this->mUploadTempName, "wb" ); |
146 | 147 | if( $this->mUploadTempFile === false ) { |
147 | 148 | # Could not open temporary file to write in |
| 149 | + $wgOut->errorPage( 'upload-file-error', 'upload-file-error-text'); |
148 | 150 | return true; |
149 | 151 | } |
150 | 152 | |
— | — | @@ -155,13 +157,18 @@ |
156 | 158 | curl_setopt( $ch, CURLOPT_WRITEFUNCTION, array( $this, 'uploadCurlCallback' ) ); |
157 | 159 | curl_exec( $ch ); |
158 | 160 | $error = curl_errno( $ch ) ? true : false; |
159 | | -# if ( $error ) print curl_error ( $ch ) ; # Debugging output |
| 161 | + $errornum = curl_errno( $ch ); |
| 162 | + // if ( $error ) print curl_error ( $ch ) ; # Debugging output |
160 | 163 | curl_close( $ch ); |
161 | 164 | |
162 | 165 | fclose( $this->mUploadTempFile ); |
163 | 166 | unset( $this->mUploadTempFile ); |
164 | 167 | if( $error ) { |
165 | 168 | unlink( $dest ); |
| 169 | + if( wfEmptyMsg( "upload-curl-error$errornum", wfMsg("upload-curl-error$errornum") ) ) |
| 170 | + $wgOut->errorPage( 'upload-misc-error', 'upload-misc-error-text' ); |
| 171 | + else |
| 172 | + $wgOut->errorPage( "upload-curl-error$errornum", "upload-curl-error$errornum-text" ); |
166 | 173 | } |
167 | 174 | |
168 | 175 | return $error; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | * Remove entries from redirect table on article deletion |
127 | 127 | * (bug 7788) Force section headers in new section links for users who have |
128 | 128 | 'prompt for blank edit summaries' on. |
129 | | -* (bug 1133) Special:Emailuser: add an option to send yourself a copy your mail. |
| 129 | +* (bug 1133) Special:Emailuser: add an option to send yourself a copy of your mail. |
130 | 130 | * (bug 461) Allow "Categories:" link at bottom of pages to be customized via |
131 | 131 | pagecategorieslink message. |
132 | 132 | * Sort the list of skins in "My Preferences" -> Skins by alphabetical order. |
— | — | @@ -152,7 +152,9 @@ |
153 | 153 | * (bug 5365) Stop users being prompted to enter an edit summary for null edits, |
154 | 154 | if they have selected that option in preferences. |
155 | 155 | * (bug 5936) Show an 'm' to the left of the edit summary on diff pages for minor edits. |
| 156 | +* (bug 7820) Improve error reporting for uploads via URL. |
156 | 157 | |
| 158 | + |
157 | 159 | == Languages updated == |
158 | 160 | |
159 | 161 | * Bishnupriya Manipuri (bpy) |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1283,6 +1283,18 @@ |
1284 | 1284 | 'watchthisupload' => 'Watch this page', |
1285 | 1285 | 'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.', |
1286 | 1286 | |
| 1287 | +'upload-proto-error' => 'Incorrect protocol', |
| 1288 | +'upload-proto-error-text' => 'Remote upload requires URLs beginning with <code>http://</code> or <code>ftp://</code>.', |
| 1289 | +'upload-file-error' => 'Internal error', |
| 1290 | +'upload-file-error-text' => 'An internal error occurred when attempting to create a temporary file on the server. Please contact a system administrator.', |
| 1291 | +'upload-misc-error' => 'Unknown upload error', |
| 1292 | +'upload-misc-error-text' => 'An unknown error occurred during the upload. Please verify that the URL is valid and accessible and try again. If the problem persists, contact a system administrator.', |
| 1293 | +# Some likely curl errors. More could be added from <http://curl.haxx.se/libcurl/c/libcurl-errors.html> |
| 1294 | +'upload-curl-error6' => "Couldn't reach URL", |
| 1295 | +'upload-curl-error6-text' => 'The URL provided could not be reached. Please double-check that the URL is correct and the site is up.', |
| 1296 | +'upload-curl-error28' => 'Upload timeout', |
| 1297 | +'upload-curl-error28-text' => 'The site took too long to respond. Please check the site is up, wait a short while and try again. You may want to try at a less busy time.', |
| 1298 | + |
1287 | 1299 | 'license' => 'Licensing', |
1288 | 1300 | 'nolicense' => 'None selected', |
1289 | 1301 | 'licenses' => '-', # Don't duplicate this in translations |