From: jenkins-bot Date: Thu, 7 Dec 2017 18:10:40 +0000 (+0000) Subject: Merge "GitInfo: Fix shell restrictions for submodules" X-Git-Tag: 1.31.0-rc.0~1258 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=01e43982ae4b9a61ddfdbe92349eb309f1aaecdb;hp=0d1a6a4d1fa18ee1048f9794fb497eda1c2b28df;p=lhc%2Fweb%2Fwiklou.git Merge "GitInfo: Fix shell restrictions for submodules" --- diff --git a/.gitignore b/.gitignore index b991e115a3..bb3a946593 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,8 @@ sftp-config.json /images/thumb ## Extension:EasyTimeline /images/timeline +## Extension:Score +/images/lilypond /images/tmp /maintenance/.mweval_history /maintenance/.mwsql_history diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index bb1951d528..1a33b76357 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2404,9 +2404,10 @@ function wfShellWikiCmd( $script, array $parameters = [], array $options = [] ) * @param string $mine * @param string $yours * @param string &$result + * @param string &$mergeAttemptResult * @return bool */ -function wfMerge( $old, $mine, $yours, &$result ) { +function wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult = null ) { global $wgDiff3; # This check may also protect against code injection in @@ -2442,13 +2443,18 @@ function wfMerge( $old, $mine, $yours, &$result ) { $oldtextName, $yourtextName ); $handle = popen( $cmd, 'r' ); - if ( fgets( $handle, 1024 ) ) { - $conflict = true; - } else { - $conflict = false; - } + $mergeAttemptResult = ''; + do { + $data = fread( $handle, 8192 ); + if ( strlen( $data ) == 0 ) { + break; + } + $mergeAttemptResult .= $data; + } while ( true ); pclose( $handle ); + $conflict = $mergeAttemptResult !== ''; + # Merge differences $cmd = Shell::escape( $wgDiff3, '-a', '-e', '--merge', $mytextName, $oldtextName, $yourtextName ); diff --git a/includes/Preferences.php b/includes/Preferences.php index 2dd3e2d3b1..cab1e1f3e1 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -926,16 +926,16 @@ class Preferences { $defaultPreferences['rcfilters-wl-saved-queries'] = [ 'type' => 'api', ]; - $defaultPreferences['rcfilters-saved-queries-versionbackup'] = [ + // Override RCFilters preferences for RecentChanges 'limit' + $defaultPreferences['rcfilters-limit'] = [ 'type' => 'api', ]; - $defaultPreferences['rcfilters-wl-saved-queries-versionbackup'] = [ + $defaultPreferences['rcfilters-saved-queries-versionbackup'] = [ 'type' => 'api', ]; - $defaultPreferences['rcfilters-rclimit'] = [ + $defaultPreferences['rcfilters-wl-saved-queries-versionbackup'] = [ 'type' => 'api', ]; - if ( $config->get( 'RCWatchCategoryMembership' ) ) { $defaultPreferences['hidecategorization'] = [ 'type' => 'toggle', @@ -1534,6 +1534,14 @@ class Preferences { $formData[$pref] = $user->getOption( $pref, null, true ); } + // If the user changed the rclimit preference, also change the rcfilters-rclimit preference + if ( + isset( $formData['rclimit'] ) && + intval( $formData[ 'rclimit' ] ) !== $user->getIntOption( 'rclimit' ) + ) { + $formData['rcfilters-limit'] = $formData['rclimit']; + } + // Keep old preferences from interfering due to back-compat code, etc. $user->resetOptions( 'unused', $form->getContext() ); diff --git a/includes/Title.php b/includes/Title.php index d0d77e371e..b23bd5a364 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -108,7 +108,12 @@ class Title implements LinkTarget { /** @var array Array of groups allowed to edit this article */ public $mRestrictions = []; - /** @var string|bool */ + /** + * @var string|bool Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" + */ protected $mOldRestrictions = false; /** @var bool Cascade restrictions on this page to included templates and images? */ @@ -3046,8 +3051,10 @@ class Title implements LinkTarget { * Public for usage by LiquidThreads. * * @param array $rows Array of db result objects - * @param string $oldFashionedRestrictions Comma-separated list of page - * restrictions from page table (pre 1.10) + * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" */ public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) { $dbr = wfGetDB( DB_REPLICA ); @@ -3116,8 +3123,10 @@ class Title implements LinkTarget { /** * Load restrictions from the page_restrictions table * - * @param string $oldFashionedRestrictions Comma-separated list of page - * restrictions from page table (pre 1.10) + * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" */ public function loadRestrictions( $oldFashionedRestrictions = null ) { if ( $this->mRestrictionsLoaded ) { diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index a9e3d6accd..0e964bf5cc 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -154,7 +154,7 @@ class HistoryAction extends FormlessAction { # show deletion/move log if there is an entry LogEventsList::showLogExtract( $out, - [ 'delete', 'move' ], + [ 'delete', 'move', 'protect' ], $this->getTitle(), '', [ 'lim' => 10, diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 7766acd363..96c291c660 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -59,7 +59,7 @@ class ApiDelete extends ApiBase { // If change tagging was requested, check that the user is allowed to tag, // and the tags are valid - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$tagStatus->isOK() ) { $this->dieStatus( $tagStatus ); diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 94d6e97b24..26d4fd1e43 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -334,7 +334,7 @@ class ApiEditPage extends ApiBase { } // Apply change tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( $tagStatus->isOK() ) { $requestArray['wpChangeTags'] = implode( ',', $params['tags'] ); diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 71bda6d7e4..05684036e9 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -43,7 +43,7 @@ class ApiImageRotate extends ApiBase { ] ); // Check if user can add tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $this->getUser() ); if ( !$ableToTag->isOK() ) { $this->dieStatus( $ableToTag ); diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index a0f0a8dbdb..822711aa02 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -1,9 +1,5 @@ .@gmail.com" * * This program is free software; you can redistribute it and/or modify diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 419fd140d7..416fc7f6e4 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -1,7 +1,5 @@ @gmail.com" * Copyright © 2008 Brion Vibber * Copyright © 2014 Wikimedia Foundation and contributors @@ -382,6 +380,9 @@ class ApiOpenSearch extends ApiBase { } } +/** + * @ingroup API + */ class ApiOpenSearchFormatJson extends ApiFormatJson { private $warningsAsError = false; diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 5b0d86a7f6..14bd089929 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -64,7 +64,7 @@ class ApiOptions extends ApiBase { } $changes = []; - if ( count( $params['change'] ) ) { + if ( $params['change'] ) { foreach ( $params['change'] as $entry ) { $array = explode( '=', $entry, 2 ); $changes[$array[0]] = isset( $array[1] ) ? $array[1] : null; diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 315def049b..a084279a2b 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -136,12 +136,12 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } // Page protection filtering - if ( count( $params['prtype'] ) || $params['prexpiry'] != 'all' ) { + if ( $params['prtype'] || $params['prexpiry'] != 'all' ) { $this->addTables( 'page_restrictions' ); $this->addWhere( 'page_id=pr_page' ); $this->addWhere( "pr_expiry > {$db->addQuotes( $db->timestamp() )} OR pr_expiry IS NULL" ); - if ( count( $params['prtype'] ) ) { + if ( $params['prtype'] ) { $this->addWhereFld( 'pr_type', $params['prtype'] ); if ( isset( $params['prlevel'] ) ) { diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 54be254d59..830cc48477 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -138,7 +138,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { if ( count( $this->cont ) >= 2 ) { $op = $this->params['dir'] == 'descending' ? '<' : '>'; - if ( count( $this->params['namespace'] ) > 1 ) { + if ( $this->params['namespace'] !== null && count( $this->params['namespace'] ) > 1 ) { $this->addWhere( "{$this->bl_from_ns} $op {$this->cont[0]} OR " . "({$this->bl_from_ns} = {$this->cont[0]} AND " . @@ -160,7 +160,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $this->addOption( 'LIMIT', $this->params['limit'] + 1 ); $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' ); $orderBy = []; - if ( count( $this->params['namespace'] ) > 1 ) { + if ( $this->params['namespace'] !== null && count( $this->params['namespace'] ) > 1 ) { $orderBy[] = $this->bl_from_ns . $sort; } $orderBy[] = $this->bl_from . $sort; @@ -246,7 +246,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $where = "{$this->bl_from} $op= {$this->cont[5]}"; // Don't bother with namespace, title, or from_namespace if it's // otherwise constant in the where clause. - if ( count( $this->params['namespace'] ) > 1 ) { + if ( $this->params['namespace'] !== null && count( $this->params['namespace'] ) > 1 ) { $where = "{$this->bl_from_ns} $op {$this->cont[4]} OR " . "({$this->bl_from_ns} = {$this->cont[4]} AND ($where))"; } @@ -278,7 +278,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { if ( count( $allRedirDBkey ) > 1 ) { $orderBy[] = $this->bl_title . $sort; } - if ( count( $this->params['namespace'] ) > 1 ) { + if ( $this->params['namespace'] !== null && count( $this->params['namespace'] ) > 1 ) { $orderBy[] = $this->bl_from_ns . $sort; } $orderBy[] = $this->bl_from . $sort; diff --git a/includes/api/ApiQueryBacklinksprop.php b/includes/api/ApiQueryBacklinksprop.php index 1db15f87e8..ef02d095c8 100644 --- a/includes/api/ApiQueryBacklinksprop.php +++ b/includes/api/ApiQueryBacklinksprop.php @@ -161,7 +161,9 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase { } } else { $this->addWhereFld( "{$p}_from_namespace", $params['namespace'] ); - if ( !empty( $settings['from_namespace'] ) && count( $params['namespace'] ) > 1 ) { + if ( !empty( $settings['from_namespace'] ) + && $params['namespace'] !== null && count( $params['namespace'] ) > 1 + ) { $sortby["{$p}_from_namespace"] = 'int'; } } diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 6987dfb13f..8e9b1b4973 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -262,9 +262,7 @@ abstract class ApiQueryBase extends ApiBase { * @param string|string[] $value Value; ignored if null or empty array; */ protected function addWhereFld( $field, $value ) { - // Use count() to its full documented capabilities to simultaneously - // test for null, empty array or empty countable object - if ( count( $value ) ) { + if ( $value !== null && count( $value ) ) { $this->where[$field] = $value; } } diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index c570ec997e..e3265d1cdc 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -97,7 +97,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { // how to have efficient subcategory access :-) ~~~~ (oh well, domas) $miser_ns = []; if ( $this->getConfig()->get( 'MiserMode' ) ) { - $miser_ns = $params['namespace']; + $miser_ns = $params['namespace'] ?: []; } else { $this->addWhereFld( 'page_namespace', $params['namespace'] ); } diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 6c29b6030f..43f41312fd 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -61,7 +61,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { $miser_ns = []; if ( $this->getConfig()->get( 'MiserMode' ) ) { - $miser_ns = $params['namespace']; + $miser_ns = $params['namespace'] ?: []; } else { $this->addWhereFld( 'page_namespace', $params['namespace'] ); } diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 508bdf3f9d..119db3e6a9 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -114,7 +114,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { } } elseif ( $params['namespace'] ) { $this->addWhereFld( $this->prefix . '_namespace', $params['namespace'] ); - $multiNS = count( $params['namespace'] ) !== 1; + $multiNS = $params['namespace'] === null || count( $params['namespace'] ) !== 1; } if ( !is_null( $params['continue'] ) ) { diff --git a/includes/api/ApiRevisionDelete.php b/includes/api/ApiRevisionDelete.php index 9d71a7db7e..5a51b2843a 100644 --- a/includes/api/ApiRevisionDelete.php +++ b/includes/api/ApiRevisionDelete.php @@ -47,7 +47,7 @@ class ApiRevisionDelete extends ApiBase { } // Check if user can add tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$ableToTag->isOK() ) { $this->dieStatus( $ableToTag ); diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 76b6cc6722..4ca2955079 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -52,7 +52,7 @@ class ApiRollback extends ApiBase { // If change tagging was requested, check that the user is allowed to tag, // and the tags are valid - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$tagStatus->isOK() ) { $this->dieStatus( $tagStatus ); diff --git a/includes/api/ApiRsd.php b/includes/api/ApiRsd.php index fdc62a8ea9..f20d1c6c8b 100644 --- a/includes/api/ApiRsd.php +++ b/includes/api/ApiRsd.php @@ -3,8 +3,6 @@ /** * API for MediaWiki 1.17+ * - * Created on October 26, 2010 - * * Copyright © 2010 Bryan Tong Minh and Brion Vibber * * This program is free software; you can redistribute it and/or modify diff --git a/includes/api/ApiSetPageLanguage.php b/includes/api/ApiSetPageLanguage.php index 7e3f1acf96..54394a57d9 100644 --- a/includes/api/ApiSetPageLanguage.php +++ b/includes/api/ApiSetPageLanguage.php @@ -73,7 +73,7 @@ class ApiSetPageLanguage extends ApiBase { // If change tagging was requested, check that the user is allowed to tag, // and the tags are valid - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$tagStatus->isOK() ) { $this->dieStatus( $tagStatus ); diff --git a/includes/api/ApiTag.php b/includes/api/ApiTag.php index 76c676293f..9304c2b414 100644 --- a/includes/api/ApiTag.php +++ b/includes/api/ApiTag.php @@ -37,7 +37,7 @@ class ApiTag extends ApiBase { } // Check if user can add tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$ableToTag->isOk() ) { $this->dieStatus( $ableToTag ); diff --git a/includes/api/ApiUsageException.php b/includes/api/ApiUsageException.php index 4196add2c3..c200dcba6f 100644 --- a/includes/api/ApiUsageException.php +++ b/includes/api/ApiUsageException.php @@ -16,7 +16,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @defgroup API API */ /** diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index 2a364d9756..3813aba7a1 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -64,14 +64,15 @@ class ApiUserrights extends ApiBase { } else { $expiry = [ 'infinity' ]; } - if ( count( $expiry ) !== count( $params['add'] ) ) { + $add = (array)$params['add']; + if ( count( $expiry ) !== count( $add ) ) { if ( count( $expiry ) === 1 ) { - $expiry = array_fill( 0, count( $params['add'] ), $expiry[0] ); + $expiry = array_fill( 0, count( $add ), $expiry[0] ); } else { $this->dieWithError( [ 'apierror-toofewexpiries', count( $expiry ), - count( $params['add'] ) + count( $add ) ] ); } } @@ -79,7 +80,7 @@ class ApiUserrights extends ApiBase { // Validate the expiries $groupExpiries = []; foreach ( $expiry as $index => $expiryValue ) { - $group = $params['add'][$index]; + $group = $add[$index]; $groupExpiries[$group] = UserrightsPage::expiryToTimestamp( $expiryValue ); if ( $groupExpiries[$group] === false ) { @@ -109,7 +110,7 @@ class ApiUserrights extends ApiBase { $r['user'] = $user->getName(); $r['userid'] = $user->getId(); list( $r['added'], $r['removed'] ) = $form->doSaveUserGroups( - $user, (array)$params['add'], (array)$params['remove'], + $user, (array)$add, (array)$params['remove'], $params['reason'], $tags, $groupExpiries ); diff --git a/includes/api/i18n/fr.json b/includes/api/i18n/fr.json index c5ab016356..a56b42f083 100644 --- a/includes/api/i18n/fr.json +++ b/includes/api/i18n/fr.json @@ -254,6 +254,8 @@ "apihelp-import-extended-description": "Noter que le POST HTTP doit être effectué comme un import de fichier (c’est-à-dire en utilisant multipart/form-data) lors de l’envoi d’un fichier pour le paramètre xml.", "apihelp-import-param-summary": "Résumé de l’importation de l’entrée de journal.", "apihelp-import-param-xml": "Fichier XML téléversé.", + "apihelp-import-param-interwikiprefix": "Pour les importations téléchargées : le préfixe interwiki à appliquer aux noms d’utilisateur inconnus (et aux utilisateurs connus si $1assignknownusers est positionné).", + "apihelp-import-param-assignknownusers": "Affecter les modifications aux utilisateurs locaux quand l’utilisateur nommé existe localement.", "apihelp-import-param-interwikisource": "Pour les importations interwiki : wiki depuis lequel importer.", "apihelp-import-param-interwikipage": "Pour les importations interwiki : page à importer.", "apihelp-import-param-fullhistory": "Pour les importations interwiki : importer tout l’historique, et pas seulement la version courante.", diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 7cabd405cc..c2d0de1dc9 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -308,7 +308,6 @@ class RequestContext implements IContextSource, MutableContext { # Validate $code if ( !$code || !Language::isValidCode( $code ) || $code === 'qqq' ) { - wfDebug( "Invalid user language code\n" ); $code = $wgLanguageCode; } diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php index 7fafc0ebca..301c4f3b7e 100644 --- a/includes/deferred/CdnCacheUpdate.php +++ b/includes/deferred/CdnCacheUpdate.php @@ -18,7 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @ingroup Cache */ use Wikimedia\Assert\Assert; diff --git a/includes/gallery/PackedOverlayImageGallery.php b/includes/gallery/PackedOverlayImageGallery.php index db8ce68b9a..0a5a457fea 100644 --- a/includes/gallery/PackedOverlayImageGallery.php +++ b/includes/gallery/PackedOverlayImageGallery.php @@ -1,8 +1,5 @@ mPlaceholder = $this->getMessage( $params['placeholder-message'] )->parse(); + $this->mPlaceholder = $this->getMessage( $params['placeholder-message'] )->text(); } elseif ( isset( $params['placeholder'] ) ) { $this->mPlaceholder = $params['placeholder']; } diff --git a/includes/htmlform/fields/HTMLTextField.php b/includes/htmlform/fields/HTMLTextField.php index 1c5a43ddad..b2e4f2a559 100644 --- a/includes/htmlform/fields/HTMLTextField.php +++ b/includes/htmlform/fields/HTMLTextField.php @@ -31,7 +31,7 @@ class HTMLTextField extends HTMLFormField { parent::__construct( $params ); if ( isset( $params['placeholder-message'] ) ) { - $this->mPlaceholder = $this->getMessage( $params['placeholder-message'] )->parse(); + $this->mPlaceholder = $this->getMessage( $params['placeholder-message'] )->text(); } elseif ( isset( $params['placeholder'] ) ) { $this->mPlaceholder = $params['placeholder']; } diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index bffc1a9b14..1424f33637 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -559,6 +559,7 @@ class WikiImporter { /** * Primary entry point + * @throws Exception * @throws MWException * @return bool */ @@ -860,6 +861,7 @@ class WikiImporter { /** * @param array $pageInfo * @param array $revisionInfo + * @throws MWException * @return bool|mixed */ private function processRevision( $pageInfo, $revisionInfo ) { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index bdaeaca86c..b4ef49d7c6 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -185,7 +185,7 @@ class LocalSettingsGenerator { $jsonFile = 'skin.json'; $function = 'wfLoadSkin'; } else { - throw new InvalidArgumentException( '$dir was not "extensions" or "skins' ); + throw new InvalidArgumentException( '$dir was not "extensions" or "skins"' ); } $encName = self::escapePhpString( $name ); diff --git a/includes/installer/PhpBugTests.php b/includes/installer/PhpBugTests.php index d412216aaa..4e1e365dbf 100644 --- a/includes/installer/PhpBugTests.php +++ b/includes/installer/PhpBugTests.php @@ -18,9 +18,11 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @defgroup PHPBugTests PHP known bugs tests */ +/** + * @defgroup PHPBugTests PHP known bugs tests + */ /** * Test for PHP+libxml2 bug which breaks XML input subtly with certain versions. * Known fixed with PHP 5.2.9 + libxml2-2.7.3 diff --git a/includes/installer/i18n/ckb.json b/includes/installer/i18n/ckb.json index 3bfa8a6f54..20f2f24bd2 100644 --- a/includes/installer/i18n/ckb.json +++ b/includes/installer/i18n/ckb.json @@ -4,7 +4,8 @@ "Asoxor", "Calak", "Muhammed taha", - "Lost Whispers" + "Lost Whispers", + "Épine" ] }, "config-desc": "دامەزرێنەرەکە بۆ میدیاویکی", diff --git a/includes/installer/i18n/fr.json b/includes/installer/i18n/fr.json index 2bfe36f574..0988546899 100644 --- a/includes/installer/i18n/fr.json +++ b/includes/installer/i18n/fr.json @@ -28,7 +28,8 @@ "C13m3n7", "The RedBurn", "Trial", - "Tinss" + "Tinss", + "Thibaut120094" ] }, "config-desc": "Le programme d’installation de MediaWiki", @@ -68,7 +69,7 @@ "config-help-restart": "Voulez-vous effacer toutes les données enregistrées que vous avez entrées et relancer le processus d'installation ?", "config-restart": "Oui, le relancer", "config-welcome": "=== Vérifications liées à l’environnement ===\nDes vérifications de base vont maintenant être effectuées pour voir si cet environnement est adapté à l’installation de MediaWiki.\nRappelez-vous d’inclure ces informations si vous recherchez de l’aide sur la manière de terminer l’installation.", - "config-copyright": "=== Droit d’auteur et conditions ===\n\n$1\n\nCe programme est un logiciel gratuit : vous pouvez le redistribuer ou le modifier selon les termes de la Licence Publique Générale GNU telle que publiée par la Free Software Foundation (version 2 de la Licence, ou, à votre choix, toute version ultérieure).\n\nCe programme est distribué dans l’espoir qu’il sera utile, mais '''sans aucune garantie''' : sans même les garanties implicites de '''commercialisabilité''' ou d’'''adéquation à un usage particulier'''.\nVoir la Licence Publique Générale GNU pour plus de détails.\n\nVous devriez avoir reçu une copie de la Licence Publique Générale GNU avec ce programme ; dans le cas contraire, écrivez à la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ou [http://www.gnu.org/copyleft/gpl.html lisez-la en ligne].", + "config-copyright": "=== Droit d’auteur et conditions ===\n\n$1\n\nCe programme est un logiciel libre : vous pouvez le redistribuer ou le modifier selon les termes de la Licence Publique Générale GNU telle que publiée par la Free Software Foundation (version 2 de la Licence, ou, à votre choix, toute version ultérieure).\n\nCe programme est distribué dans l’espoir qu’il sera utile, mais '''sans aucune garantie''' : sans même les garanties implicites de '''commercialisabilité''' ou d’'''adéquation à un usage particulier'''.\nVoir la Licence Publique Générale GNU pour plus de détails.\n\nVous devriez avoir reçu une copie de la Licence Publique Générale GNU avec ce programme ; dans le cas contraire, écrivez à la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ou [http://www.gnu.org/copyleft/gpl.html lisez-la en ligne].", "config-sidebar": "* [https://www.mediawiki.org Accueil MediaWiki]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents Guide de l’utilisateur]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents Guide de l’administrateur]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ FAQ]\n----\n* Lisez-moi\n* Notes de publication\n* Copie\n* Mise à jour", "config-env-good": "L’environnement a été vérifié.\nVous pouvez installer MediaWiki.", "config-env-bad": "L’environnement a été vérifié.\nVous ne pouvez pas installer MediaWiki.", @@ -333,6 +334,7 @@ "config-install-mainpage-failed": "Impossible d’insérer la page principale : $1", "config-install-done": "Félicitations!\nVous avez installé MediaWiki.\n\nLe programme d'installation a généré un fichier LocalSettings.php. Il contient tous les paramètres de votre configuration.\n\nVous devrez le télécharger et le mettre à la racine de votre installation wiki (dans le même répertoire que index.php). Le téléchargement devrait démarrer automatiquement.\n\nSi le téléchargement n'a pas été proposé, ou que vous l'avez annulé, vous pouvez redémarrer le téléchargement en cliquant ce lien :\n\n$3\n\nNote : Si vous ne le faites pas maintenant, ce fichier de configuration généré ne sera pas disponible plus tard si vous quittez l'installation sans le télécharger.\n\nLorsque c'est fait, vous pouvez [$2 accéder à votre wiki] .", "config-install-done-path": "Félicitations !\nVous avez installé MédiaWiki.\n\nL’installeur a généré un fichier LocalSettings.php.\nIl contient toute votre configuration.\n\nVous devez le télécharger et le mettre dans $4. Le téléchargement devrait avoir démarré automatiquement.\n\nSi le téléchargement n’a pas été proposé ou si vous l’avez annulé, vous pouvez le redémarrer en cliquant sur le lien ci-dessous :\n\n$3\n\nNote : Si vous ne le faites pas maintenant, ce fichier de configuration généré ne sera plus disponible ultérieurement si vous quittez l’installation sans le télécharger.\n\nUne fois ceci fait, vous pouvez [$2 entrer dans votre wiki].", + "config-install-success": "MédiaWiki a bien été installé. Vous pouvez maintenant\nvisiter <$1$2> pour voir votre wiki.\nSi vous avez des questions, consultez notre liste de questions fréquemment posées :\n ou utilisez un des\nforums de soutien liés sur cette page.", "config-download-localsettings": "Télécharger LocalSettings.php", "config-help": "aide", "config-help-tooltip": "cliquer pour agrandir", diff --git a/includes/installer/i18n/nb.json b/includes/installer/i18n/nb.json index 1325d9df3b..c271a90ad3 100644 --- a/includes/installer/i18n/nb.json +++ b/includes/installer/i18n/nb.json @@ -52,7 +52,7 @@ "config-copyright": "=== Opphavsrett og vilkår ===\n\n$1\n\nMediaWiki er fri programvare; du kan redistribuere det og/eller modifisere det under betingelsene i GNU General Public License som publisert av Free Software Foundation; enten versjon 2 av lisensen, eller (etter eget valg) enhver senere versjon.\n\nDette programmet er distribuert i håp om at det vil være nyttig, men '''uten noen garanti'''; ikke engang implisitt garanti av '''salgbarhet''' eller '''egnethet for et bestemt formål'''.\nSe GNU General Public License for flere detaljer.\n\nDu skal ha mottatt en kopi av GNU General Public License sammen med dette programmet; hvis ikke, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA eller [http://www.gnu.org/copyleft/gpl.html les det på nettet].", "config-sidebar": "* [https://www.mediawiki.org MediaWiki hjem]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents Brukerguide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents Administratorguide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ OSS]\n----\n* Les meg\n* Utgivelsesnotater\n* Kopiering\n* Oppgradering", "config-env-good": "Miljøet har blitt sjekket.\nDu kan installere MediaWiki.", - "config-env-bad": "Miljøet har blitt sjekket.\nDu kan installere MediaWiki.", + "config-env-bad": "Miljøet har blitt sjekket.\nDu kan ikke installere MediaWiki.", "config-env-php": "PHP $1 er installert.", "config-env-hhvm": "HHVM $1 er installert.", "config-unicode-using-intl": "Bruker [http://pecl.php.net/intl intl PECL-utvidelsen] for Unicode-normalisering.", diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php index d844795143..b62b83c666 100644 --- a/includes/jobqueue/JobSpecification.php +++ b/includes/jobqueue/JobSpecification.php @@ -18,7 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @ingroup JobQueue */ /** diff --git a/includes/jobqueue/aggregator/JobQueueAggregator.php b/includes/jobqueue/aggregator/JobQueueAggregator.php index f26beee4bd..433de93af7 100644 --- a/includes/jobqueue/aggregator/JobQueueAggregator.php +++ b/includes/jobqueue/aggregator/JobQueueAggregator.php @@ -158,6 +158,9 @@ abstract class JobQueueAggregator { } } +/** + * @ingroup JobQueue + */ class JobQueueAggregatorNull extends JobQueueAggregator { protected function doNotifyQueueEmpty( $wiki, $type ) { return true; diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index ddf5d354c0..8f2c72a141 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -387,13 +387,13 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { $purgeValues = []; foreach ( $timeKeys as $timeKey ) { $purge = isset( $wrappedValues[$timeKey] ) - ? self::parsePurgeValue( $wrappedValues[$timeKey] ) + ? $this->parsePurgeValue( $wrappedValues[$timeKey] ) : false; if ( $purge === false ) { // Key is not set or invalid; regenerate $newVal = $this->makePurgeValue( $now, self::HOLDOFF_TTL ); $this->cache->add( $timeKey, $newVal, self::CHECK_KEY_TTL ); - $purge = self::parsePurgeValue( $newVal ); + $purge = $this->parsePurgeValue( $newVal ); } $purgeValues[] = $purge; } @@ -677,10 +677,9 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { $rawValues = $this->cache->getMulti( $rawKeys ); $rawValues += array_fill_keys( $rawKeys, false ); - $index = 0; $times = []; foreach ( $rawKeys as $key => $rawKey ) { - $purge = self::parsePurgeValue( $rawValues[$rawKey] ); + $purge = $this->parsePurgeValue( $rawValues[$rawKey] ); if ( $purge !== false ) { $time = $purge[self::FLD_TIME]; } else { @@ -1477,7 +1476,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @return bool Success * @since 1.28 */ - public function reap( $key, $purgeTimestamp, &$isStale = false ) { + final public function reap( $key, $purgeTimestamp, &$isStale = false ) { $minAsOf = $purgeTimestamp + self::HOLDOFF_TTL; $wrapped = $this->cache->get( self::VALUE_KEY_PREFIX . $key ); if ( is_array( $wrapped ) && $wrapped[self::FLD_TIME] < $minAsOf ) { @@ -1506,7 +1505,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @return bool Success * @since 1.28 */ - public function reapCheckKey( $key, $purgeTimestamp, &$isStale = false ) { + final public function reapCheckKey( $key, $purgeTimestamp, &$isStale = false ) { $purge = $this->parsePurgeValue( $this->cache->get( self::TIME_KEY_PREFIX . $key ) ); if ( $purge && $purge[self::FLD_TIME] < $purgeTimestamp ) { $isStale = true; @@ -1552,7 +1551,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @return ArrayIterator Iterator yielding (cache key => entity ID) in $entities order * @since 1.28 */ - public function makeMultiKeys( array $entities, callable $keyFunc ) { + final public function makeMultiKeys( array $entities, callable $keyFunc ) { $map = []; foreach ( $entities as $entity ) { $map[$keyFunc( $entity, $this )] = $entity; @@ -1625,7 +1624,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @param bool $enabled Whether to enable interim caching * @since 1.31 */ - public function useInterimHoldOffCaching( $enabled ) { + final public function useInterimHoldOffCaching( $enabled ) { $this->useInterimHoldOffCaching = $enabled; } @@ -1719,7 +1718,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @return int Number of warmup key cache misses last round * @since 1.30 */ - public function getWarmupKeyMisses() { + final public function getWarmupKeyMisses() { return $this->warmupKeyMisses; } @@ -1926,7 +1925,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { */ protected function unwrap( $wrapped, $now ) { // Check if the value is a tombstone - $purge = self::parsePurgeValue( $wrapped ); + $purge = $this->parsePurgeValue( $wrapped ); if ( $purge !== false ) { // Purged values should always have a negative current $ttl $curTTL = min( $purge[self::FLD_TIME] - $now, self::TINY_NEGATIVE ); @@ -1994,7 +1993,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { * @return array|bool Array containing a UNIX timestamp (float) and holdoff period (integer), * or false if value isn't a valid purge value */ - protected static function parsePurgeValue( $value ) { + protected function parsePurgeValue( $value ) { if ( !is_string( $value ) ) { return false; } diff --git a/includes/libs/rdbms/database/DatabaseMysqlBase.php b/includes/libs/rdbms/database/DatabaseMysqlBase.php index e0ff475959..305a056900 100644 --- a/includes/libs/rdbms/database/DatabaseMysqlBase.php +++ b/includes/libs/rdbms/database/DatabaseMysqlBase.php @@ -1044,7 +1044,7 @@ abstract class DatabaseMysqlBase extends Database { return true; } - $this->queryLogger->warning( __METHOD__ . " failed to acquire lock '{lockname}'", + $this->queryLogger->info( __METHOD__ . " failed to acquire lock '{lockname}'", [ 'lockname' => $lockName ] ); return false; diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index 6047fb033d..85b3481fe3 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -1,10 +1,5 @@ xmlParser ); $offset = xml_get_current_byte_index( $this->xmlParser ); - $this->logger->warning( + $this->logger->info( '{method} : Error reading XMP content: {error} ' . '(line: {line} column: {column} byte offset: {offset})', [ diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 666196585a..b008a22688 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -740,8 +740,13 @@ class FormatMetadata extends ContextSource { case 'Software': if ( is_array( $val ) ) { - // if its a software, version array. - $val = $this->msg( 'exif-software-version-value', $val[0], $val[1] )->text(); + if ( count( $val ) > 1 ) { + // if its a software, version array. + $val = $this->msg( 'exif-software-version-value', $val[0], $val[1] )->text(); + } else { + // https://phabricator.wikimedia.org/T178130 + $val = $this->exifMsg( $tag, '', $val[0] ); + } } else { $val = $this->exifMsg( $tag, '', $val ); } diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 2b138930d1..10be97a5cd 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -511,8 +511,6 @@ class SvgHandler extends ImageHandler { } elseif ( $name == 'lang' ) { // Validate $code if ( $value === '' || !Language::isValidCode( $value ) ) { - wfDebug( "Invalid user language code\n" ); - return false; } diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 07432c0b24..67d2346013 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -342,14 +342,15 @@ class ObjectCache { $params['channels'][$action] = $channel; } $params['cache'] = self::newFromParams( $params['store'] ); - $params['stats'] = $services->getStatsdDataFactory(); if ( isset( $params['loggroup'] ) ) { $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] ); } else { $params['logger'] = LoggerFactory::getInstance( 'objectcache' ); } - // Let pre-emptive refreshes happen post-send on HTTP requests if ( !$wgCommandLineMode ) { + // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385) + $params['stats'] = $services->getStatsdDataFactory(); + // Let pre-emptive refreshes happen post-send on HTTP requests $params['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ]; } $class = $params['class']; diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index 76ff41bc36..1dcdc65ff2 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -251,13 +251,14 @@ class ImagePage extends Article { protected function makeMetadataTable( $metadata ) { $r = "