本文整理汇总了PHP中log::info方法的典型用法代码示例。如果您正苦于以下问题:PHP log::info方法的具体用法?PHP log::info怎么用?PHP log::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
static function upgrade($version)
{
log::info("aws_s3", "Commencing module upgrade (" . $version . ")");
switch ($version) {
case 0:
log::info("aws_s3", "Installing version 1");
@mkdir(VARPATH . "modules/aws_s3");
@mkdir(VARPATH . "modules/aws_s3/log");
// installation's unique identifier - allows multiple g3's pointing to the same s3 bucket.
if (!module::get_var("aws_s3", "g3id")) {
module::set_var("aws_s3", "g3id", md5(time()));
}
module::set_var("aws_s3", "synced", false);
module::set_var("aws_s3", "enabled", false);
module::set_var("aws_s3", "access_key", "");
module::set_var("aws_s3", "secret_key", "");
module::set_var("aws_s3", "bucket_name", "");
module::set_version("aws_s3", 1);
case 1:
log::info("aws_s3", "Upgrading to version 2");
$db = Database::instance();
$db->query("CREATE TABLE {aws_s3_meta} (\n `item_id` int(9) NOT NULL,\n `item_hash` varchar(32) NOT NULL DEFAULT '',\n `thumb_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `resize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `fullsize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `local_deleted` smallint(1) NOT NULL DEFAULT 0,\n PRIMARY KEY (`item_id`)\n ) DEFAULT CHARSET=utf8;");
module::set_var("aws_s3", "upload_thumbs", true);
module::set_var("aws_s3", "upload_resizes", true);
module::set_var("aws_s3", "upload_fullsizes", true);
module::set_var("aws_s3", "s3_storage_only", false);
if (module::get_var("aws_s3", "synced")) {
// v1 has already synced this installation to s3. mark all the items with the relevant meta data
$items = ORM::factory("item")->find_all();
foreach ($items as $item) {
aws_s3::log("Updating S3 meta for item ID: " . $item->id);
$item->s3_thumb_uploaded = true;
if (!$item->is_album()) {
$item->s3_resize_uploaded = true;
$item->s3_fullsize_uploaded = true;
}
$item->s3_local_deleted = false;
$item->s3_item_hash = md5($item->relative_path());
$item->save_s3_meta();
}
} else {
// check various states after upgrade from v1..
if (module::get_var("aws_s3", "access_key") != "" && module::get_var("aws_s3", "secret_key") != "" && module::get_var("aws_s3", "bucket_name") != "" && aws_s3::validate_access_details(module::get_var("aws_s3", "access_key"), module::get_var("aws_s3", "secret_key"), module::get_var("aws_s3", "bucket_name"))) {
// details are correct but hasn't been synced.
if (aws_s3::can_schedule()) {
// i can schedule this task
aws_s3::schedule_full_sync2();
site_status::warning("Your site has been scheduled for full Amazon S3 re-synchronisation. This message will clear when this has been completed.", "aws_s3_not_synced");
} else {
// i CAN'T schedule it..
site_status::warning(t('Your site has not been synchronised to Amazon S3. Until it has, your server will continue to serve image content to your visitors.<br />Click <a href="%url" class="g-dialog-link">here</a> to start the synchronisation task.', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::manual_sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
} else {
site_status::warning(t('Amazon S3 module needs configuration. Click <a href="%url">here</a> to go to the configuration page.', array("url" => html::mark_clean(url::site("admin/aws_s3")))), "aws_s3_not_configured");
}
}
module::set_version("aws_s3", 2);
}
log::info("aws_s3", "Module upgrade complete");
}
示例2: addCatalog
public function addCatalog(Request $request)
{
log::info('add catalog');
log::info($request);
try {
if ($request->get("img") != null) {
log::info('if');
$base64data = $request->get("img");
$filename = str_random(60);
$uri = substr($base64data, strpos($base64data, ",") + 1);
$url = public_path() . '/fm_user/images/fm/catalog/' . $request->get('shop_id') . '/';
if (!File::exists($url)) {
File::makeDirectory($url, $mode = 0777, true, true);
}
File::put($url . $filename . '.jpg', base64_decode($uri));
$catalogData = array('media_url' => $url . $filename . '.jpg');
}
$catalogData['location_id'] = $request->get('location_id');
$catalogData['description'] = $request->get('description');
$catalogData['name'] = $request->get('name');
$catalogId = Catalog::create($catalogData)->id;
return Response::json($catalogId);
} catch (Exception $e) {
log::info($e);
return Response::json('ERROR');
}
}
示例3: index
public function index()
{
$user = user::active();
user::logout();
log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", $user->name));
if ($this->input->get("continue")) {
url::redirect($this->input->get("continue"));
}
}
示例4: resume
/**
* Resume a stalled task
* @param string $task_id
*/
public function resume($task_id)
{
access::verify_csrf();
$task = ORM::factory("task", $task_id);
if (!$task->loaded) {
throw new Exception("@todo MISSING_TASK");
}
$view = new View("admin_maintenance_task.html");
$view->task = $task;
log::info("tasks", t("Task %task_name resumed (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)), html::anchor(url::site("admin/maintenance"), t("maintenance")));
print $view;
}
示例5: createAuthForModule
private function createAuthForModule($markerSiteId)
{
$module = Session::get('module');
Log::info('Module create a marker');
Log::info('Module UUID: ' . $module);
$doesAuthExist = Authorization::where('token', '=', $module)->count() > 0;
if ($doesAuthExist) {
log::info('Auth for this module exists for the site');
}
Authorization::create(array('atlas_id' => $markerSiteId, 'token' => $module, 'principal' => 'module:' . $module, 'privileges' => 'STATS'));
Log::debug("Created auth for module");
}
示例6: item_deleted
static function item_deleted($item)
{
if (!$item->is_photo()) {
return;
}
$name = $item->name;
$id = $item->id;
$path = $item->file_path();
$orig = str_replace(VARPATH . 'albums/', VARPATH . 'originals/', $path);
@unlink($orig);
db::build()->from('emboss_mappings')->where('image_id', '=', $id)->delete()->execute();
log::info('emboss', "item_deleted: {$name}");
}
示例7: logout
static function logout()
{
$user = identity::active_user();
if (!$user->guest) {
try {
Session::instance()->destroy();
} catch (Exception $e) {
Kohana_Log::add("error", $e);
}
module::event("user_logout", $user);
}
log::info("user", t("User %name logged out", array("name" => $user->name)), t('<a href="%url">%user_name</a>', array("url" => user_profile::url($user->id), "user_name" => html::clean($user->name))));
}
示例8: logout
static function logout()
{
$user = identity::active_user();
if (!$user->guest) {
try {
Session::instance()->destroy();
} catch (Exception $e) {
Kohana::log("error", $e);
}
module::event("user_logout", $user);
}
log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", html::clean($user->name)));
}
示例9: login
public function login()
{
$data = Input::all();
Log::info($data);
$informacion = array('datos' => 'No se han introducido los datos', 'entro' => false);
log::info("IniciarSesion");
if (isset($data['usuario']) && isset($data['password'])) {
$entro = IniciarSesion::entrar($data['usuario'], md5($data['password']));
$informacion = array('datos' => 'Usuario y/o contraseña inválidos', 'entro' => false);
if (!empty($entro)) {
$informacion = array('datos' => $entro, 'entro' => true);
}
}
return $informacion;
}
示例10: index
public function index()
{
access::verify_csrf();
$user = user::active();
user::logout();
log::info("user", t("User %name logged out", array("name" => p::clean($user->name))), html::anchor("user/{$user->id}", p::clean($user->name)));
if ($this->input->get("continue")) {
$item = url::get_item_from_uri($this->input->get("continue"));
if (access::can("view", $item)) {
url::redirect($this->input->get("continue"));
} else {
url::redirect("");
}
}
}
示例11: buildHtml
public static function buildHtml($tag, Num &$depth)
{
try {
$tabs = "";
//implode("", array_fill(0, $depth->_inc()->getNum(), " "));
$html = "";
if ($tag instanceof Tag) {
$beginTag = "{$tabs}<" . $tag->getTagName();
$tagContent = "";
$endTag = "{$tabs}</" . $tag->getTagName() . ">";
$id = "";
$class = "";
$attributes = "";
if (!Utils::isNullOrEmptyString($tag->getId())) {
$id = TagLabels::ID . "='" . $tag->getId() . "'";
}
if (count($tag->getClassList()) > 0) {
$class = TagLabels::_CLASS . "='";
for ($index = 0, $max = count($tag->getClassList()); $index < $max; $index++) {
$class .= $tag->getClassList()[$index] . " ";
}
$class .= "'";
}
if (count($tag->getAttributeList()) > 0) {
foreach ($tag->getAttributeList() as $key => $value) {
$attributes .= " {$key}=\"{$value}\" ";
}
}
$beginTag .= " " . $id . " " . $class . " " . $attributes . " >";
if (!$tag instanceof SingleTag) {
for ($index = 0, $max = count($tag->getChildList()); $index < $max; $index++) {
$tagContent .= TagUtils::buildHtml($tag->getChildList()[$index], $depth);
$depth->_dec();
}
$html = $beginTag . $tagContent . $endTag;
} else {
$html = $beginTag;
}
} else {
if (is_string($tag) || is_numeric($tag)) {
return $tag;
}
}
} catch (Exception $e) {
log::info("Caught exception: ', {$e->getMessage}()");
}
return $html;
}
示例12: index
public function index()
{
//access::verify_csrf();
$user = user::active();
user::logout();
log::info("user", t("User %name logged out", array("name" => p::clean($user->name))), html::anchor("user/{$user->id}", p::clean($user->name)));
if ($continue_url = $this->input->get("continue")) {
$item = url::get_item_from_uri($continue_url);
if (access::can("view", $item)) {
// Don't use url::redirect() because it'll call url::site() and munge the continue url.
header("Location: {$continue_url}");
} else {
url::redirect("albums/1");
}
}
}
示例13: actualizaFechaIp
public static function actualizaFechaIp()
{
$nro_persona = Auth::user()->nro_persona;
//$ip = Request::getClientIp();
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
log::info("Conexion desde: '{$ip}'");
$dt = new DateTime('NOW');
$fecha = $dt->format('Y-m-d H:i:s');
$resultado = DB::update("\n UPDATE hb_usuario\n SET ultima_ip = '{$ip}', ultimo_acceso = convert(datetime ,'{$fecha}',120)\n WHERE nro_persona = {$nro_persona}\n ");
}
示例14: _try_login
private function _try_login()
{
$form = $this->_login_form();
$valid = $form->validate();
if ($valid) {
$user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find();
if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) {
log::warning("user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value)));
$form->login->inputs["name"]->add_error("invalid_login", 1);
$valid = false;
}
}
if ($valid) {
user::login($user);
log::info("user", t("User %name logged in", array("name" => $user->name)));
print json_encode(array("result" => "success"));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例15: _auth
private function _auth($url)
{
$form = user::get_login_form($url);
$valid = $form->validate();
if ($valid) {
$user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find();
if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) {
log::warning("user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value)));
$form->login->inputs["name"]->add_error("invalid_login", 1);
$valid = false;
}
}
if ($valid) {
user::login($user);
log::info("user", t("User %name logged in", array("name" => $user->name)));
}
// Either way, regenerate the session id to avoid session trapping
Session::instance()->regenerate();
return array($valid, $form);
}