X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FFileDeleteForm.php;h=783de1c0c4cb6d2200e59ccd6f7c4ad6f2e8ac74;hb=52aeaa7a5;hp=e7b4a1f8e61b5c07cc84f839faa24dc7f7568e85;hpb=08e0ed2b70ba5986a96c701f84a7679c98a6f2fd;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php
index e7b4a1f8e6..783de1c0c4 100644
--- a/includes/FileDeleteForm.php
+++ b/includes/FileDeleteForm.php
@@ -47,8 +47,6 @@ class FileDeleteForm {
private $oldimage = '';
/**
- * Constructor
- *
* @param File $file File object we're deleting
*/
public function __construct( $file ) {
@@ -145,9 +143,9 @@ class FileDeleteForm {
/**
* Really delete the file
*
- * @param Title $title
- * @param File $file
- * @param string $oldimage Archive name
+ * @param Title &$title
+ * @param File &$file
+ * @param string &$oldimage Archive name
* @param string $reason Reason of the deletion
* @param bool $suppress Whether to mark all deleted versions as restricted
* @param User $user User object performing the request
@@ -248,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 = "
|
@@ -260,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' ] ) .
@@ -288,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}";
@@ -400,8 +410,8 @@ class FileDeleteForm {
* value was provided, does it correspond to an
* existing, local, old version of this file?
*
- * @param File $file
- * @param File $oldfile
+ * @param File &$file
+ * @param File &$oldfile
* @param File $oldimage
* @return bool
*/