Skip to content

Commit 7e5855f

Browse files
committed
Update loader.php
Libraries preloader minor update
1 parent a68f8f9 commit 7e5855f

1 file changed

Lines changed: 58 additions & 61 deletions

File tree

lib/loader.php

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,58 @@
1-
<?php
2-
/**
3-
* Libraries loader
4-
*
5-
* Used to load required libraries
6-
*
7-
* @author Serge Dzheigalo <jey@activeunit.com>
8-
* @package framework
9-
* @copyright ActiveUnit, Inc. 2001-2004
10-
* @version 1.0
11-
* @modified 01-Jan-2004
12-
*/
13-
14-
if (isset($_SERVER['REQUEST_URI'])) {
15-
Define("THIS_URL", $_SERVER['REQUEST_URI']);
16-
}
17-
18-
$ignore_libs = array();
19-
if (function_exists('mysqli_connect')) {
20-
$ignore_libs[] = 'mysql.class.php';
21-
} else {
22-
$ignore_libs[] = 'mysqli.class.php';
23-
}
24-
25-
include_once('./lib/perfmonitor.class.php');
26-
$ignore_libs[] = 'perfmonitor.class.php';
27-
$ignore_libs[] = 'loader.php';
28-
$ignore_libs[] = 'threads.php';
29-
30-
31-
// liblary modules loader
32-
if ($lib_dir = @opendir("./lib")) {
33-
$files_loaded = array();
34-
while (($lib_file = readdir($lib_dir)) !== false) {
35-
//if ($lib_file=='perfmonitor.class.php' && function_exists('startMeasure')) continue;
36-
if ((preg_match("/\.php$/", $lib_file)) && !in_array($lib_file, $ignore_libs)) {
37-
include_once("./lib/$lib_file");
38-
$files_loaded[] = "./lib/$lib_file";
39-
}
40-
}
41-
closedir($lib_dir);
42-
43-
/*
44-
$data = '';
45-
foreach ($files_loaded as $file) {
46-
$content = LoadFile($file);
47-
$content = preg_replace('/^<\?php/', '', $content);
48-
$content = preg_replace('/\?>$/', '', $content);
49-
$data .= "\n\n" . $content;
50-
}
51-
$data="<?php\n".$data;
52-
SaveFile('./lib/merged/libraries.php', $data);
53-
*/
54-
}
55-
56-
if (defined('DB_HOST') && DB_HOST) {
57-
startMeasure('db_connection');
58-
global $db;
59-
$db = new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME);
60-
endMeasure('db_connection');
61-
}
1+
<?php
2+
/**
3+
* Libraries loader
4+
*
5+
* Used to load required libraries
6+
*
7+
* @author Serge Dzheigalo <jey@activeunit.com>
8+
* @package framework
9+
* @copyright ActiveUnit, Inc. 2001-2004
10+
* @version 1.0
11+
* @modified 01-Jan-2004
12+
*/
13+
14+
if (isset($_SERVER['REQUEST_URI'])) {
15+
Define("THIS_URL", $_SERVER['REQUEST_URI']);
16+
}
17+
18+
$ignore_libs = array();
19+
if (function_exists('mysqli_connect')) {
20+
$ignore_libs[] = 'mysql.class.php';
21+
} else {
22+
$ignore_libs[] = 'mysqli.class.php';
23+
}
24+
25+
$preload_libraries = array(
26+
'perfmonitor.class.php',
27+
'general.class.php',
28+
'module.class.php',
29+
'errors.class.php',
30+
'objects.class.php',
31+
'common.class.php',
32+
'caching.class.php'
33+
);
34+
foreach($preload_libraries as $lib_file) {
35+
if (file_exists('./lib/'.$lib_file)) include_once('./lib/'.$lib_file);
36+
$ignore_libs[] = $lib_file;
37+
}
38+
39+
$ignore_libs[] = 'loader.php';
40+
$ignore_libs[] = 'threads.php';
41+
42+
// liblary modules loader
43+
if ($lib_dir = @opendir("./lib")) {
44+
while (($lib_file = readdir($lib_dir)) !== false) {
45+
if ((preg_match("/\.php$/", $lib_file)) && !in_array($lib_file, $ignore_libs)) {
46+
include_once('./lib/'.$lib_file);
47+
}
48+
}
49+
closedir($lib_dir);
50+
51+
}
52+
53+
if (defined('DB_HOST') && DB_HOST) {
54+
startMeasure('db_connection');
55+
global $db;
56+
$db = new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME);
57+
endMeasure('db_connection');
58+
}

0 commit comments

Comments
 (0)