forked from ivantcholakov/starter-public-edition-4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.php
More file actions
executable file
·21 lines (16 loc) · 762 Bytes
/
Copy pathcli.php
File metadata and controls
executable file
·21 lines (16 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
// See Hack 4. Running CodeIgniter from the Command Line, http://net.tutsplus.com/tutorials/php/6-codeigniter-hacks-for-the-masters/
// Sample usage: php cli.php "controller/method/parameter_1_key/parameter_1_value/parameter_2_key/parameter_2_value"
if (!((PHP_SAPI == 'cli') or defined('STDIN'))) {
die('Command line only!');
}
// Added by Ivan Tcholakov, 18-DEC-2013.
// A temporary fix about language segment for command-line interface.
if (isset($argv[1])) {
if ($argv[1] != 'en' && $argv[1] != 'bg') {
$argv = array_merge(array_slice($argv, 0, 1), array('en'), array_slice($argv, 1)); // Insert the language segment.
}
}
//
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = $argv[1];
require dirname(__FILE__) . '/index.php';