X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FFileDeleteForm.php;h=898005ecc9848244623d731e31b84f328b664f31;hb=f29c93a23bc6ca74a42aad576471e52882711779;hp=8c843c4438d5afee9ef329cfbf2ab4dc91440ffd;hpb=3e88f9fa2a5a00bc1330560accf8e9d09c8be42a;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php
index 8c843c4438..898005ecc9 100644
--- a/includes/FileDeleteForm.php
+++ b/includes/FileDeleteForm.php
@@ -212,7 +212,7 @@ class FileDeleteForm {
$logEntry->setTags( $tags );
$logid = $logEntry->insert();
$dbw->onTransactionPreCommitOrIdle(
- function () use ( $dbw, $logEntry, $logid ) {
+ function () use ( $logEntry, $logid ) {
$logEntry->publish( $logid );
},
__METHOD__
@@ -246,6 +246,9 @@ class FileDeleteForm {
private function showForm() {
global $wgOut, $wgUser, $wgRequest;
+ $conf = RequestContext::getMain()->getConfig();
+ $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+
if ( $wgUser->isAllowed( 'suppressrevision' ) ) {
$suppress = "
|
@@ -258,6 +261,8 @@ class FileDeleteForm {
$suppress = '';
}
+ $wgOut->addModules( 'mediawiki.action.delete.file' );
+
$checkWatch = $wgUser->getBoolOption( 'watchdeletion' ) || $wgUser->isWatched( $this->title );
$form = Xml::openElement( 'form', [ 'method' => 'post', 'action' => $this->getAction(),
'id' => 'mw-img-deleteconfirm' ] ) .
@@ -286,8 +291,15 @@ class FileDeleteForm {
Xml::label( wfMessage( 'filedelete-otherreason' )->text(), 'wpReason' ) .
"
" .
- Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ),
- [ 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ] ) .
+ Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), [
+ 'type' => 'text',
+ // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+ // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+ // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+ 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
+ 'tabindex' => '2',
+ 'id' => 'wpReason'
+ ] ) .
" |
{$suppress}";