$targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
if ( $targetUrl != $request->getFullRequestURL() ) {
- $output->setSquidMaxage( 1200 );
+ $output->setCdnMaxage( 1200 );
$output->redirect( $targetUrl, '301' );
return true;
}
$action = Action::factory( $act, $page, $this->context );
if ( $action instanceof Action ) {
- # Let Squid cache things if we can purge them.
+ # Let CDN cache things if we can purge them.
if ( $this->config->get( 'UseSquid' ) &&
in_array(
// Use PROTO_INTERNAL because that's what getSquidURLs() uses
$requestTitle->getSquidURLs()
)
) {
- $output->setSquidMaxage( $this->config->get( 'SquidMaxage' ) );
+ $output->setCdnMaxage( $this->config->get( 'SquidMaxage' ) );
}
$action->show();
// Either all DBs should commit or none
ignore_user_abort( true );
- // Commit all changes and record ChronologyProtector positions
+ $config = $context->getConfig();
+
$factory = wfGetLBFactory();
+ // Check if any transaction was too big
+ $limit = $config->get( 'MaxUserDBWriteDuration' );
+ $factory->forEachLB( function ( LoadBalancer $lb ) use ( $limit ) {
+ $lb->forEachOpenConnection( function ( IDatabase $db ) use ( $limit ) {
+ $time = $db->pendingWriteQueryDuration();
+ if ( $limit > 0 && $time > $limit ) {
+ throw new DBTransactionError(
+ $db,
+ wfMessage( 'transaction-duration-limit-exceeded', $time, $limit )->plain()
+ );
+ }
+ } );
+ } );
+ // Commit all changes
$factory->commitMasterChanges();
+ // Record ChronologyProtector positions
$factory->shutdown();
wfDebug( __METHOD__ . ': all transactions committed' );
// Set a cookie to tell all CDN edge nodes to "stick" the user to the
// DC that handles this POST request (e.g. the "master" data center)
$request = $context->getRequest();
- $config = $context->getConfig();
if ( $request->wasPosted() && $factory->hasOrMadeRecentMasterChanges() ) {
$expires = time() + $config->get( 'DataCenterUpdateStickTTL' );
$request->response()->setCookie( 'UseDC', 'master', $expires, array( 'prefix' => '' ) );