-
Notifications
You must be signed in to change notification settings - Fork 1
/
clifs
executable file
·38 lines (31 loc) · 1017 Bytes
/
clifs
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
#!/usr/bin/php
<?php
/**
* Executes a "clifs" command (Command line).
*/
if(preg_match("/^\//", $_SERVER['SCRIPT_FILENAME'])) {
$path = $_SERVER['SCRIPT_FILENAME'];
}
else {
$path = $_SERVER['PWD']."/".$_SERVER['SCRIPT_FILENAME'];
}
$matches = array();
preg_match("/(.*)\/[^\/]+/is", str_replace("./", "/", str_replace("/./", "/", $path)), $matches);
define("SITEPATH",$matches[1]);
define("is_shell",true);
define("CURRENT_TIME",time());
define("BUILD_START",microtime(true));
/**
* Special behavior if we want to generate the classlist, we need to copy our default classlist file
* to always have really all required classes
*/
if (in_array('--generate_classlist', $argv)) {
@copy(SITEPATH . '/config/classes.php.default', SITEPATH . '/config/classes.php');
}
require("lib/Core.php");
$core = Core::get_instance(true);
$core->boot();
if (!empty($core->db)) {
$core->session->current_user(new UserObj(1));
}
$core->run_cli();