本文整理汇总了PHP中event::log方法的典型用法代码示例。如果您正苦于以下问题:PHP event::log方法的具体用法?PHP event::log怎么用?PHP event::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event
的用法示例。
在下文中一共展示了event::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: openqrm_dhcpd_appliance
function openqrm_dhcpd_appliance($cmd, $appliance_fields)
{
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_EXEC_PORT;
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
$event = new event();
$appliance_id = $appliance_fields["appliance_id"];
$appliance_name = $appliance_fields["appliance_name"];
$resource = new resource();
$resource->get_instance_by_id($appliance_fields["appliance_resources"]);
$resource_mac = $resource->mac;
$resource_ip = $resource->ip;
$appliance = new appliance();
$appliance->get_instance_by_id($appliance_id);
if ($resource->id == "-1" || $resource->id == "") {
return;
}
$event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Handling {$cmd} event {$appliance_id}/{$appliance_name}/{$resource_ip}/{$resource_mac}", "", "", 0, 0, $resource->id);
switch ($cmd) {
case "start":
$event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Adding hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
$dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance add_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
$openqrm_server->send_command($dhcpd_command);
break;
case "stop":
$event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Removing hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
$dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance remove_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
$openqrm_server->send_command($dhcpd_command);
break;
}
}
示例2: remotelogin_action
function remotelogin_action() {
cookie::del('passinfo');
$this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
if (front::$args) {
$user=new user();
$args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password'));
$user=$user->getrow(unserialize($args));
if (is_array($user)) {
if ($user['groupid'] == '888')
front::$isadmin=true;
cookie::set('login_username',$user['username']);
cookie::set('login_password',front::cookie_encode($user['password']));
session::set('username',$user['username']);
require_once ROOT.'/celive/include/config.inc.php';
require_once ROOT.'/celive/include/celive.class.php';
$login=new celive();
$login->auth();
$GLOBALS['auth']->remotelogin($user['username'],$user['password']);
$GLOBALS['auth']->check_login1();
front::$user=$user;
}elseif (!is_array(front::$user) ||!isset(front::$isadmin)) {
cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600);
event::log('loginfalse','失败 user='.$user['username']);
front::flash('密码错误或不存在该管理员!');
front::refresh(url('admin/login',true));
}
}
$this->render();
}
示例3: batch_action
function batch_action(){
if(front::post('batch') == 'delete'){
$sql = "DELETE FROM `".config::get('database', 'prefix')."event`";
$this->_table->query($sql);
event::log('日志清除','成功');
front::refresh(url::modify('act/manage',true));
}
}
示例4: delete_action
function delete_action() {
$path=ROOT.'/lang/'.config::get('lang_type').'/system.php';
$lang=include $path;
event::log('删除语言包','成功');
exit;
front::refresh(url('language/edit',true));
}
示例5: stop
function stop()
{
$response = '';
$vms = $this->response->html->request()->get($this->identifier_name);
if ($vms !== '') {
$appliance_id = $this->response->html->request()->get('appliance_id');
$appliance = new appliance();
$resource = new resource();
$errors = array();
$message = array();
foreach ($vms as $key => $vm) {
$appliance->get_instance_by_id($appliance_id);
$resource->get_instance_by_id($appliance->resources);
$file = $this->openqrm->get('basedir') . '/plugins/kvm/web/kvm-stat/' . $resource->id . '.vm_list';
$command = $this->openqrm->get('basedir') . '/plugins/kvm/bin/openqrm-kvm-vm stop -n ' . $vm;
$command .= ' -u ' . $this->openqrm->admin()->name . ' -p ' . $this->openqrm->admin()->password;
$command .= ' --openqrm-ui-user ' . $this->user->name;
$command .= ' --openqrm-cmd-mode background';
$resource->send_command($resource->ip, $command);
$message[] = sprintf($this->lang['msg_stoped'], $vm);
$file = $this->openqrm->get('basedir') . '/plugins/kvm/web/kvm-stat/' . $resource->id . '.vm_list';
if ($this->file->exists($file)) {
$lines = explode("\n", $this->file->get_contents($file));
foreach ($lines as $line) {
if ($line !== '') {
$line = explode('@', $line);
if ($line[1] === $vm) {
$tmp = explode(':', $line[5]);
$server = $tmp[0];
$port = $tmp[1];
$mac = $line[2];
$resource->get_instance_by_mac($mac);
$rid = $resource->id;
}
}
$event = new event();
$plugin = new plugin();
$enabled = $plugin->enabled();
foreach ($enabled as $index => $name) {
$running = $this->openqrm->get('webdir') . '/plugins/' . $name . '/.running';
$hook = $this->openqrm->get('webdir') . '/plugins/' . $name . '/openqrm-' . $name . '-remote-console-hook.php';
if (file_exists($hook)) {
if (file_exists($running)) {
$event->log("console", $_SERVER['REQUEST_TIME'], 5, "kvm-vm.console.class.php", 'Found plugin ' . $name . ' providing a remote console.', "", "", 0, 0, $resource->id);
require_once $hook;
$console_function = 'openqrm_' . $name . '_disable_remote_console';
$console_function = str_replace("-", "_", $console_function);
$console_function($server, $port, $rid, $mac, $vm);
}
}
}
}
}
}
if (count($errors) === 0) {
$response = join('<br>', $message);
} else {
$msg = array_merge($errors, $message);
$response = join('<br>', $msg);
}
} else {
$response = '';
}
return $response;
}
示例6: event
function get_instance($id, $name)
{
global $USER_INFO_TABLE;
$event = new event();
$db = openqrm_get_db_connection();
if ($id != "") {
$user_array = $db->GetAll("select * from " . $this->_user_table . " where user_id={$id}");
} else {
if ($name != "") {
$user_array = $db->GetAll("select * from " . $USER_INFO_TABLE . " where user_name='{$name}'");
} else {
$event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Could not create instance of user without data", "", "", 0, 0, 0);
return;
}
}
foreach ($user_array as $index => $user) {
$this->id = $user["user_id"];
$this->name = $user["user_name"];
$this->password = $user["user_password"];
$this->gender = $user["user_gender"];
$this->first_name = $user["user_first_name"];
$this->last_name = $user["user_last_name"];
$this->department = $user["user_department"];
$this->office = $user["user_office"];
$this->role = $user["user_role"];
$this->lang = $user["user_lang"];
$this->last_update_time = $user["user_last_update_time"];
$this->description = $user["user_description"];
$this->capabilities = $user["user_capabilities"];
$this->wizard_name = $user["user_wizard_name"];
$this->wizard_step = $user["user_wizard_step"];
$this->wizard_id = $user["user_wizard_id"];
$this->state = $user["user_state"];
}
return $this;
}
示例7: htmlobject
require_once $RootDir . '/class/htmlobjects/htmlobject.class.php';
require_once $RootDir . '/include/requestfilter.inc.php';
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
$cloud_product_hook = $RootDir . '/plugins/hybrid-cloud/openqrm-hybrid-cloud-cloud-product-hook.php';
$cloud_selector_class = $RootDir . '/plugins/cloud/class/cloudselector.class.php';
$cloud_usergroup_class = $RootDir . '/plugins/cloud/class/cloudusergroup.class.php';
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
$event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "hybrid-cloud-action", "Un-Authorized access to hybrid-cloud-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
exit;
}
// get command
$hybrid_cloud_command = $request->get('hybrid_cloud_command');
// main
$event->log("{$hybrid_cloud_command}", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-action", "Processing hybrid-cloud command {$hybrid_cloud_command}", "", "", 0, 0, 0);
switch ($hybrid_cloud_command) {
case 'init':
// this command creates the following table
// -> hybrid_cloud_accounts
// hybrid_cloud_id BIGINT
// hybrid_cloud_account_name VARCHAR(50)
// hybrid_cloud_account_type VARCHAR(50)
// hybrid_cloud_access_key VARCHAR(255)
// hybrid_cloud_secret_key VARCHAR(255)
示例8: event
$template_command = $request->get('template_command');
$template_domain = $request->get('template_domain');
// special template classes
require_once "{$RootDir}/plugins/template/class/templateconfig.class.php";
global $TEMPLATE_USER_TABLE;
global $TEMPLATE_REQUEST_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
$refresh_delay = 5;
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
$event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "template-action", "Un-Authorized access to template-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
exit;
}
// gather request parameter in array
foreach ($_REQUEST as $key => $value) {
if (strncmp($key, "cr_", 3) == 0) {
$request_fields[$key] = $value;
}
}
// main
$event->log("{$template_command}", $_SERVER['REQUEST_TIME'], 5, "template-action", "Processing template command {$template_command}", "", "", 0, 0, 0);
switch ($template_command) {
case 'init':
// this command creates the following table
//
// -> templateconfig
示例9: import
function import()
{
$response = '';
$errors = array();
$message = array();
$event = new event();
$instance_command = $this->response->html->request()->get('instance_command');
if ($instance_command !== '') {
switch ($instance_command) {
case 'add':
// instance_command=add
// &instance_name='.$name.'
// &instance_mac='.$mac.'
// &instance_public_ip='.$public_ip.'
// &instance_type='.$type.'
// &instance_keypair='.$keypair.'
// &instance_region='.$region.'
// &instance_ami='.$ami;
$now = $_SERVER['REQUEST_TIME'];
$openqrm = new openqrm_server();
$instance_name = $this->response->html->request()->get('instance_name');
$instance_mac = $this->response->html->request()->get('instance_mac');
$instance_public_ip = $this->response->html->request()->get('instance_public_ip');
$instance_type = $this->response->html->request()->get('instance_type');
$instance_keypair = $this->response->html->request()->get('instance_keypair');
$instance_region = $this->response->html->request()->get('instance_region');
$instance_ami = $this->response->html->request()->get('instance_ami');
// create resource, image and appliance
$event->log("import", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-vm-import", "Importing " . $instance_name . " - " . $instance_mac . " - " . $instance_public_ip . " - " . $instance_type . " - " . $instance_keypair . " - " . $instance_region . " - " . $instance_ami . ".", "", "", 0, 0, 0);
$import_resource = new resource();
$deployment = new deployment();
$deployment->get_instance_by_name('ami-deployment');
$virtualization = new virtualization();
$virtualization->get_instance_by_type("hybrid-cloud-vm-local");
// create resource
$resid = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
// send command to the openQRM-server
$openqrm->send_command('openqrm_server_add_resource ' . $resid . ' ' . $instance_mac . ' ' . $instance_public_ip);
// add to openQRM database
$resource_fields["resource_id"] = $resid;
$resource_fields["resource_ip"] = $instance_public_ip;
$resource_fields["resource_mac"] = $instance_mac;
$resource_fields["resource_kernel"] = 'local';
$resource_fields["resource_kernelid"] = 0;
$resource_fields["resource_localboot"] = 0;
$resource_fields["resource_hostname"] = $this->hc->account_type . $resid;
$resource_fields["resource_vtype"] = $virtualization->id;
$resource_fields["resource_vhostid"] = 0;
$import_resource->add($resource_fields);
$import_resource->get_instance_by_mac($instance_mac);
// update stats
#if ($state == 'running') {
$rfields["resource_state"] = 'idle';
#$rfields["resource_lastgood"]=$now;
#} else {
# $rfields["resource_state"]='off';
#}
#$import_resource->update_info($import_resource->id, $rfields);
// set account id in resource capabilities
$import_resource->set_resource_capabilities("HCACL", $this->id);
// auto create image object
$storage = new storage();
$storage->get_instance_by_name('ami-image-storage');
$image = new image();
$image->get_instance_by_name($instance_ami);
if (isset($image->id) && $image->id > 0) {
$image_exists = true;
} else {
$image_fields = array();
$vm_image_id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
$image_fields["image_id"] = $vm_image_id;
$image_fields['image_name'] = $instance_ami;
$image_fields['image_type'] = 'ami-deployment';
$image_fields['image_rootfstype'] = 'local';
$image_fields['image_isactive'] = 0;
$image_fields['image_storageid'] = $storage->id;
$image_fields['image_comment'] = "Image Object for AMI {$instance_ami}";
$image_fields['image_rootdevice'] = $instance_ami;
$image->add($image_fields);
# update image object
$image->get_instance_by_id($vm_image_id);
// update resource with image infos
$rfields["resource_id"] = $resid;
$rfields["resource_image"] = $image->name;
$rfields["resource_imageid"] = $image->id;
$import_resource->update_info($import_resource->id, $rfields);
$import_resource->get_instance_by_mac($instance_mac);
}
// create the appliance
$appliance = new appliance();
$appliance->get_instance_by_name($instance_name);
if (isset($appliance->id) && $appliance->id > 0) {
$appliance_exists = true;
} else {
$new_appliance_id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
$afields['appliance_id'] = $new_appliance_id;
$afields['appliance_name'] = $this->hc->account_type . $resid;
$afields['appliance_resources'] = $resid;
$afields['appliance_kernelid'] = '1';
$afields['appliance_imageid'] = $image->id;
//.........这里部分代码省略.........
示例10: add
function add()
{
$response = $this->get_response();
$form = $response->form;
if (!$form->get_errors() && $this->response->submit()) {
$kernel_id = $form->get_request('kernel');
$fields['appliance_kernelid'] = $kernel_id;
$fields['appliance_wizard'] = null;
$this->appliance->update($this->appliance->id, $fields);
// reset wizard
$rs = $this->user->set_wizard($this->user->name, 0, 0, 0);
// now we have to run the appliance add hook
$this->appliance->run_add_hook($this->appliance->id);
$response->msg = sprintf($this->lang['msg'], $kernel_id, $this->appliance->name);
$event = new event();
$event_description_step3 = sprintf($this->lang['appliance_create_in_progress_event'], $this->appliance->name, 3, $this->user->name);
$event_description_step4 = sprintf($this->lang['appliance_created'], $this->appliance->name, $this->user->name);
$event->log("appliance", $_SERVER['REQUEST_TIME'], 10, "add", $event_description_step3, "", "", 0, 0, 0);
$event->log("appliance", $_SERVER['REQUEST_TIME'], 5, "add", $event_description_step4, "", "", 0, 0, 0);
}
$response->name = $this->appliance->name;
return $response;
}
示例11: htmlobject
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
$ansible_command = $request->get('ansible_command');
$ansible_server_id = $request->get('ansible_id');
$ansible_server_name = $request->get('ansible_name');
$ansible_server_mac = $request->get('ansible_mac');
$ansible_server_ip = $request->get('ansible_ip');
global $OPENQRM_SERVER_BASE_DIR;
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
// main
$event->log($ansible_command, $_SERVER['REQUEST_TIME'], 5, "ansible-apply", "Processing ansible command " . $ansible_command, "", "", 0, 0, 0);
switch ($ansible_command) {
case 'apply':
$appliance = new appliance();
$appliance->get_instance_by_id($ansible_server_id);
if ($ansible_server_name == $appliance->name) {
$resource = new resource();
$resource->get_instance_by_id($appliance->resources);
if ($ansible_server_mac == $resource->mac && $ansible_server_ip == $resource->ip) {
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/ansible/bin/openqrm-ansible-manager apply " . $appliance->id . " " . $appliance->name . " " . $resource->ip . " --openqrm-cmd-mode background";
$openqrm_server = new openqrm_server();
$openqrm_server->send_command($command, NULL, true);
} else {
$event->log($ansible_command, $_SERVER['REQUEST_TIME'], 3, "ansible-apply", "Request for Ansible apply for server id " . $ansible_server_id . " with wrong resource " . $resource->id, "", "", 0, 0, 0);
}
} else {
示例12: htmlobject
require_once $RootDir . '/include/requestfilter.inc.php';
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
global $IMAGE_INFO_TABLE;
global $DEPLOYMENT_INFO_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
$lvm_storage_command = $request->get('lvm_storage_command');
$lvm_image_name = $request->get('lvm_image_name');
// place for the storage stat files
$StorageDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/plugins/lvm-storage/storage';
// global event for logging
$event = new event();
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
$event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "lvm-action", "Un-Authorized access to lvm-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
exit;
}
$event->log("{$lvm_storage_command}", $_SERVER['REQUEST_TIME'], 5, "lvm-storage-action", "Processing lvm-storage command {$lvm_storage_command}", "", "", 0, 0, 0);
switch ($lvm_storage_command) {
case 'get_storage':
if (!file_exists($StorageDir)) {
mkdir($StorageDir);
}
$filename = $StorageDir . "/" . $_POST['filename'];
$filedata = base64_decode($_POST['filedata']);
echo "<h1>{$filename}</h1>";
$fout = fopen($filename, "wb");
fwrite($fout, $filedata);
fclose($fout);
break;
示例13: event
$request = $html->request();
$request->filter = $requestfilter;
global $CLOUD_USER_TABLE;
global $CLOUD_REQUEST_TABLE;
global $CLOUD_USER_GROUPS_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
$refresh_delay = 5;
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
$cloud_command = $request->get('cloud_command');
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
$event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "cloud-action", "Un-Authorized access to cloud-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
exit;
}
// gather user parameter in array
foreach ($_REQUEST as $key => $value) {
if (strncmp($key, "cu_", 3) == 0) {
$user_fields[$key] = $value;
}
}
// gather user group parameter in array
foreach ($_REQUEST as $key => $value) {
if (strncmp($key, "cg_", 3) == 0) {
$user_group_fields[$key] = $value;
}
}
// gather request parameter in array
示例14: action
function action()
{
global $OPENQRM_SERVER_BASE_DIR;
$RootDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/';
$token = $this->response->html->request()->get('token');
$event_id = $this->response->html->request()->get('event_id');
$msg = '';
if ($token !== '' && $event_id !== '') {
$event = new event();
$event->get_instance_by_id($event_id);
$event->log("event-action", $_SERVER['REQUEST_TIME'], 5, "event-overview.php", "Re-Running command {$token}", "", "", 0, 0, 0);
$command = "mv -f " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/web/base/server/event/errors/" . $token . ".cmd " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/var/spool/openqrm-queue." . $token . " && rm -f " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/web/base/server/event/errors/" . $token . ".out";
shell_exec($command);
$fields = array();
$fields["event_priority"] = 4;
$event->update($event_id, $fields);
$msg .= "Re-running token " . $token . " / Event ID " . $event_id . "<br>";
}
$this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
}
示例15: htmlobject
require_once "{$RootDir}/class/image.class.php";
require_once "{$RootDir}/class/kernel.class.php";
require_once "{$RootDir}/class/event.class.php";
require_once "{$RootDir}/class/openqrm_server.class.php";
require_once "{$RootDir}/class/virtualization.class.php";
// filter inputs
require_once $RootDir . '/class/htmlobjects/htmlobject.class.php';
require_once $RootDir . '/include/requestfilter.inc.php';
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
global $RESOURCE_INFO_TABLE;
$event = new event();
// user/role authentication
if (!strstr($OPENQRM_USER->role, "administrator")) {
$event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "resource-action", "Un-Authorized access to resource-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
exit;
}
$resource_command = $request->get('resource_command');
$resource_id = $request->get('resource_id');
$resource_hostname = $request->get('resource_hostname');
$resource_mac = strtolower($request->get('resource_mac'));
$resource_ip = $request->get('resource_ip');
$resource_state = $request->get('resource_state');
$resource_event = $request->get('resource_event');
foreach ($_REQUEST as $key => $value) {
if (strncmp($key, "resource_", 9) == 0) {
$resource_fields[$key] = $request->get($key);
}
}
unset($resource_fields["resource_command"]);