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

Commit

Permalink
Wrap set_time_limit for instances when it is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 30, 2014
1 parent 6b0c3b3 commit 0dce3c9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Cont
*/
public function preDispatch()
{
set_time_limit(0);
UtilityComponent::setTimeLimit(0);
// Init the translater

$translate = new Zend_Translate('csv', BASE_PATH.'/core/translation/fr-main.csv', 'en');
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function indexAction()
$this->requireAdminPrivileges();

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

Expand Down
10 changes: 9 additions & 1 deletion core/controllers/components/UtilityComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,12 @@ public static function isPortListening($port, $host = 'localhost')
}
return false;
}
} // end class

/** Limits the maximum execution time. */
public static function setTimeLimit($seconds)
{
UtilityComponent::beginIgnoreWarnings();
set_time_limit($seconds);
UtilityComponent::endIgnoreWarnings();
}
}
2 changes: 1 addition & 1 deletion modules/packages/controllers/components/ApiComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private function _getUser($args)
*/
private function _readUploadedFile($prefix)
{
set_time_limit(0);
UtilityComponent::setTimeLimit(0);
$inputfile = 'php://input';
$tmpfile = tempnam(UtilityComponent::getTempDirectory('misc'), $prefix);
$in = fopen($inputfile, 'rb');
Expand Down
4 changes: 2 additions & 2 deletions modules/pvw/controllers/ParaviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Pvw_ParaviewController extends Pvw_AppController
*/
public function startinstanceAction()
{
set_time_limit(30);
UtilityComponent::setTimeLimit(30);
$this->disableView();
$this->disableLayout();

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

0 comments on commit 0dce3c9

Please sign in to comment.