本文整理汇总了PHP中initProgram函数的典型用法代码示例。如果您正苦于以下问题:PHP initProgram函数的具体用法?PHP initProgram怎么用?PHP initProgram使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了initProgram函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
global $gbl, $sgbl, $login, $ghtml;
global $argv;
initProgram('admin');
$login->loadAllObjects('vps');
$this->bserver_l = $login->getList('centralbackupserver');
$list = $login->getList('vps');
foreach ($this->bserver_l as $bso) {
$bso->setMyselfUp();
}
$opt = parse_opt($argv);
if (!isset($opt['newarg'])) {
$mess = "\n\nThe architecture of centralized backup has been completely rewritten, and now we have per slave backup-server; you will need to supply --newarg=true for this to work. ";
$mess .= "More info at http://wiki.lxcenter.org/.";
print $mess;
log_log("centralbackup_flag", $mess);
send_mail_to_admin("Central Backup Failed", $mess);
exit;
}
$this->stopvps = opt_get_single_flag($opt, 'stopvps');
//$stopxen = opt_get_single_flag($opt, 'stopxen');
//$stopopenvz = opt_get_single_flag($opt, 'stopopenvz');
foreach ($list as $l) {
$this->backup_one_vps($l);
}
foreach ((array) $this->global_list as $k => $s) {
//$res = rl_exec_get(null, $k, 'remove_scpid', array($backupiddsa));
}
}
示例2: mebackup_main
function mebackup_main()
{
global $gbl, $sgbl, $login, $ghtml;
$progname = $sgbl->__var_program_name;
$cprogname = ucfirst($progname);
initProgram('admin');
lxfile_mkdir("__path_program_home/selfbackup/self/__backup");
$backup = $login->getObject('general')->selfbackupparam_b;
$dbf = $sgbl->__var_dbf;
$pass = trim(lfile_get_contents("__path_program_root/etc/conf/{$progname}.pass"));
$vd = createTempDir("/tmp", "mebackup");
$docf = "{$vd}/mebackup.dump";
// Issue #671 - Fixed backup-restore issue
// exec("exec mysqldump --add-drop-table -u $progname -p$pass $dbf > $docf");
system("exec mysqldump --add-drop-table -u {$progname} -p{$pass} {$dbf} > {$docf}");
$string = @date('Y-M-d') . '-' . time();
$bfile = "{$sgbl->__path_program_home}/selfbackup/self/__backup/{$progname}-scheduled-masterselfbackup-{$string}.zip";
lxshell_zip($vd, $bfile, array("mebackup.dump"));
lxfile_tmp_rm_rec($vd);
if ($backup && $backup->isOn('selfbackupflag')) {
try {
lxbackup::upload_to_server($bfile, basename($bfile), $backup);
} catch (Exception $e) {
print "Sending warning to {$login->contactemail} ..\n";
lx_mail(null, $login->contactemail, "{$cprogname} Self Database Backup Upload Failed on " . date('Y-M-d') . " at " . date('H') . " Hours", "{$cprogname} Backup upload Failed due to {$e->getMessage()}\n");
}
}
$backup->rm_last_number = 20;
$backup->nname = 'masterselfbackup';
lxbackup::clear_extra_backups('selfbackup', 'self', $backup);
}
示例3: lpanel_main
function lpanel_main()
{
global $gbl, $login, $ghtml;
initProgram();
init_language();
print_meta_lan();
$gbl->__navigmenu = null;
$gbl->__navig = null;
$skincolor = $login->getSkinColor();
// This should be called only in display.php, and not anywhere else. It doesn't matter anyway, since both lpanel.php, AND header.php never allows any modification to be carried out. Also, the display.php automatically deletes the login info, so if you click on any link on the header or the lpanel, you will automatically logged out.
//check_if_disabled_and_exit();
$imgbordermain = "{$login->getSkinDir()}/top_line_medium.gif";
if ($gbl->isOn('show_help')) {
$background = "{$login->getSkinDir()}/top_line_dark.gif";
$border = null;
} else {
$background = null;
}
$ghtml->print_include_jscript('left_panel');
print "<body topmargin=0 leftmargin=0 style='background-color:#fafafa'>";
//$ghtml->lpanel_beginning();
try {
//$ghtml->xp_panel($login);
//print_ext_tree($login);
$ghtml->tab_vheight();
} catch (exception $e) {
print "The Resource List could not gathered....{$e->getMessage()}<br> \n";
}
}
示例4: updatecleanup_main
function updatecleanup_main()
{
global $argc, $argv;
global $gbl, $sgbl, $login, $ghtml;
$program = $sgbl->__var_program_name;
$opt = parse_opt($argv);
if ($opt['type'] === 'master') {
initProgram('admin');
$flg = "__path_program_start_vps_flag";
if (!lxfile_exists($flg)) {
set_login_skin_to_feather();
}
} else {
$login = new Client(null, null, 'update');
}
print "Executing UpdateCleanup. This can take a long time. Please be patient\n";
log_log("update", "Executing Updatecleanup");
//
// Cleanup old lxlabs.repo file
//
print "Fixing Repo's\n";
if (lxfile_exists("/etc/yum.repos.d/lxcenter.repo")) {
if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
system("rm -f /etc/yum.repos.d/lxlabs.repo");
}
}
if (lxfile_exists("CVS")) {
print "Found Development version, we just go on.\n";
// exit;
}
if ($opt['type'] === 'master') {
$sgbl->slave = false;
if (!is_secondary_master()) {
print "Update database\n";
updateDatabaseProperly();
print "Fix Extra database issues\n";
fixExtraDB();
print "Update extra issues\n";
doUpdateExtraStuff();
print "Get Driver info\n";
lxshell_return("__path_php_path", "../bin/common/driverload.php");
}
print "Starting Update all slaves\n";
update_all_slave();
print "Fix main {$program} databasefile\n";
cp_dbfile();
} else {
$sgbl->slave = true;
}
if (!is_secondary_master()) {
print "Starting update cleanups\n";
updatecleanup();
}
lxfile_touch("__path_program_start_vps_flag");
}
示例5: switchserver_main
function switchserver_main()
{
global $argc, $argv;
global $gbl, $sgbl, $login, $ghtml;
//sleep(60);
initProgram("admin");
if ($argc === 1) {
print "Usage: {$argv['0']} --class= --name= --v-syncserver= \n";
exit;
}
try {
$opt = parse_opt($argv);
$param = get_variable($opt);
dprintr($param);
$class = $opt['class'];
$name = $opt['name'];
if (lx_core_lock("{$class}-{$name}.switchserver")) {
exit;
}
$object = new $class(null, 'localhost', $name);
$object->get();
if ($object->dbaction === 'add') {
throw new lxException("no_object", '', '');
exit;
}
if (!$object->syncserver) {
print "No_synserver...\n";
throw new lxException("no_syncserver", '', '');
exit;
}
if ($param['syncserver'] === $object->syncserver) {
print "No Change...\n";
throw new lxException("no_change", '', '');
exit;
}
$driverapp_old = $gbl->getSyncClass('localhost', $object->syncserver, $object->get__table());
$driverapp_new = $gbl->getSyncClass('localhost', $param['syncserver'], $object->get__table());
if ($driverapp_new !== $driverapp_old) {
//throw new lxException ("the_drivers_are_different_in_two_servers", '', '');
}
$object->doupdateSwitchserver($param);
} catch (exception $e) {
print $e->getMessage();
/// hcak ahck... Chnage only the olddelete variable which is the mutex used for locking in the process of switch. The problem is we want to totally bail out if the switchserver fails. The corect way would be save after reverting the syncserve to the old value, but that's a bit risky. So we just use a hack to change only the olddeleteflag; Not a real hack.. This is the better way.
$message = "{$e->getMessage()}";
write_to_object($object, $message, $param['syncserver']);
$fullmesage = "Switch of {$object->get__table()}:{$object->nname} to {$object->syncserver} failed due to {$e->getMessage()}";
log_switch($fullmesage);
mail($login->contactemail, "Switch Failed:", "{$fullmesage}\n");
print "\n";
exit;
}
mail($login->contactemail, "Switch Succeeded", "Switch Succeeded {$object->get__table()}:{$object->nname} to {$param['syncserver']}\n");
}
示例6: header_main
function header_main()
{
global $gbl, $sgbl, $login, $ghtml;
initProgram();
init_language();
print_meta_lan();
if ($login->isDefaultSkin()) {
print_header_old_default();
} else {
print_header();
}
}
示例7: driverload_main
function driverload_main()
{
global $argv, $gbl, $sgbl, $login, $ghtml;
initProgram('admin');
$p = parse_opt($argv);
if (isset($p['clear-existing'])) {
$sq = new Sqlite(null, "driver");
$sq->rawQuery("delete from driver");
}
$list = $login->getList('pserver');
foreach ($list as $l) {
$l->getandWriteModuleDriver();
}
}
示例8: schedulebackup_main
function schedulebackup_main()
{
global $gbl, $sgbl, $login, $ghtml;
$progname = $sgbl->__var_program_name;
initProgram('admin');
$login->loadAllBackups();
$list = $login->lxbackup_l;
foreach ($list as $l) {
$l->backupstage = 'done';
$l->setUpdateSubaction();
$l->write();
if ($l->parent_clname !== $login->getClName() && !$l->priv->isOn('backupschedule_flag')) {
continue;
}
if ($l->getParentClass() === 'domain') {
continue;
}
if (!$l->backupschedule_type) {
continue;
}
if ($l->backupschedule_type === 'disabled') {
continue;
}
if ($l->backupschedule_type === 'weekly' && date('D') !== 'Sun') {
continue;
}
if ($l->backupschedule_type === 'monthly' && date('d') !== '01') {
continue;
}
/*
try {
$param['backup_to_file_f'] = "$progname-scheduled";
$param['upload_to_ftp'] = $l->upload_to_ftp;
$backup = $l;
$object = $l->getParentO();
$backup->doupdateBackup($param);
$backup->backupstage = 'done';
} catch (exception $e) {
$mess = "{$e->__full_message}\n";
$backup->backupstage = "Failed due to: $mess";
lx_mail($progname, $object->contactemail, "Backup Failed..", "Backup Failed for $object->nname with the Message $mess");
}
*/
$class = $l->getParentClass();
$name = $l->getParentName();
$fname = "{$progname}-scheduled";
print "Scheduling for {$class} {$name}\n";
lxshell_return("__path_php_path", "../bin/common/backup.php", "--class={$class}", "--name={$name}", "--v-backup_file_name={$fname}");
}
}
示例9: header_main
function header_main()
{
global $gbl, $sgbl, $login, $ghtml;
initProgram();
initLanguage();
initLanguageCharset();
// Load default skin or feather skin
if ($login->isDefaultSkin()) {
include_once "lib/default_header.php";
CreateDefaultHeaderMenu();
} else {
print_header();
}
}
示例10: install_main
function install_main()
{
global $gbl, $login, $ghtml;
try {
initProgram("admin");
ob_end_flush();
create_servername();
add_client_template();
add_customer_reseller();
add_domain_list();
$login->was();
} catch (Exception $e) {
print $e->getMessage();
print "\\n\n\n\n\n\n\n\n\n\nn\n";
}
print "\n";
}
示例11: header_main
function header_main()
{
global $gbl, $sgbl, $login, $ghtml;
initProgram();
init_language();
print_open_head_tag();
print_meta_tags();
print_meta_css();
if ($login->isDefaultSkin()) {
print "<!-- Default Theme -->\n";
print_header_default();
} else {
print_close_head_tag();
print "<!-- Feather Theme -->\n";
print_header_feather();
}
print "</body>\n</html>\n";
}
示例12: database_main
function database_main()
{
global $argc, $argv;
global $gbl, $login, $ghtml;
initProgram('admin');
if ($argv[1] == 'exec') {
$db = new Sqlite(null, 'client');
$res = $db->rawQuery($argv[2]);
foreach ($res as &$r) {
foreach ($r as $k => &$__r) {
if (csb($k, "ser_")) {
$__r = unserialize(base64_decode($__r));
}
}
}
print_r($res);
exit;
}
}
示例13: commandline_main
function commandline_main()
{
global $gbl, $sgbl, $login, $ghtml;
global $argv;
initProgram('admin');
$must = array('action');
$p = parse_opt($argv);
$pk = array_keys($p);
foreach ($must as $m) {
if (!array_search_bool($m, $pk)) {
print "Need action, class and name\n";
exit;
}
}
$func = "__cmd_desc_{$p['action']}";
try {
$list = $func($p);
if ($list) {
if (isset($p['output-type'])) {
if ($p['output-type'] === 'json') {
$out = json_encode($list);
print $out;
} else {
if ($p['output-type'] === 'serialize') {
$out = serialize($list);
print $out;
}
}
} else {
foreach ($list as $l) {
print "{$l}\n";
}
}
} else {
print "{$p['action']} succesfully executed\n";
}
exit(0);
} catch (exception $e) {
print $e->__full_message;
print "\n";
exit(8);
}
}
示例14: logout_main
function logout_main()
{
global $gbl, $sgbl, $login, $ghtml;
initProgram();
clear_all_cookie();
$cl = $login->getList("ssession");
Utmp::updateUtmp($gbl->c_session->nname, $login, "Logout");
$gbl->c_session->delete();
$gbl->c_session->was();
if ($gbl->c_session->ssl_param) {
$ghtml->print_redirect($gbl->c_session->ssl_param['backurl']);
} else {
if ($gbl->c_session->consuming_parent) {
$ret = $gbl->getSessionV('return_url');
$ghtml->print_redirect($ret);
} else {
$ghtml->print_redirect_self("/login/");
}
}
}
示例15: lpanel_main
function lpanel_main()
{
global $gbl, $login, $ghtml;
initProgram();
init_language();
print_open_head_tag();
print_meta_tags();
print_meta_css();
print_meta_css_lpanel();
$gbl->__navigmenu = null;
$gbl->__navig = null;
$catched = false;
$ghtml->print_include_jscript('left_panel');
$ghtml->print_jscript_source("/htmllib/js/lpanel-tabs.js");
try {
$ghtml->tab_vheight();
} catch (exception $e) {
print_close_head_tag();
print "<body>\n";
print "The Resource List could not gathered....{$e->getMessage()}<br> \n";
$catched = true;
}
if (!$catched) {
print_close_head_tag();
print "<body>\n";
}
// The div id's tabs1 script markup tree-div tab-content are generated from lpanel-tabs.js
print "<div class=\"lpanelmain\" id=\"tabs1\">\n";
print "<div id=\"script\" class=\"lpanelnormal tab-content\">\n";
print "<br>\n";
$ghtml->xp_panel($login);
print "</div>\n";
print "<div id=\"markup\" class=\"tab-content\">\n";
print "<div id=\"tree-div\" class=\"lpaneltree\">\n";
print "</div>\n";
print "</div>\n";
print "</div>\n";
print "</body>\n";
print "</html>\n";
}