-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.php
68 lines (55 loc) · 1.64 KB
/
run.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
61
62
63
64
65
66
<?php
/**
* Created by JetBrains PhpStorm.
* User: rakoth
* Date: 5/17/13
* Time: 9:23 PM
* To change this template use File | Settings | File Templates.
*/
$conf_path = __DIR__.'/../cli/config.php';
//load as admin!
foreach($argv as $k => $_){
if($_ =='--as-admin'){
unset($argv[$k]);
$argc--;
$conf_path = __DIR__.'/../admin/config.php';
}
if($_ =='--as-catalog'){
unset($argv[$k]);
$argc--;
$conf_path = __DIR__.'/../config.php';
}
}
// Configuration
require_once($conf_path);
// Install
if (!defined('DIR_APPLICATION')) {
die('OPENCART installation required');
exit;
}
// Startup
require_once(DIR_SYSTEM . 'startup.php');
// Application Classes
require_once(DIR_SYSTEM . 'library/customer.php');
require_once(DIR_SYSTEM . 'library/affiliate.php');
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/tax.php');
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/length.php');
require_once(DIR_SYSTEM . 'library/cart.php');
function run_autoloader($class) {
$root_dir = dirname(__FILE__);
$run_classes = implode(DIRECTORY_SEPARATOR, array($root_dir,'includes',$class.'.php'));
if(is_file($run_classes)){
include_once($run_classes);
return;
}
preg_match_all('/[A-Z][^A-Z]*/', $class, $class_parts);
$cli_classes = implode(DIRECTORY_SEPARATOR, array($root_dir, 'classes', strtolower($class_parts[0][0]), $class.'.php'));
if(is_file($cli_classes)){
include_once($cli_classes);
}
}
spl_autoload_register('run_autoloader');
$p = new CLIProcessor($argv);
$p->process();