Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 0dce3c9

Browse files
author
Jamie Snape
committed
Wrap set_time_limit for instances when it is disabled
1 parent 6b0c3b3 commit 0dce3c9

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

core/GlobalController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Cont
4747
*/
4848
public function preDispatch()
4949
{
50-
set_time_limit(0);
50+
UtilityComponent::setTimeLimit(0);
5151
// Init the translater
5252

5353
$translate = new Zend_Translate('csv', BASE_PATH.'/core/translation/fr-main.csv', 'en');

core/controllers/ImportController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function indexAction()
270270
$this->requireAdminPrivileges();
271271

272272
// No time limit since import can take a long time
273-
set_time_limit(0);
273+
UtilityComponent::setTimeLimit(0);
274274
$this->view->title = $this->t("Import");
275275
$this->view->header = $this->t("Import server-side data");
276276

core/controllers/components/UtilityComponent.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,4 +735,12 @@ public static function isPortListening($port, $host = 'localhost')
735735
}
736736
return false;
737737
}
738-
} // end class
738+
739+
/** Limits the maximum execution time. */
740+
public static function setTimeLimit($seconds)
741+
{
742+
UtilityComponent::beginIgnoreWarnings();
743+
set_time_limit($seconds);
744+
UtilityComponent::endIgnoreWarnings();
745+
}
746+
}

modules/packages/controllers/components/ApiComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function _getUser($args)
5151
*/
5252
private function _readUploadedFile($prefix)
5353
{
54-
set_time_limit(0);
54+
UtilityComponent::setTimeLimit(0);
5555
$inputfile = 'php://input';
5656
$tmpfile = tempnam(UtilityComponent::getTempDirectory('misc'), $prefix);
5757
$in = fopen($inputfile, 'rb');

modules/pvw/controllers/ParaviewController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Pvw_ParaviewController extends Pvw_AppController
3838
*/
3939
public function startinstanceAction()
4040
{
41-
set_time_limit(30);
41+
UtilityComponent::setTimeLimit(30);
4242
$this->disableView();
4343
$this->disableLayout();
4444

@@ -109,7 +109,7 @@ public function startinstanceAction()
109109
*/
110110
public function instanceAction()
111111
{
112-
set_time_limit(30); //in case an exec call hangs for some odd reason
112+
UtilityComponent::setTimeLimit(30); //in case an exec call hangs for some odd reason
113113
// TODO just plug this into the restful stuff
114114
$this->disableLayout();
115115
$this->disableView();

0 commit comments

Comments
 (0)