Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 53b7a2f..f7cb654 100644 (file)
@@ -617,7 +617,13 @@ class SpecialUpload extends SpecialPage {
                        $licenseText = '== ' . $msg['license-header'] . " ==\n{{" . $license . "}}\n";
                }
 
-               $pageText = $comment == '' ? '' : '== ' . $msg['filedesc'] . " ==\n" . $comment . "\n";
+               $pageText = $comment . "\n";
+               $headerText = '== ' . $msg['filedesc'] . ' ==';
+               if ( $comment !== '' && strpos( $comment, $headerText ) === false ) {
+                       // prepend header to page text unless it's already there (or there is no content)
+                       $pageText = $headerText . "\n" . $pageText;
+               }
+
                if ( $config->get( 'UseCopyrightUpload' ) ) {
                        $pageText .= '== ' . $msg['filestatus'] . " ==\n" . $copyStatus . "\n";
                        $pageText .= $licenseText;