From 945f8870d342b4ac4d7183911c67e14a03ced5ec Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Mon, 16 Oct 2017 15:30:49 -0700 Subject: [PATCH] Shell\Command: Better walltime fallback Previously, it assumed that the only way times could be overridden is to reduce the limits - which isn't the case for video transcoding. Bug: T178314 Change-Id: I492a44f280a36ee666e9963788caac2bbc6bc6f3 --- includes/shell/Command.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/shell/Command.php b/includes/shell/Command.php index d5a1bb3f6c..4fc282c8c4 100644 --- a/includes/shell/Command.php +++ b/includes/shell/Command.php @@ -135,6 +135,11 @@ class Command { * @return $this */ public function limits( array $limits ) { + if ( !isset( $limits['walltime'] ) && isset( $limits['time'] ) ) { + // Emulate the behavior of old wfShellExec() where walltime fell back on time + // if the latter was overridden and the former wasn't + $limits['walltime'] = $limits['time']; + } $this->limits = $limits + $this->limits; return $this; @@ -227,8 +232,6 @@ class Command { if ( is_executable( '/bin/bash' ) ) { $time = intval( $this->limits['time'] ); $wallTime = intval( $this->limits['walltime'] ); - // for b/c, wall time falls back to time - $wallTime = min( $time, $wallTime ); $mem = intval( $this->limits['memory'] ); $filesize = intval( $this->limits['filesize'] ); -- 2.20.1