-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
60 lines (44 loc) · 1.4 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/app/Utils/Constants.php';
require __DIR__ . '/app/Config/config.php';
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
set_time_limit(0);
ini_set('post_max_size', $details['POST_MAX_SIZE']);
ini_set('upload_max_filesize', $details['UPLOAD_MAX_FILESIZE']);
$isDevMode = false;
if ($details['APP_DEBUG']) {
umask(0000);
ini_set('display_errors', '1');
error_reporting(E_ALL);
// Create a simple "default" Doctrine ORM configuration for Annotations
$isDevMode = true;
}
$paths = [
__DIR__. '/app/Entity'
];
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, null, null, false);
function get_value_in_bytes($value){
$attr_value = trim($value);
if ($attr_value !== '') {
$type_byte = strtolower($attr_value[strlen($attr_value) - 1]);
} else {
return $attr_value;
}
$v = (int) substr($attr_value, 0, -1);
switch ($type_byte) {
case 'g': $v *= 1024*1024*1024; break;
case 'm': $v *= 1024*1024; break;
case 'k': $v *= 1024; break;
}
return $v;
}
global $entityManager;
global $maxUploadSize, $maxPostSize;
$maxPostSize = ini_get('post_max_size');
$maxUploadSize = ini_get('upload_max_filesize');
$entityManager = EntityManager::create($details['db'], $config);
if (!defined('STDIN')) {
require __DIR__ . '/bootstrap.php';
}