CC-2697: airtime-user script is not working

-added script to system path
This commit is contained in:
martin 2011-08-19 17:05:29 -04:00
parent e53c6d8061
commit a47044c50c
5 changed files with 67 additions and 7 deletions

26
utils/airtime-user.php Executable file → Normal file
View file

@ -1,12 +1,14 @@
#!/usr/bin/php
<?php
set_include_path('../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
require_once(__DIR__.'/../airtime_mvc/library/propel/runtime/lib/Propel.php');
Propel::init(__DIR__.'/../airtime_mvc/application/configs/airtime-conf.php');
$airtimeIni = GetAirtimeConf();
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
require_once(dirname(__FILE__).'/../airtime_mvc/application/configs/conf.php');
require_once(dirname(__FILE__).'/../airtime_mvc/application/models/Users.php');
set_include_path("$airtime_base_dir/application/models" . PATH_SEPARATOR . get_include_path());
require_once("$airtime_base_dir/library/propel/runtime/lib/Propel.php");
Propel::init("$airtime_base_dir/application/configs/airtime-conf.php");
require_once("$airtime_base_dir/application/configs/conf.php");
require_once("$airtime_base_dir/application/models/Users.php");
require_once('DB.php');
require_once('Console/Getopt.php');
@ -117,3 +119,15 @@ if ($action == "addupdate") {
$user->delete();
}
}
function GetAirtimeConf()
{
$ini = parse_ini_file("/etc/airtime/airtime.conf", true);
if ($ini === false){
echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL;
exit;
}
return $ini;
}