return "<!-- ERROR -->$html";
}
- if ( is_string( $query ) ) {
- // some functions withing core using this still hand over query strings
- wfDeprecated( __METHOD__ . ' with parameter $query as string (should be array)', '1.20' );
- $query = wfCgiToArray( $query );
- }
-
$services = MediaWikiServices::getInstance();
$options = (array)$options;
if ( $options ) {
# Use manually specified thumbnail
$manual_title = Title::makeTitleSafe( NS_FILE, $frameParams['manualthumb'] );
if ( $manual_title ) {
- $manual_img = wfFindFile( $manual_title );
+ $manual_img = MediaWikiServices::getInstance()->getRepoGroup()
+ ->findFile( $manual_title );
if ( $manual_img ) {
$thumb = $manual_img->getUnscaledThumb( $handlerParams );
$manualthumb = true;
$label = $title->getPrefixedText();
}
$encLabel = htmlspecialchars( $label );
- $currentExists = $time ? ( wfFindFile( $title ) != false ) : false;
+ $currentExists = $time
+ && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title ) !== false;
if ( ( $wgUploadMissingFileUrl || $wgUploadNavigationUrl || $wgEnableUploads )
&& !$currentExists
* @since 1.16.3
* @param LinkTarget $title
* @param string $html Pre-sanitized HTML
- * @param string $time MW timestamp of file creation time
+ * @param string|false $time MW timestamp of file creation time
* @return string HTML
*/
public static function makeMediaLinkObj( $title, $html = '', $time = false ) {
- $img = wfFindFile( $title, [ 'time' => $time ] );
+ $img = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
+ $title, [ 'time' => $time ]
+ );
return self::makeMediaLinkFile( $title, $img, $html );
}
* @since 1.16.3. $altUserName was added in 1.19.
*/
public static function userLink( $userId, $userName, $altUserName = false ) {
- if ( $userName === '' ) {
- wfLogWarning( __METHOD__ . ' received an empty username. Are there database errors ' .
+ if ( $userName === '' || $userName === false || $userName === null ) {
+ wfDebug( __METHOD__ . ' received an empty username. Are there database errors ' .
'that need to be fixed?' );
return wfMessage( 'empty-username' )->parse();
}
$useParentheses = true
) {
if ( $userText === '' ) {
- wfLogWarning( __METHOD__ . ' received an empty username. Are there database errors ' .
+ wfDebug( __METHOD__ . ' received an empty username. Are there database errors ' .
'that need to be fixed?' );
return ' ' . wfMessage( 'empty-username' )->parse();
}
*/
public static function userTalkLink( $userId, $userText ) {
if ( $userText === '' ) {
- wfLogWarning( __METHOD__ . ' received an empty username. Are there database errors ' .
+ wfDebug( __METHOD__ . ' received an empty username. Are there database errors ' .
'that need to be fixed?' );
return wfMessage( 'empty-username' )->parse();
}
*/
public static function blockLink( $userId, $userText ) {
if ( $userText === '' ) {
- wfLogWarning( __METHOD__ . ' received an empty username. Are there database errors ' .
+ wfDebug( __METHOD__ . ' received an empty username. Are there database errors ' .
'that need to be fixed?' );
return wfMessage( 'empty-username' )->parse();
}
$sectionText = str_replace( '[[', '[[', $auto );
$section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
- if ( $local ) {
- $sectionTitle = new TitleValue( NS_MAIN, '', $section );
- } else {
- $sectionTitle = $title->createFragmentTarget( $section );
- }
- if ( $sectionTitle ) {
+ // Support: HHVM (T222857)
+ // The guessSectionNameFromStrippedText method returns a non-empty string
+ // that starts with "#". Before PHP 7 (and still on HHVM) substr() would
+ // return false if the start offset is the end of the string.
+ // On PHP 7+, it gracefully returns empty string instead.
+ if ( $section !== '' && $section !== false ) {
+ if ( $local ) {
+ $sectionTitle = new TitleValue( NS_MAIN, '', $section );
+ } else {
+ $sectionTitle = $title->createFragmentTarget( $section );
+ }
$auto = Linker::makeCommentLink(
- $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText,
- $wikiId, 'noclasses'
+ $sectionTitle,
+ $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText,
+ $wikiId,
+ 'noclasses'
);
}
}