本文整理汇总了PHP中nxt_cache_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_cache_delete函数的具体用法?PHP nxt_cache_delete怎么用?PHP nxt_cache_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxt_cache_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friends_clear_friend_object_cache
function friends_clear_friend_object_cache($friendship_id)
{
if (!($friendship = new BP_Friends_Friendship($friendship_id))) {
return false;
}
nxt_cache_delete('friends_friend_ids_' . $friendship->initiator_user_id, 'bp');
nxt_cache_delete('friends_friend_ids_' . $friendship->friend_user_id, 'bp');
nxt_cache_delete('bp_total_friend_count_' . $friendship->initiator_user_id, 'bp');
nxt_cache_delete('bp_total_friend_count_' . $friendship->friend_user_id, 'bp');
}
示例2: refresh_blog_details
/**
* Clear the blog details cache.
*
* @since MU
*
* @param int $blog_id Blog ID
*/
function refresh_blog_details($blog_id)
{
$blog_id = (int) $blog_id;
$details = get_blog_details($blog_id, false);
nxt_cache_delete($blog_id, 'blog-details');
nxt_cache_delete($blog_id . 'short', 'blog-details');
nxt_cache_delete(md5($details->domain . $details->path), 'blog-lookup');
nxt_cache_delete('current_blog_' . $details->domain, 'site-options');
nxt_cache_delete('current_blog_' . $details->domain . $details->path, 'site-options');
}
示例3: bb_move_forum_topics
function bb_move_forum_topics($from_forum_id, $to_forum_id)
{
global $bbdb;
$from_forum_id = (int) $from_forum_id;
$to_forum_id = (int) $to_forum_id;
add_filter('get_forum_where', 'bb_no_where');
// Just in case
$from_forum = bb_get_forum($from_forum_id);
if (!($to_forum = bb_get_forum($to_forum_id))) {
return false;
}
$posts = $to_forum->posts + ($from_forum ? $from_forum->posts : 0);
$topics = $to_forum->topics + ($from_forum ? $from_forum->topics : 0);
$bbdb->update($bbdb->forums, compact('topics', 'posts'), array('forum_id' => $to_forum_id));
$bbdb->update($bbdb->forums, array('topics' => 0, 'posts' => 0), array('forum_id' => $from_forum_id));
$bbdb->update($bbdb->posts, array('forum_id' => $to_forum_id), array('forum_id' => $from_forum_id));
$topic_ids = $bbdb->get_col($bbdb->prepare("SELECT topic_id FROM {$bbdb->topics} WHERE forum_id = %d", $from_forum_id));
$return = $bbdb->update($bbdb->topics, array('forum_id' => $to_forum_id), array('forum_id' => $from_forum_id));
nxt_cache_flush('bb_post');
if ($topic_ids) {
foreach ($topic_ids as $topic_id) {
// should maybe just flush these groups
nxt_cache_delete($topic_id, 'bb_topic');
nxt_cache_delete($topic_id, 'bb_thread');
}
}
nxt_cache_delete($from_forum_id, 'bb_forum');
nxt_cache_delete($to_forum_id, 'bb_forum');
nxt_cache_flush('bb_forums');
return $return;
}
示例4: bp_xprofile_delete_meta
function bp_xprofile_delete_meta($object_id, $object_type, $meta_key = false, $meta_value = false)
{
global $nxtdb, $bp;
$object_id = (int) $object_id;
if (!$object_id) {
return false;
}
if (!isset($object_type)) {
return false;
}
if (!in_array($object_type, array('group', 'field', 'data'))) {
return false;
}
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
if (is_array($meta_value) || is_object($meta_value)) {
$meta_value = serialize($meta_value);
}
$meta_value = trim($meta_value);
if (!$meta_key) {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->profile->table_name_meta . " WHERE object_id = %d AND object_type = %s", $object_id, $object_type));
} else {
if ($meta_value) {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->profile->table_name_meta . " WHERE object_id = %d AND object_type = %s AND meta_key = %s AND meta_value = %s", $object_id, $object_type, $meta_key, $meta_value));
} else {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->profile->table_name_meta . " WHERE object_id = %d AND object_type = %s AND meta_key = %s", $object_id, $object_type, $meta_key));
}
}
// Delete the cached object
nxt_cache_delete('bp_xprofile_meta_' . $object_type . '_' . $object_id . '_' . $meta_key, 'bp');
return true;
}
示例5: useNonce
function useNonce($server_url, $timestamp, $salt)
{
global $Auth_OpenID_SKEW;
if (abs($timestamp - time()) > $Auth_OpenID_SKEW) {
return false;
}
$key = $this->_getNonceKey($server_url, $timestamp, $salt);
// prevent the likelihood of a race condition - don't rely on cache
nxt_cache_delete('openid_nonces', 'options');
$nonces = get_option('openid_nonces');
if ($nonces == null) {
$nonces = array();
}
if (array_key_exists($key, $nonces)) {
return false;
} else {
$nonces[$key] = $timestamp;
update_option('openid_nonces', $nonces);
return true;
}
}
示例6: bp_activity_delete
/**
* Deleting Activity
*
* If you're looking to hook into one action that provides the ID(s) of
* the activity/activities deleted, then use:
*
* add_action( 'bp_activity_deleted_activities', 'my_function' );
*
* The action passes one parameter that is a single activity ID or an
* array of activity IDs depending on the number deleted.
*
* If you are deleting an activity comment please use bp_activity_delete_comment();
*
* @since 1.0.0
*
* @param array $args See docs for $defaults for details
*
* @global object $bp BuddyPress global settings
* @uses nxt_parse_args()
* @uses bp_activity_adjust_mention_count()
* @uses BP_Activity_Activity::delete() {@link BP_Activity_Activity}
* @uses do_action() To call the 'bp_before_activity_delete' hook
* @uses bp_get_user_meta()
* @uses bp_delete_user_meta()
* @uses do_action() To call the 'bp_activity_delete' hook
* @uses do_action() To call the 'bp_activity_deleted_activities' hook
* @uses nxt_cache_delete()
*
* @return bool True on success, false on failure
*/
function bp_activity_delete($args = '')
{
global $bp;
// Pass one or more the of following variables to delete by those variables
$defaults = array('id' => false, 'action' => false, 'content' => false, 'component' => false, 'type' => false, 'primary_link' => false, 'user_id' => false, 'item_id' => false, 'secondary_item_id' => false, 'date_recorded' => false, 'hide_sitewide' => false);
$args = nxt_parse_args($args, $defaults);
// Adjust the new mention count of any mentioned member
bp_activity_adjust_mention_count($args['id'], 'delete');
if (!($activity_ids_deleted = BP_Activity_Activity::delete($args))) {
return false;
}
// Check if the user's latest update has been deleted
if (empty($args['user_id'])) {
$user_id = $bp->loggedin_user->id;
} else {
$user_id = $args['user_id'];
}
do_action('bp_before_activity_delete', $args);
$latest_update = bp_get_user_meta($user_id, 'bp_latest_update', true);
if (!empty($latest_update)) {
if (in_array((int) $latest_update['id'], (array) $activity_ids_deleted)) {
bp_delete_user_meta($user_id, 'bp_latest_update');
}
}
do_action('bp_activity_delete', $args);
do_action('bp_activity_deleted_activities', $activity_ids_deleted);
nxt_cache_delete('bp_activity_sitewide_front', 'bp');
return true;
}
示例7: BuildSitemap
//.........这里部分代码省略.........
if (!$qt["enabled"]) {
$this->AddUrl($permalink, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio);
}
qt_permalink($qt, $permalink, $post->post_content, $post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt, $isPage ? $cf_pages : $cf_posts, $prio, $this);
if ($inSubPages) {
$subPage = '';
for ($p = 1; $p <= $post->postPages; $p++) {
if (get_option('permalink_structure') == '') {
$subPage = $permalink . '&page=' . ($p + 1);
} else {
$subPage = trailingslashit($permalink) . user_trailingslashit($p + 1, 'single_paged');
}
if (!$qt["enabled"]) {
$this->AddUrl($subPage, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio);
}
//qt_permalink($qt, $subPage, $post->post_content, ($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt), ($isPage?$cf_pages:$cf_posts), $prio, $this);
}
}
}
//Update the status every 100 posts and at the end.
//If the script breaks because of memory or time limit,
//we have a "last reponded" value which can be compared to the server settings
if ($zz == 100 || $z == $postCount) {
$status->SaveStep($z);
$zz = 0;
} else {
$zz++;
}
$z++;
//Clean cache because it's incomplete
if (version_compare($nxt_version, "2.5", ">=")) {
//nxt 2.5 makes a mysql query for every clean_post_cache to clear the child cache
//so I've copied the function here until a patch arrives...
nxt_cache_delete($post->ID, 'posts');
nxt_cache_delete($post->ID, 'post_meta');
clean_object_term_cache($post->ID, 'post');
} else {
clean_post_cache($post->ID);
}
}
unset($postRes);
unset($prioProvider);
if ($this->GetOption("b_safemode") !== true && $con) {
mysql_close($con);
}
}
if ($debug) {
$this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Postings"));
}
}
//Add the cats
if ($this->GetOption("in_cats")) {
if ($debug) {
$this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Cats"));
}
$exclCats = $this->GetOption("b_exclude_cats");
// Excluded cats
if ($exclCats == null) {
$exclCats = array();
}
if (!$this->IsTaxonomySupported()) {
$catsRes = $nxtdb->get_results("\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tc.cat_ID AS ID,\r\n\t\t\t\t\t\t\t\tMAX(p.post_modified_gmt) AS last_mod\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->categories . "` c,\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->post2cat . "` pc,\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->posts . "` p\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tpc.category_id = c.cat_ID\r\n\t\t\t\t\t\t\t\tAND p.ID = pc.post_id\r\n\t\t\t\t\t\t\t\tAND p.post_status = 'publish'\r\n\t\t\t\t\t\t\t\tAND p.post_type='post'\r\n\t\t\t\t\t\t\tGROUP\r\n\t\t\t\t\t\t\t\tBY c.cat_id\r\n\t\t\t\t\t\t\t");
if ($catsRes) {
foreach ($catsRes as $cat) {
if ($cat && $cat->ID && $cat->ID > 0 && !in_array($cat->ID, $exclCats)) {
if ($debug) {
示例8: save
/**
* Validates class variables and saves to database
*
* @access public
* @global object $bp BuddyPress global settings
* @global nxtdb $nxtdb NXTClass database object
* @param DPA_Achievement $old_achievement A copy of the Achievement which is about to be saved, for comparision purposes
* @return bool Whether the achievement was saved successfully or not.
* @since 2.0
* @uses nxt_Error
*/
function save($old_achievement = null)
{
global $bp, $nxtdb;
$errors = new nxt_Error();
if ($this->id) {
$this->id = apply_filters('dpa_achievement_id_before_save', (int) $this->id, $this);
}
$this->action_id = apply_filters('dpa_achievement_action_id_before_save', (int) $this->action_id, $this);
$this->picture_id = apply_filters('dpa_achievement_picture_id_before_save', (int) $this->picture_id, $this);
$this->action_count = apply_filters('dpa_achievement_action_count_before_save', (int) $this->action_count, $this);
$this->name = stripslashes(apply_filters('dpa_achievement_name_before_save', $this->name, $this));
$this->description = stripslashes(apply_filters('dpa_achievement_description_before_save', $this->description, $this));
$this->points = apply_filters('dpa_achievement_points_before_save', (int) $this->points, $this);
$this->is_active = apply_filters('dpa_achievement_is_active_before_save', (int) $this->is_active, $this);
$this->slug = apply_filters('dpa_achievement_slug_before_save', $this->slug, $this);
$this->site_id = apply_filters('dpa_achievement_site_id_before_save', (int) $this->site_id, $this);
$this->group_id = apply_filters('dpa_achievement_group_id_before_save', (int) $this->group_id, $this);
DPA_Achievement::validate_achievement_details($this, $old_achievement, $errors);
do_action('dpa_achievement_before_save', $this, $old_achievement, $errors);
if ($errors->get_error_code()) {
return $errors;
}
if ($this->id) {
$result = $nxtdb->query($nxtdb->prepare("UPDATE {$bp->achievements->table_achievements} SET action_id = %d, picture_id = %d, action_count = %d, name = %s, description = %s, points = %d, is_active = %d, slug = %s, site_id = %d, group_id = %d WHERE id = %d LIMIT 1", $this->action_id, $this->picture_id, $this->action_count, $this->name, $this->description, $this->points, $this->is_active, $this->slug, $this->site_id, $this->group_id, $this->id));
} else {
// Save
$result = $nxtdb->insert($bp->achievements->table_achievements, array('action_id' => $this->action_id, 'picture_id' => $this->picture_id, 'action_count' => $this->action_count, 'name' => $this->name, 'description' => $this->description, 'points' => $this->points, 'is_active' => $this->is_active, 'slug' => $this->slug, 'site_id' => $this->site_id, 'group_id' => $this->group_id), array('%d', '%d', '%d', '%s', '%s', '%d', '%d', '%s', '%d', '%d'));
$this->id = $nxtdb->insert_id;
}
// Remove active actions cache
nxt_cache_delete('dpa_active_actions', 'dpa');
do_action('dpa_achievement_after_save', $this, $old_achievement);
return $result;
}
示例9: nxt_set_password
/**
* Updates the user's password with a new encrypted one.
*
* For integration with other applications, this function can be overwritten to
* instead use the other package password checking algorithm.
*
* @since 2.5
* @uses $nxtdb NXTClass database object for queries
* @uses nxt_hash_password() Used to encrypt the user's password before passing to the database
*
* @param string $password The plaintext new user password
* @param int $user_id User ID
*/
function nxt_set_password($password, $user_id)
{
global $nxtdb;
$hash = nxt_hash_password($password);
$nxtdb->update($nxtdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id));
nxt_cache_delete($user_id, 'users');
}
示例10: dpa_achievement_unlocked_update_meta
/**
* When someone unlocks an Achievement, create/update the relevant metas.
*
* @param int $achievement_id
* @param int $user_id
* @since 2.0
*/
function dpa_achievement_unlocked_update_meta($achievement_id, $user_id)
{
$meta = dpa_get_achievements_meta();
$meta[$achievement_id]['no_of_unlocks'] += apply_filters('dpa_achievement_unlocked_update_meta', 1);
update_site_option('achievements_meta', $meta);
nxt_cache_delete('dpa_achievements_meta', 'dpa');
dpa_delete_highscore_cache();
}
示例11: groups_clear_group_user_object_cache
function groups_clear_group_user_object_cache($group_id, $user_id)
{
nxt_cache_delete('bp_total_groups_for_user_' . $user_id);
}
示例12: update_usermeta
/**
* Update metadata of user.
*
* There is no need to serialize values, they will be serialized if it is
* needed. The metadata key can only be a string with underscores. All else will
* be removed.
*
* Will remove the metadata, if the meta value is empty.
*
* @since 2.0.0
* @deprecated 3.0.0
* @deprecated Use update_user_meta()
* @see update_user_meta()
*
* @param int $user_id User ID
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value.
* @return bool True on successful update, false on failure.
*/
function update_usermeta($user_id, $meta_key, $meta_value)
{
_deprecated_function(__FUNCTION__, '3.0', 'update_user_meta()');
global $nxtdb;
if (!is_numeric($user_id)) {
return false;
}
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
/** @todo Might need fix because usermeta data is assumed to be already escaped */
if (is_string($meta_value)) {
$meta_value = stripslashes($meta_value);
}
$meta_value = maybe_serialize($meta_value);
if (empty($meta_value)) {
return delete_usermeta($user_id, $meta_key);
}
$cur = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM {$nxtdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
if ($cur) {
do_action('update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
}
if (!$cur) {
$nxtdb->insert($nxtdb->usermeta, compact('user_id', 'meta_key', 'meta_value'));
} else {
if ($cur->meta_value != $meta_value) {
$nxtdb->update($nxtdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key'));
} else {
return false;
}
}
clean_user_cache($user_id);
nxt_cache_delete($user_id, 'user_meta');
if (!$cur) {
do_action('added_usermeta', $nxtdb->insert_id, $user_id, $meta_key, $meta_value);
} else {
do_action('updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
}
return true;
}
示例13: nxt_update_user
/**
* Update an user in the database.
*
* It is possible to update a user's password by specifying the 'user_pass'
* value in the $userdata parameter array.
*
* If $userdata does not contain an 'ID' key, then a new user will be created
* and the new user's ID will be returned.
*
* If current user's password is being updated, then the cookies will be
* cleared.
*
* @since 2.0.0
* @see nxt_insert_user() For what fields can be set in $userdata
* @uses nxt_insert_user() Used to update existing user or add new one if user doesn't exist already
*
* @param array $userdata An array of user data.
* @return int The updated user's ID.
*/
function nxt_update_user($userdata)
{
$ID = (int) $userdata['ID'];
// First, get all of the original fields
$user_obj = get_userdata($ID);
$user = get_object_vars($user_obj->data);
// Add additional custom fields
foreach (_get_additional_user_keys($user_obj) as $key) {
$user[$key] = get_user_meta($ID, $key, true);
}
// Escape data pulled from DB.
$user = add_magic_quotes($user);
// If password is changing, hash it now.
if (!empty($userdata['user_pass'])) {
$plaintext_pass = $userdata['user_pass'];
$userdata['user_pass'] = nxt_hash_password($userdata['user_pass']);
}
nxt_cache_delete($user['user_email'], 'useremail');
// Merge old and new fields with new fields overwriting old ones.
$userdata = array_merge($user, $userdata);
$user_id = nxt_insert_user($userdata);
// Update the cookies if the password changed.
$current_user = nxt_get_current_user();
if ($current_user->ID == $ID) {
if (isset($plaintext_pass)) {
nxt_clear_auth_cookie();
nxt_set_auth_cookie($ID);
}
}
return $user_id;
}
示例14: add_user_to_blog
/**
* Add a user to a blog.
*
* Use the 'add_user_to_blog' action to fire an event when
* users are added to a blog.
*
* @since MU 1.0
*
* @param int $blog_id ID of the blog you're adding the user to.
* @param int $user_id ID of the user you're adding.
* @param string $role The role you want the user to have
* @return bool
*/
function add_user_to_blog($blog_id, $user_id, $role)
{
switch_to_blog($blog_id);
$user = new nxt_User($user_id);
if (empty($user->ID)) {
restore_current_blog();
return new nxt_Error('user_does_not_exist', __('That user does not exist.'));
}
if (!get_user_meta($user_id, 'primary_blog', true)) {
update_user_meta($user_id, 'primary_blog', $blog_id);
$details = get_blog_details($blog_id);
update_user_meta($user_id, 'source_domain', $details->domain);
}
$user->set_role($role);
do_action('add_user_to_blog', $user_id, $role, $blog_id);
nxt_cache_delete($user_id, 'users');
restore_current_blog();
return true;
}
示例15: groups_delete_groupmeta
function groups_delete_groupmeta($group_id, $meta_key = false, $meta_value = false)
{
global $nxtdb, $bp;
if (!is_numeric($group_id)) {
return false;
}
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
if (is_array($meta_value) || is_object($meta_value)) {
$meta_value = serialize($meta_value);
}
$meta_value = trim($meta_value);
if (!$meta_key) {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id));
} else {
if ($meta_value) {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value));
} else {
$nxtdb->query($nxtdb->prepare("DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key));
}
}
// Delete the cached object
nxt_cache_delete('bp_groups_groupmeta_' . $group_id . '_' . $meta_key, 'bp');
return true;
}