Merge "objectcache: Optimise array_map in MemcachedBagOStuff::makeKey()"
[lhc/web/wiklou.git] / includes / content / ContentHandler.php
index 65a7b7d..f1df087 100644 (file)
@@ -26,6 +26,7 @@
  * @author Daniel Kinzler
  */
 
+use MediaWiki\Storage\RevisionRecord;
 use Wikimedia\Assert\Assert;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
@@ -279,8 +280,10 @@ abstract class ContentHandler {
                        }
 
                        if ( !( $handler instanceof ContentHandler ) ) {
-                               throw new MWException( "$classOrCallback from \$wgContentHandlers is not " .
-                                       "compatible with ContentHandler" );
+                               throw new MWException(
+                                       var_export( $classOrCallback, true ) . " from \$wgContentHandlers is not " .
+                                       "compatible with ContentHandler"
+                               );
                        }
                }
 
@@ -1025,7 +1028,7 @@ abstract class ContentHandler {
                        [ 'rev_user_text' => $revQuery['fields']['rev_user_text'] ],
                        [
                                'rev_page' => $title->getArticleID(),
-                               $dbr->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0'
+                               $dbr->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) . ' = 0'
                        ],
                        __METHOD__,
                        [ 'LIMIT' => 20 ],
@@ -1076,7 +1079,8 @@ abstract class ContentHandler {
                }
 
                // Max content length = max comment length - length of the comment (excl. $1)
-               $text = $content ? $content->getTextForSummary( 255 - ( strlen( $reason ) - 2 ) ) : '';
+               $maxLength = CommentStore::COMMENT_CHARACTER_LIMIT - ( strlen( $reason ) - 2 );
+               $text = $content ? $content->getTextForSummary( $maxLength ) : '';
 
                // Now replace the '$1' placeholder
                $reason = str_replace( '$1', $text, $reason );
@@ -1256,6 +1260,7 @@ abstract class ContentHandler {
         * @since 1.28
         */
        public function getFieldsForSearchIndex( SearchEngine $engine ) {
+               $fields = [];
                $fields['category'] = $engine->makeSearchFieldMapping(
                        'category',
                        SearchIndexField::INDEX_TYPE_TEXT