本文整理汇总了PHP中delete_site_transient函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_site_transient函数的具体用法?PHP delete_site_transient怎么用?PHP delete_site_transient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_site_transient函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute_upgrade
/**
* Execute module upgrade
*
* @return void
*/
public function execute_upgrade()
{
global $itsec_old_version;
if ($itsec_old_version < 4036) {
delete_site_transient('itsec_online_files_remote_checksums');
}
}
示例2: after_switch_theme
public function after_switch_theme()
{
// clean theme updates cache
delete_site_transient('update_themes');
// ping to api server
self::api_request('ping');
}
示例3: _get_framework_latest_version
/**
* {@inheritdoc}
* @internal
*/
public function _get_framework_latest_version($force_check)
{
$user_slash_repo = fw()->manifest->get($this->manifest_key);
if (empty($user_slash_repo)) {
return false;
}
if (!preg_match($this->manifest_key_regex, $user_slash_repo)) {
return new WP_Error('fw_ext_update_github_framework_manifest_invalid', __('Framework manifest has invalid "github_update" parameter. Please use "user/repo" format.', 'fw'));
}
$theme_id = preg_replace('[^a-z0-9_]', '_', fw()->theme->manifest->get_id());
$transient_id = 'fw_ext_update_gh_' . $theme_id . '_fw';
// this should be 45 characters or less
if ($force_check) {
delete_site_transient($transient_id);
} else {
$cache = get_site_transient($transient_id);
if ($cache !== false && isset($cache[$user_slash_repo])) {
return $cache[$user_slash_repo];
}
}
$latest_version = $this->fetch_latest_version($user_slash_repo);
if (empty($latest_version)) {
return new WP_Error(sprintf(__('Failed to fetch framework latest version from github "%s".', 'fw'), $user_slash_repo));
}
if (is_wp_error($latest_version)) {
return $latest_version;
}
set_site_transient($transient_id, array($user_slash_repo => $latest_version), $this->transient_expiration);
return $latest_version;
}
示例4: degg_remove_notifications
function degg_remove_notifications()
{
if (!current_user_can('edit_dashboard')) {
delete_site_transient('update_core');
remove_action('admin_init', '_maybe_update_core');
remove_action('wp_version_check', 'wp_version_check');
wp_clear_scheduled_hook('wp_version_check');
remove_action('init', 'wp_schedule_update_checks');
delete_site_transient('update_plugins');
remove_action('admin_init', '_maybe_update_plugins');
remove_action('load-plugins.php', 'wp_update_plugins');
remove_action('load-update-core.php', 'wp_update_plugins');
remove_action('load-update.php', 'wp_update_plugins');
remove_action('wp_update_plugins', 'wp_update_plugins');
wp_clear_scheduled_hook('wp_update_plugins');
delete_site_transient('update_themes');
remove_action('admin_init', '_maybe_update_themes');
remove_action('load-themes.php', 'wp_update_themes');
remove_action('load-update-core.php', 'wp_update_themes');
remove_action('load-update.php', 'wp_update_themes');
remove_action('wp_update_themes', 'wp_update_themes');
wp_clear_scheduled_hook('wp_update_themes');
add_action('admin_print_styles', 'degg_admin_editor_styles');
}
}
示例5: register
/**
* Register plugin/theme update.
*
* @param string $name
* @param string $type
* @param string $remote
* @param array $options
*/
public function register($name, $type, $remote, array $options = array())
{
$options = array_merge(compact('name', 'type', 'remote'), $options);
if (!isset($options['id'])) {
$options['id'] = $type == 'plugin' ? "{$name}/{$name}.php" : $name;
}
if ($type == 'plugin') {
$this->plugins[$name] = $options;
} else {
$this->themes[$name] = $options;
}
// check expiration
if (isset($options['expiration'])) {
$timeout = $options['expiration'];
if ($type == 'plugin' and $transient = get_site_transient('update_plugins') and isset($transient->response[$options['id']], $transient->last_checked)) {
if (time() - $transient->last_checked > $timeout) {
delete_site_transient('update_plugins');
}
}
if ($type == 'theme' and $transient = get_site_transient('update_themes') and isset($transient->response[$options['id']], $transient->last_checked)) {
if (time() - $transient->last_checked > $timeout) {
delete_site_transient('update_themes');
}
}
}
}
示例6: uninstall
static function uninstall()
{
global $wpdb;
if (is_multisite()) {
// Cleanup Network install
foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
switch_to_blog($blog['blog_id']);
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
restore_current_blog();
}
delete_site_option('gadash_network_options');
delete_site_transient('ga_dash_refresh_token');
} else {
// Cleanup Single install
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
}
}
示例7: upgrade
public function upgrade($plugin, $url)
{
$this->init();
$this->upgrade_strings();
add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
// inject our certificate, in case we are on machine w/o CA
add_action('http_api_curl', array(Ai1ec_Http_Utility::instance(), 'curl_inject_certificate'));
$this->run(array('package' => $url, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('plugin' => $plugin)));
// Cleanup our hooks, in case something else does an upgrade on
// this connection.
remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
if (!$this->result || is_wp_error($this->result)) {
return $this->result;
}
// Force refresh of plugin update information
delete_site_transient('update_plugins');
wp_cache_delete('plugins', 'plugins');
// activate the plugin
activate_plugin($plugin);
echo '<p>Plugin activated.</p>';
echo '<a href="' . admin_url('index.php') . '">Continue Here</a>';
return true;
}
示例8: wds_ajax_wds_reset_transient
/**
* AJAX Helper to delete our transient when a widget is saved
*/
function wds_ajax_wds_reset_transient()
{
// Delete our footer transient. This runs when a widget is saved or updated. Only do this if our nonce is passed.
if (!empty($_REQUEST['wds-widget-nonce'])) {
delete_site_transient('wds_footer_widgets');
}
}
示例9: delete_transients
function delete_transients()
{
delete_site_transient('update_plugins');
delete_site_transient($this->config['slug'] . '_new_version');
delete_site_transient($this->config['slug'] . '_github_data');
delete_site_transient($this->config['slug'] . '_changelog');
}
示例10: update
protected function update($version, $locale)
{
$args = $this->input();
$version = isset($args['version']) ? $args['version'] : false;
$locale = isset($args['locale']) ? $args['locale'] : get_locale();
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
delete_site_transient('update_core');
wp_version_check(array(), true);
if ($version) {
$update = find_core_update($version, $locale);
} else {
$update = $this->find_latest_update_offer();
}
/**
* Pre-upgrade action
*
* @since 3.9.3
*
* @param object|array $update as returned by find_core_update() or find_core_auto_update()
*/
do_action('jetpack_pre_core_upgrade', $update);
$skin = new Automatic_Upgrader_Skin();
$upgrader = new Core_Upgrader($skin);
$this->new_version = $upgrader->upgrade($update);
$this->log = $upgrader->skin->get_upgrade_messages();
if (is_wp_error($this->new_version)) {
return $this->new_version;
}
return $this->new_version;
}
示例11: get_ep_host
/**
* Retrieve the appropriate EP_HOST
*
* Looks at the defined EP_HOST or a backup global should the defined host failed.
* Priority is given to the EP_HOST constand with the backups only used when needed.
*
* @since 1.6
*
* @global array $ep_backup_host array of backup hosts
*
* @param bool $force Whether to force a new lookup or not
* @param bool $use_only_backups Forces the use of only the backup array, no others
*
* @return string|WP_Error the host to use or an error
*/
public function get_ep_host($force = false, $use_only_backups = false)
{
global $ep_backup_host;
// Delete the transient if we want to force a new good host lookup
if (true === $force) {
delete_site_transient('ep_last_good_host');
}
$last_good_host = get_site_transient('ep_last_good_host');
if ($last_good_host) {
return $last_good_host;
}
// If nothing is defined just return an error
if (!defined('EP_HOST') && !$ep_backup_host) {
return new WP_Error('elasticpress', __('No running host available.', 'elasticpress'));
}
$hosts = array();
if (defined('EP_HOST') && false === $use_only_backups) {
$hosts[] = EP_HOST;
}
// If no backups are defined just return the host
if ($ep_backup_host && is_array($ep_backup_host)) {
$hosts = array_merge($hosts, $ep_backup_host);
}
foreach ($hosts as $host) {
if (true === ep_elasticsearch_alive($host)) {
set_site_transient('ep_last_good_host', $host, apply_filters('ep_last_good_host_timeout', 3600));
return $host;
}
}
return new WP_Error('elasticpress', __('No running host available.', 'elasticpress'));
}
示例12: delete
public static function delete($backwpup_jobid)
{
if (empty($backwpup_jobid)) {
$id = get_site_option('backwpup_cfg_easycronjobid');
} else {
$id = BackWPup_Option::get($backwpup_jobid, 'easycronjobid');
}
if (empty($id)) {
return TRUE;
}
$message = self::query_api('delete', array('id' => $id));
delete_site_transient('backwpup_easycron_' . $id);
if ($message['status'] == 'success' && !empty($message['cron_job_id'])) {
if (empty($backwpup_jobid)) {
delete_site_option('backwpup_cfg_easycronjobid');
} else {
BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
}
return TRUE;
} else {
if ($message['error']['code'] == 25) {
if (empty($backwpup_jobid)) {
delete_site_option('backwpup_cfg_easycronjobid');
} else {
BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
}
}
}
return FALSE;
}
示例13: plugpress_unlink_callback
/**
* Unlink user callback in the database (ajax)
*/
function plugpress_unlink_callback()
{
$option_name = 'plugpress_account_user';
$transient_name = $option_name . '_check';
$user = delete_site_option($option_name);
$user_check = delete_site_transient($transient_name);
die;
}
示例14: clear_ticketing_settings
protected function clear_ticketing_settings()
{
delete_option(self::WP_OPTION_KEY);
// Clear transient API data
delete_site_transient('ai1ec_api_feeds_subscriptions');
delete_site_transient('ai1ec_api_subscriptions');
delete_site_transient('ai1ec_api_features');
}
示例15: forceUpdate
/**
* We need to force WP to do an update check because WP won't recheck for updates unless the _site_transient_update_plugins transient has expired
* i.e. if WP checked for updates within the past 12 hrs, it (probably!) won't recheck and therefore may not have the very latest data for our own plugin
* Deleting the update_plugins transient will force WP to re-check for updates (so the transient can be re-inserted).
* The re-insert is done in wp_update_plugins() which is called via the "load-update" (load-$page) action in admin.php
* wp_update_plugins() is badly named - it really should be "wp_update_plugin_versions()" - it (possibly) updates the versions in the transient - it doesn't "update plugins"
* What a horribly convoluted way of doing a simple task!
*
* TODO - will force a recheck of ALL plugins. We should try to force the re-check of only the plugin that instantiates this class
*/
public function forceUpdate()
{
delete_site_transient('update_plugins');
$nonce = wp_create_nonce("upgrade-plugin_{$this->slug}/{$this->slug}.php");
$url = get_bloginfo('wpurl') . "/wp-admin/update.php?action=upgrade-plugin&plugin={$this->slug}/{$this->slug}.php&_wpnonce={$nonce}";
header("Location: {$url}");
exit;
}