X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=8aa8cb7db79b5a81c0801fdd5f8511d8d7966d5e;hb=2c4add9c74970f6614e9792bb50a2192dc6b635f;hp=4555f16d9b235de33066dfc39eb83965478c6ea3;hpb=19fe074b654f874d7cdfb1d2622f2489b8bdfaa0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 4555f16d9b..8aa8cb7db7 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1773,12 +1773,13 @@ class Title implements LinkTarget { * * @param array $query * @param bool $query2 - * @param string $proto Protocol to use; setting this will cause a full URL to be used + * @param string|int|bool $proto A PROTO_* constant on how the URL should be expanded, + * or false (default) for no expansion * @see self::getLocalURL for the arguments. * @return string The URL */ - public function getLinkURL( $query = '', $query2 = false, $proto = PROTO_RELATIVE ) { - if ( $this->isExternal() || $proto !== PROTO_RELATIVE ) { + public function getLinkURL( $query = '', $query2 = false, $proto = false ) { + if ( $this->isExternal() || $proto !== false ) { $ret = $this->getFullURL( $query, $query2, $proto ); } elseif ( $this->getPrefixedText() === '' && $this->hasFragment() ) { $ret = $this->getFragmentForURL(); @@ -4366,19 +4367,23 @@ class Title implements LinkTarget { return true; // avoid gap locking if we know it's not there } - $method = __METHOD__; - $dbw = wfGetDB( DB_MASTER ); $conds = $this->pageCond(); - $dbw->onTransactionIdle( function () use ( $dbw, $conds, $method, $purgeTime ) { - $dbTimestamp = $dbw->timestamp( $purgeTime ?: time() ); - - $dbw->update( - 'page', - [ 'page_touched' => $dbTimestamp ], - $conds + [ 'page_touched < ' . $dbw->addQuotes( $dbTimestamp ) ], - $method - ); - } ); + DeferredUpdates::addUpdate( + new AutoCommitUpdate( + wfGetDB( DB_MASTER ), + __METHOD__, + function ( IDatabase $dbw, $fname ) use ( $conds, $purgeTime ) { + $dbTimestamp = $dbw->timestamp( $purgeTime ?: time() ); + $dbw->update( + 'page', + [ 'page_touched' => $dbTimestamp ], + $conds + [ 'page_touched < ' . $dbw->addQuotes( $dbTimestamp ) ], + $fname + ); + } + ), + DeferredUpdates::PRESEND + ); return true; } @@ -4554,10 +4559,10 @@ class Title implements LinkTarget { * @return bool */ public function canUseNoindex() { - global $wgContentNamespaces, $wgExemptFromUserRobotsControl; + global $wgExemptFromUserRobotsControl; $bannedNamespaces = is_null( $wgExemptFromUserRobotsControl ) - ? $wgContentNamespaces + ? MWNamespace::getContentNamespaces() : $wgExemptFromUserRobotsControl; return !in_array( $this->mNamespace, $bannedNamespaces );