• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP execute_delayed_write_query函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中execute_delayed_write_query函数的典型用法代码示例。如果您正苦于以下问题:PHP execute_delayed_write_query函数的具体用法?PHP execute_delayed_write_query怎么用?PHP execute_delayed_write_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了execute_delayed_write_query函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: elgg_geocode_location

/**
 * Encode a location into a latitude and longitude, caching the result.
 *
 * Works by triggering the 'geocode' 'location' plugin
 * hook, and requires a geocoding plugin to be installed.
 *
 * @param string $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 * @return string|false
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    if (is_array($location)) {
        return false;
    }
    $location = sanitise_string($location);
    // Look for cached version
    $query = "SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'";
    $cached_location = get_data_row($query);
    if ($cached_location) {
        return array('lat' => $cached_location->lat, 'long' => $cached_location->long);
    }
    // Trigger geocode event if not cached
    $return = false;
    $return = elgg_trigger_plugin_hook('geocode', 'location', array('location' => $location), $return);
    // If returned, cache and return value
    if ($return && is_array($return)) {
        $lat = (double) $return['lat'];
        $long = (double) $return['long'];
        // Put into cache at the end of the page since we don't really care that much
        $query = "INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache " . " (location, lat, `long`) VALUES ('{$location}', '{$lat}', '{$long}')" . " ON DUPLICATE KEY UPDATE lat='{$lat}', `long`='{$long}'";
        execute_delayed_write_query($query);
    }
    return $return;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:35,代码来源:location.php


示例2: elgg_geocode_location

/**
 * Encode a location into a latitude and longitude, caching the result.
 *
 * Works by triggering the 'geocode' 'location' plugin hook, and requires a geocoding module to be installed
 * activated in order to work.
 *
 * @param String $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    // Handle cases where we are passed an array (shouldn't be but can happen if location is a tag field)
    if (is_array($location)) {
        $location = implode(', ', $location);
    }
    $location = sanitise_string($location);
    // Look for cached version
    $cached_location = get_data_row("SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'");
    if ($cached_location) {
        return array('lat' => $cached_location->lat, 'long' => $cached_location->long);
    }
    // Trigger geocode event if not cached
    $return = false;
    $return = trigger_plugin_hook('geocode', 'location', array('location' => $location), $return);
    // If returned, cache and return value
    if ($return && is_array($return)) {
        $lat = (double) $return['lat'];
        $long = (double) $return['long'];
        // Put into cache at the end of the page since we don't really care that much
        execute_delayed_write_query("INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache (location, lat, `long`) VALUES ('{$location}', '{$lat}', '{$long}') ON DUPLICATE KEY UPDATE lat='{$lat}', `long`='{$long}'");
    }
    return $return;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:33,代码来源:location.php


示例3: elgg_geocode_location

/**
 * Encode a location into a latitude and longitude, caching the result.
 *
 * Works by triggering the 'geocode' 'location' plugin hook, and requires a geocoding module to be installed
 * activated in order to work.
 * 
 * @param String $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    $location = sanitise_string($location);
    // Look for cached version
    $cached_location = get_data_row("SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'");
    // Trigger geocode event
    $return = false;
    $return = trigger_plugin_hook('geocode', 'location', array('location' => $location, $return));
    // If returned, cache and return value
    if ($return && is_array($return)) {
        $lat = (int) $return['lat'];
        $long = (int) $return['long'];
        // Put into cache at the end of the page since we don't really care that much
        execute_delayed_write_query("INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache (lat, long) VALUES ({$lat}, {$long}) ON DUPLICATE KEY UPDATE lat={$lat} long={$long}");
    }
    return $return;
}
开发者ID:eokyere,项目名称:elgg,代码行数:26,代码来源:location.php


示例4: set_last_login

/**
 * Sets the last logon time of the given user to right now.
 *
 * @param int $user_guid The user GUID
 */
function set_last_login($user_guid)
{
    $user_guid = (int) $user_guid;
    global $CONFIG;
    $time = time();
    execute_delayed_write_query("UPDATE {$CONFIG->dbprefix}users_entity set prev_last_login = last_login, last_login = {$time} where guid = {$user_guid}");
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:12,代码来源:users.php


示例5: setLastLogin

 /**
  * Sets the last logon time of the given user to right now.
  *
  * @param int $user_guid The user GUID
  *
  * @return void
  */
 function setLastLogin($user_guid)
 {
     $user_guid = (int) $user_guid;
     $time = time();
     $query = "UPDATE {$this->CONFIG->dbprefix}users_entity\n\t\t\tset prev_last_login = last_login, last_login = {$time} where guid = {$user_guid}";
     execute_delayed_write_query($query);
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:14,代码来源:UsersTable.php


示例6: setLastLogin

 /**
  * Sets the last logon time of the given user to right now.
  *
  * @param ElggUser $user User entity
  * @return void
  */
 public function setLastLogin(ElggUser $user)
 {
     $time = $this->getCurrentTime()->getTimestamp();
     if ($user->last_login == $time) {
         // no change required
         return;
     }
     $query = "\n\t\t\tUPDATE {$this->table}\n\t\t\tSET\n\t\t\t\tprev_last_login = last_login,\n\t\t\t\tlast_login = :last_login\n\t\t\tWHERE guid = :guid\n\t\t";
     $params = [':last_login' => $time, ':guid' => (int) $user->guid];
     $user->prev_last_login = $user->last_login;
     $user->last_login = $time;
     execute_delayed_write_query($query, null, $params);
     $this->entity_cache->set($user);
     // If we save the user to memcache during this request, then we'll end up with the
     // old (incorrect) attributes cached. Hence we want to invalidate as late as possible.
     // the user object gets saved
     register_shutdown_function(function () use($user) {
         $user->storeInPersistedCache(_elgg_get_memcache('new_entity_cache'));
     });
 }
开发者ID:elgg,项目名称:elgg,代码行数:26,代码来源:UsersTable.php


示例7: system_log

/**
 * Log a system event related to a specific object.
 *
 * This is called by the event system and should not be called directly.
 *
 * @param object $object The object you're talking about.
 * @param string $event  The event being logged
 * @return void
 */
function system_log($object, $event)
{
    global $CONFIG;
    static $log_cache;
    static $cache_size = 0;
    if ($object instanceof Loggable) {
        /* @var \ElggEntity|\ElggExtender $object */
        if (elgg_get_config('version') < 2012012000) {
            // this is a site that doesn't have the ip_address column yet
            return;
        }
        // reset cache if it has grown too large
        if (!is_array($log_cache) || $cache_size > 500) {
            $log_cache = array();
            $cache_size = 0;
        }
        // Has loggable interface, extract the necessary information and store
        $object_id = (int) $object->getSystemLogID();
        $object_class = get_class($object);
        $object_type = $object->getType();
        $object_subtype = $object->getSubtype();
        $event = sanitise_string($event);
        $time = time();
        $ip_address = sanitize_string(_elgg_services()->request->getClientIp());
        if (!$ip_address) {
            $ip_address = '0.0.0.0';
        }
        $performed_by = elgg_get_logged_in_user_guid();
        if (isset($object->access_id)) {
            $access_id = $object->access_id;
        } else {
            $access_id = ACCESS_PUBLIC;
        }
        if (isset($object->enabled)) {
            $enabled = $object->enabled;
        } else {
            $enabled = 'yes';
        }
        if (isset($object->owner_guid)) {
            $owner_guid = $object->owner_guid;
        } else {
            $owner_guid = 0;
        }
        // Create log if we haven't already created it
        if (!isset($log_cache[$time][$object_id][$event])) {
            $query = "INSERT into {$CONFIG->dbprefix}system_log\n\t\t\t\t(object_id, object_class, object_type, object_subtype, event,\n\t\t\t\tperformed_by_guid, owner_guid, access_id, enabled, time_created, ip_address)\n\t\t\tVALUES\n\t\t\t\t('{$object_id}','{$object_class}','{$object_type}', '{$object_subtype}', '{$event}',\n\t\t\t\t{$performed_by}, {$owner_guid}, {$access_id}, '{$enabled}', '{$time}', '{$ip_address}')";
            execute_delayed_write_query($query);
            $log_cache[$time][$object_id][$event] = true;
            $cache_size += 1;
        }
    }
}
开发者ID:elgg,项目名称:elgg,代码行数:61,代码来源:system_log.php



注:本文中的execute_delayed_write_query函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP execute_program函数代码示例发布时间:2022-05-15
下一篇:
PHP execute_action函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap