Skip to content

Commit d48e8f9

Browse files
author
Matthias Lill
committed
allow to set memory limit and execution time via config, off by default
1 parent c14465c commit d48e8f9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Config/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
* PHP 5
66
* CakePHP 2
77
*
8+
* @todo place in own config file Config/databaseblobfile.php
89
*/
910
Configure::write(
1011
'DatabaseBlobFile',
1112
array(
1213
'cdn_host' => '',
14+
'memory_limit' => null, // eg '128M' or '1024M'
15+
'execution_time' => null, // eg 300
1316
'sizes' => array(
1417
'md1' => array('resizewidth',67),
1518
'md2' => array('resizewidth',165),

Lib/BlobFileHandler.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ class BlobFileHandler {
55
public $resource;
66
public $resourceInfo;
77

8+
public function __construct() {
9+
10+
/**
11+
* processing images may need more resources than an avereage page request
12+
*/
13+
if (Configure::read('DatabaseBlobFile.memory_limit')) {
14+
ini_set('memory_limit', Configure::read('DatabaseBlobFile.memory_limit'));
15+
}
16+
17+
if (Configure::read('DatabaseBlobFile.execution_time')) {
18+
set_time_limit(Configure::read('DatabaseBlobFile.execution_time'));
19+
}
20+
21+
}
822

923
/**
1024
* add a message to stack (for outside checking)

0 commit comments

Comments
 (0)