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

PHP w3tc_minify_flush函数代码示例

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

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



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

示例1: flush

 /**
  * Clear something from the cache
  *
  * @param array $args
  * @param array $vars
  */
 function flush($args = array(), $vars = array())
 {
     if (function_exists('w3tc_pgcache_flush')) {
         $args = array_unique($args);
         do {
             $cache_type = array_shift($args);
             switch ($cache_type) {
                 case 'db':
                 case 'database':
                     if (w3tc_dbcache_flush()) {
                         WP_CLI::success('The object cache is flushed successfully.');
                     } else {
                         WP_CLI::error('Flushing the object cache failed.');
                     }
                     break;
                 case 'minify':
                     if (w3tc_minify_flush()) {
                         WP_CLI::success('The object cache is flushed successfully.');
                     } else {
                         WP_CLI::error('Flushing the object cache failed.');
                     }
                     break;
                 case 'object':
                     if (w3tc_objectcache_flush()) {
                         WP_CLI::success('The object cache is flushed successfully.');
                     } else {
                         WP_CLI::error('Flushing the object cache failed.');
                     }
                     break;
                 case 'post':
                 default:
                     if (isset($vars['post_id'])) {
                         if (is_numeric($vars['post_id'])) {
                             w3tc_pgcache_flush_post($vars['post_id']);
                         } else {
                             WP_CLI::error('This is not a valid post id.');
                         }
                         w3tc_pgcache_flush_post($vars['post_id']);
                     } elseif (isset($vars['permalink'])) {
                         $id = url_to_postid($vars['permalink']);
                         if (is_numeric($id)) {
                             w3tc_pgcache_flush_post($id);
                         } else {
                             WP_CLI::error('There is no post with this permalink.');
                         }
                     } else {
                         if (isset($flushed_page_cache) && $flushed_page_cache) {
                             break;
                         }
                         $flushed_page_cache = true;
                         w3tc_pgcache_flush();
                     }
             }
         } while (!empty($args));
     } else {
         WP_CLI::error('The W3 Total Cache could not be found, is it installed?');
     }
 }
开发者ID:roelven,项目名称:wp-cli,代码行数:64,代码来源:total-cache.php


示例2: clear_caches

 /**
  * Clear caches.
  *
  * Clears popular WordPress caching mechanisms.
  *
  * @since 4.0.0
  *
  * @param bool $page [optional] true to clear page cache
  *
  * @return void
  */
 public static function clear_caches($page = false)
 {
     //clear APC Cache
     if (function_exists('apc_store')) {
         apc_clear_cache();
         //Let's clear APC (if it exists) when big stuff is saved.
     }
     //clear w3 total cache or wp super cache
     if (function_exists('w3tc_pgcache_flush')) {
         if (true == $page) {
             w3tc_pgcache_flush();
             w3tc_minify_flush();
         }
         w3tc_dbcache_flush();
         w3tc_objectcache_flush();
     } else {
         if (function_exists('wp_cache_clear_cache') && true == $page) {
             wp_cache_clear_cache();
         }
     }
 }
开发者ID:waynestedman,项目名称:commodore-new,代码行数:32,代码来源:class-itsec-lib.php


示例3: save_settings

 function save_settings()
 {
     $options = get_option($this->optionname);
     if (isset($_REQUEST['reset']) && $_REQUEST['reset'] == "true" && isset($_REQUEST['plugin']) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress') {
         $options = $this->set_defaults();
         $options['msg'] = "<div class=\"updated\"><p>" . __('Google Analytics settings reset.') . "</p></div>\n";
     } elseif (isset($_POST['submit']) && isset($_POST['plugin']) && $_POST['plugin'] == 'google-analytics-for-wordpress') {
         if (!current_user_can('manage_options')) {
             die(__('You cannot edit the Google Analytics for WordPress options.'));
         }
         check_admin_referer('analyticspp-config');
         foreach (array('uastring', 'dlextensions', 'domainorurl', 'position', 'domain', 'customcode', 'ga_token', 'extraseurl', 'gajsurl', 'gfsubmiteventpv', 'trackprefix', 'ignore_userlevel', 'internallink', 'internallinklabel', 'primarycrossdomain', 'othercrossdomains') as $option_name) {
             if (isset($_POST[$option_name])) {
                 $options[$option_name] = $_POST[$option_name];
             } else {
                 $options[$option_name] = '';
             }
         }
         foreach (array('extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain', 'gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug', 'firebuglite', 'yoast_tracking') as $option_name) {
             if (isset($_POST[$option_name]) && $_POST[$option_name] == 'on') {
                 $options[$option_name] = true;
             } else {
                 $options[$option_name] = false;
             }
         }
         if (isset($_POST['manual_uastring']) && isset($_POST['uastring_man'])) {
             $options['uastring'] = $_POST['uastring_man'];
         }
         if ($options['trackcrossdomain']) {
             if (!$options['allowlinker']) {
                 $options['allowlinker'] = true;
             }
             if (empty($options['primarycrossdomain'])) {
                 $origin = GA_Filter::ga_get_domain($_SERVER["HTTP_HOST"]);
                 $options['primarycrossdomain'] = $origin["domain"];
             }
         }
         if (function_exists('w3tc_pgcache_flush')) {
             w3tc_pgcache_flush();
         }
         if (function_exists('w3tc_dbcache_flush')) {
             w3tc_dbcache_flush();
         }
         if (function_exists('w3tc_minify_flush')) {
             w3tc_minify_flush();
         }
         if (function_exists('w3tc_objectcache_flush')) {
             w3tc_objectcache_flush();
         }
         if (function_exists('wp_cache_clear_cache')) {
             wp_cache_clear_cache();
         }
         $options['msg'] = "<div id=\"updatemessage\" class=\"updated fade\"><p>Google Analytics <strong>settings updated</strong>.</p></div>\n";
         $options['msg'] .= "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
     }
     update_option($this->optionname, $options);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:57,代码来源:googleanalytics.php


示例4: supernova_writer

 function supernova_writer()
 {
     // @since Supernova 1.4.8 temporarily unavailable.
     update_option('supernova_file_write_status', 'failed');
     return false;
     $test = get_option('supernova_test');
     $file_status = get_option('supernova_file_write_status');
     if ($test != 2) {
         update_option('supernova_test', 1);
         // To track the first attempt
     }
     if ($test == 1) {
         if ($file_status == 'failed') {
             update_option('supernova_test', 2);
             return false;
             //We wont try to write files after one attempt was failed and will stop right here.
         }
     }
     // else go ahead.
     if (!isset($_GET['settings-updated']) && !isset($_GET['_wpnonce'])) {
         update_option('supernova_file_write_status', 'failed');
         // @since Supernova 1.4.
     } else {
         // okay, let's see about getting credentials
         $url = wp_nonce_url('themes.php?page=theme-options');
         $method = '';
         if (false === ($creds = request_filesystem_credentials($url, $method, false, false, null))) {
             // if we get here, then we don't have credentials yet,
             return true;
         }
         // now we have some credentials, try to get the wp_filesystem running
         if (!WP_Filesystem($creds)) {
             // our credentials were no good, ask the user for them again
             request_filesystem_credentials($url, '', true, false, $_POST);
             return true;
         }
         global $wp_filesystem;
         $upload_dir = wp_upload_dir();
         if (!is_dir(trailingslashit($upload_dir['basedir']) . 'supernova_directory')) {
             if (!$wp_filesystem->mkdir(trailingslashit($upload_dir['basedir']) . 'supernova_directory')) {
                 update_option('supernova_file_write_status', 'failed');
                 // We will hook it normally if something goes wrong
                 echo "after here";
             } else {
                 update_option('supernova_old_user_check', 'no');
             }
         }
         $filename = trailingslashit($upload_dir['basedir']) . 'supernova_directory/custom-styles.css';
         if (!$wp_filesystem->put_contents($filename, supernova_user_css(), FS_CHMOD_FILE)) {
             update_option('supernova_file_write_status', 'failed');
         } else {
             update_option('supernova_old_user_check', 'no');
             update_option('supernova_file_write_status', 'passed');
             if (function_exists('wp_cache_clear_cache')) {
                 wp_cache_clear_cache();
             } elseif (function_exists('w3tc_minify_flush')) {
                 w3tc_minify_flush();
             }
         }
         return true;
     }
 }
开发者ID:plusinterativa,项目名称:clientes,代码行数:62,代码来源:supernova.php


示例5: w3_config_save


//.........这里部分代码省略.........
        }
    }
    if ($current_config->get_boolean('newrelic.enabled')) {
        if ($current_config->get_boolean('pgcache.enabled')) {
            if (w3_is_network() && $current_config->get_boolean('common.force_master')) {
                $new_config->set('pgcache.late_init', true);
            }
        }
    }
    do_action('w3tc_saved_options', $new_config, $new_config_admin);
    /**
     * Save config
     */
    try {
        $new_config_admin->save();
        $new_config->save();
    } catch (Exception $ex) {
        // try to fix environment, it potentially can be fixed silently
        // dont show error here, it will be called again later
        // in admin_notices
        try {
            $environment = w3_instance('W3_AdminEnvironment');
            $environment->fix_in_wpadmin($new_config);
        } catch (Exception $ex) {
        }
        // retry save process and complain now on failure
        try {
            $new_config_admin->save();
            $new_config->save();
        } catch (Exception $ex) {
            throw new Exception('<strong>Can\'t change configuration</strong>: ' . $ex->getMessage());
        }
    }
    $w3_plugin_cdn = w3_instance('W3_Plugin_CdnAdmin');
    /**
     * Empty caches on engine change or cache enable/disable
     */
    if ($old_config->get_string('pgcache.engine') != $new_config->get_string('pgcache.engine') || $old_config->get_string('pgcache.enabled') != $new_config->get_string('pgcache.enabled')) {
        w3tc_pgcache_flush();
    }
    if ($old_config->get_string('dbcache.engine') != $new_config->get_string('dbcache.engine') || $old_config->get_string('dbcache.enabled') != $new_config->get_string('dbcache.enabled')) {
        w3tc_dbcache_flush();
    }
    if ($old_config->get_string('objectcache.engine') != $new_config->get_string('objectcache.engine') || $old_config->get_string('objectcache.enabled') != $new_config->get_string('objectcache.enabled')) {
        w3tc_objectcache_flush();
    }
    if ($old_config->get_string('minify.engine') != $new_config->get_string('minify.engine') || $old_config->get_string('minify.enabled') != $new_config->get_string('minify.enabled')) {
        w3tc_minify_flush();
    }
    /**
     * Update CloudFront CNAMEs
     */
    $update_cf_cnames = false;
    if ($new_config->get_boolean('cdn.enabled') && in_array($new_config->get_string('cdn.engine'), array('cf', 'cf2'))) {
        if ($new_config->get_string('cdn.engine') == 'cf') {
            $old_cnames = $old_config->get_array('cdn.cf.cname');
            $new_cnames = $new_config->get_array('cdn.cf.cname');
        } else {
            $old_cnames = $old_config->get_array('cdn.cf2.cname');
            $new_cnames = $new_config->get_array('cdn.cf2.cname');
        }
        if (count($old_cnames) != count($new_cnames) || count(array_diff($old_cnames, $new_cnames))) {
            $update_cf_cnames = true;
        }
    }
    /**
     * Refresh config
     */
    $current_config->load();
    /**
     * React to config changes
     */
    $environment = w3_instance('W3_AdminEnvironment');
    $environment->fix_on_event($new_config, 'config_change', $old_config);
    /**
     * Update support us option
     */
    w3_instance('W3_AdminLinks')->link_update($current_config);
    /**
     * Auto upload minify files to CDN
     */
    if ($new_config->get_boolean('minify.enabled') && $new_config->get_boolean('minify.upload') && $new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) {
        w3_cdn_upload_minify();
    }
    /**
     * Auto upload browsercache files to CDN
     */
    if ($new_config->get_boolean('cdn.enabled') && $new_config->get_string('cdn.engine') == 'ftp') {
        w3_cdn_delete_browsercache($current_config);
        w3_cdn_upload_browsercache($current_config);
    }
    /**
     * Update CloudFront CNAMEs
     */
    if ($update_cf_cnames) {
        $error = null;
        $w3_plugin_cdn->update_cnames($error);
    }
    return true;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:101,代码来源:admin.php


示例6: flush_minify

 /**
  * Flush minify cache
  *
  * @return void
  */
 function flush_minify()
 {
     _doing_it_wrong('flush_minify', 'This function is deprecated. Use w3tc_minify_flush() instead.', '0.9.3');
     w3tc_minify_flush();
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:10,代码来源:TotalCacheAdmin.php


示例7: clear_cache

 public function clear_cache()
 {
     if (function_exists('wp_cache_clear_cache')) {
         $GLOBALS["super_cache_enabled"] = 1;
         wp_cache_clear_cache();
     } else {
         if (function_exists('simple_cache_clear')) {
             simple_cache_clear();
         } else {
             if (function_exists('w3tc_pgcache_flush')) {
                 w3tc_pgcache_flush();
             }
             if (function_exists('w3tc_dbcache_flush')) {
                 w3tc_dbcache_flush();
             }
             if (function_exists('w3tc_minify_flush')) {
                 w3tc_minify_flush();
             }
             if (function_exists('w3tc_objectcache_flush')) {
                 w3tc_objectcache_flush();
             }
             if (function_exists('wp_cache_clear_cache')) {
                 wp_cache_clear_cache();
             }
         }
     }
 }
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:27,代码来源:quick-chat.php


示例8: _flush_caching_plugins_css_minify_caches

 /**
  * Flush the CSS minification cache of W3 Total Cache
  *
  * @since 1.4.0
  */
 protected function _flush_caching_plugins_css_minify_caches()
 {
     /** This filter is documented in models/model-table.php */
     if (!apply_filters('tablepress_flush_caching_plugins_caches', true)) {
         return;
     }
     // W3 Total Cache
     if (function_exists('w3tc_minify_flush')) {
         w3tc_minify_flush();
     }
 }
开发者ID:heyjones,项目名称:crossfitpurpose,代码行数:16,代码来源:class-css.php


示例9: single_activate

 /**
  * Fired for each blog when the plugin is activated.
  *
  * @since	1.0.0
  */
 private static function single_activate()
 {
     wp_cache_flush();
     if (function_exists('w3tc_pgcache_flush')) {
         w3tc_pgcache_flush();
     }
     if (function_exists('w3tc_minify_flush')) {
         w3tc_minify_flush();
     }
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:15,代码来源:class-ultimate-social-deux-public.php


示例10: clear_cache

 /**
  * Clear cache(s) based on HTTP GET parameters. Allows another site to tell this site to clear its cache.
  * Will only run if GET params include correct secret key, which is defined in SitePush options
  *
  * @return mixed result code echoed to screen, or FALSE if command/key not set
  */
 private function clear_cache()
 {
     //check $_GET to see if someone has asked us to clear the cache
     //for example a push from another server to this one
     $cmd = isset($_GET['sitepush_cmd']) ? $_GET['sitepush_cmd'] : FALSE;
     $key = isset($_GET['sitepush_key']) ? $_GET['sitepush_key'] : FALSE;
     //no command and/or key so return to normal WP initialisation
     if (!$cmd || !$key) {
         return FALSE;
     }
     //do nothing if the secret key isn't correct
     $options = get_option('sitepush_options');
     $result = '';
     if ($key != urlencode($options['cache_key'])) {
         status_header('403');
         //return an HTTP error so we know cache clear wasn't successful
         $result .= "[1] Unrecognized cache key\n";
         die(trim($result));
     }
     switch ($cmd) {
         case 'clear_cache':
             // Purge the entire w3tc page cache:
             if (function_exists('w3tc_pgcache_flush')) {
                 /** @noinspection PhpUndefinedFunctionInspection */
                 w3tc_pgcache_flush();
                 /** @noinspection PhpUndefinedFunctionInspection */
                 w3tc_dbcache_flush();
                 /** @noinspection PhpUndefinedFunctionInspection */
                 w3tc_minify_flush();
                 /** @noinspection PhpUndefinedFunctionInspection */
                 w3tc_objectcache_flush();
                 $result .= "[0] W3TC cache cleared\n";
             }
             // Purge the entire supercache page cache:
             if (function_exists('wp_cache_clear_cache')) {
                 /** @noinspection PhpUndefinedFunctionInspection */
                 wp_cache_clear_cache();
                 $result .= "[0] Supercache cleared\n";
             }
             break;
         default:
             $result .= "[2] Unrecognised cache command\n";
             status_header('400');
             //return an HTTP error so we know cache clear wasn't successful
             break;
     }
     if (!$result) {
         $result = "[3] No supported cache present\n";
     }
     die(trim($result));
 }
开发者ID:TheJohnzo,项目名称:sitepush,代码行数:57,代码来源:class-sitepush-plugin.php


示例11: top_generate_query

function top_generate_query($can_requery = true)
{
    global $wpdb;
    $rtrn_msg = "";
    $omitCats = get_option('top_opt_omit_cats');
    $maxAgeLimit = get_option('top_opt_max_age_limit');
    $ageLimit = get_option('top_opt_age_limit');
    $exposts = get_option('top_opt_excluded_post');
    $exposts = preg_replace('/,,+/', ',', $exposts);
    $top_opt_tweeted_posts = array();
    $top_opt_tweeted_posts = get_option('top_opt_tweeted_posts');
    if (!$top_opt_tweeted_posts) {
        $top_opt_tweeted_posts = array();
    }
    if ($top_opt_tweeted_posts != null) {
        $already_tweeted = implode(",", $top_opt_tweeted_posts);
    } else {
        $already_tweeted = "";
    }
    if (substr($exposts, 0, 1) == ",") {
        $exposts = substr($exposts, 1, strlen($exposts));
    }
    if (substr($exposts, -1, 1) == ",") {
        $exposts = substr($exposts, 0, strlen($exposts) - 1);
    }
    if (!(isset($ageLimit) && is_numeric($ageLimit))) {
        $ageLimit = top_opt_AGE_LIMIT;
    }
    if (!(isset($maxAgeLimit) && is_numeric($maxAgeLimit))) {
        $maxAgeLimit = top_opt_MAX_AGE_LIMIT;
    }
    if (!isset($omitCats)) {
        $omitCats = top_opt_OMIT_CATS;
    }
    $as_post_type = get_option('as_post_type');
    $as_number_tweet = get_option('as_number_tweet');
    if ($as_number_tweet <= 0) {
        $as_number_tweet = 1;
    }
    if ($as_number_tweet > 10) {
        $as_number_tweet = 10;
    }
    //trying to fix multiposts
    //if($last<1){$as_number_tweet = 0;}
    $pt = '';
    if ($as_post_type != 'all') {
        $pt = "post_type = '{$as_post_type}' AND";
    }
    $sql = "SELECT ID\n            FROM {$wpdb->posts}\n            WHERE {$pt} post_status = 'publish' ";
    if (is_numeric($ageLimit)) {
        if ($ageLimit > 0) {
            $sql = $sql . " AND post_date <= curdate( ) - INTERVAL " . $ageLimit . " day";
        }
    }
    if ($maxAgeLimit != 0) {
        $sql = $sql . " AND post_date >= curdate( ) - INTERVAL " . $maxAgeLimit . " day";
    }
    if (isset($exposts)) {
        if (trim($exposts) != '') {
            $sql = $sql . " AND ID Not IN (" . $exposts . ") ";
        }
    }
    if (isset($already_tweeted)) {
        if (trim($already_tweeted) != "") {
            $sql = $sql . " AND ID Not IN (" . $already_tweeted . ") ";
        }
    }
    if ($omitCats != '') {
        $sql = $sql . " AND NOT (ID IN (SELECT tr.object_id FROM " . $wpdb->prefix . "term_relationships AS tr INNER JOIN " . $wpdb->prefix . "term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN (" . $omitCats . ")))";
    }
    $sql = $sql . "\n            ORDER BY RAND() \n            LIMIT {$as_number_tweet} ";
    $oldest_post = $wpdb->get_results($sql);
    if ($oldest_post == null) {
        if ($can_requery) {
            $top_opt_tweeted_posts = array();
            update_option('top_opt_tweeted_posts', $top_opt_tweeted_posts);
            return top_generate_query(false);
        } else {
            return "No post found to tweet. Please check your settings and try again.--" . $sql;
        }
    }
    if (isset($oldest_post)) {
        $ret = '';
        foreach ($oldest_post as $k => $odp) {
            array_push($top_opt_tweeted_posts, $odp->ID);
            $ret .= 'Tweet ' . $k . ' : ' . top_opt_tweet_post($odp->ID) . '<br/>';
        }
        update_option('top_opt_tweeted_posts', $top_opt_tweeted_posts);
        if (function_exists('w3tc_pgcache_flush')) {
            w3tc_pgcache_flush();
            w3tc_dbcache_flush();
            w3tc_minify_flush();
            w3tc_objectcache_flush();
            $cache = ' and W3TC Caches cleared';
        }
        $next_tweet_time = time() + get_option('top_opt_interval') * 60 * 60;
        update_option('next_tweet_time', $next_tweet_time);
        return $ret;
    }
    return $rtrn_msg;
//.........这里部分代码省略.........
开发者ID:jun200,项目名称:wordpress,代码行数:101,代码来源:top-core.php


示例12: cache_flush

 protected function cache_flush()
 {
     // W3 Total Cache
     if (function_exists('w3tc_pgcache_flush')) {
         w3tc_pgcache_flush();
     }
     if (function_exists('w3tc_dbcache_flush')) {
         w3tc_dbcache_flush();
     }
     if (function_exists('w3tc_minify_flush')) {
         w3tc_minify_flush();
     }
     if (function_exists('w3tc_objectcache_flush')) {
         w3tc_objectcache_flush();
     }
     // WP Super Cache
     if (function_exists('wp_cache_clear_cache')) {
         wp_cache_clear_cache();
     }
 }
开发者ID:searsandrew,项目名称:centreforge,代码行数:20,代码来源:bootstrapcdn.php


示例13: clear_pagecache

 /**
  * Clear cache
  */
 public function clear_pagecache()
 {
     if (function_exists('w3tc_pgcache_flush')) {
         // clean the page cache
         w3tc_pgcache_flush();
     }
     if (function_exists('w3tc_minify_flush')) {
         // clean minify cache
         w3tc_minify_flush();
     }
 }
开发者ID:optimalisatie,项目名称:above-the-fold-optimization,代码行数:14,代码来源:w3-total-cache.inc.php


示例14: flush

 /**
  * Clear something from the cache.
  *
  * @synopsis <cache-type>... [--post_id=<post-id>] [--permalink=<permalink>]
  */
 function flush($args = array(), $assoc_args = array())
 {
     $args = array_unique($args);
     do {
         $cache_type = array_shift($args);
         switch ($cache_type) {
             case 'db':
             case 'database':
                 if (w3tc_dbcache_flush()) {
                     WP_CLI::success('The database cache is flushed successfully.');
                 } else {
                     WP_CLI::error('Flushing the database cache failed.');
                 }
                 break;
             case 'minify':
                 if (w3tc_minify_flush()) {
                     WP_CLI::success('The minify cache is flushed successfully.');
                 } else {
                     WP_CLI::error('Flushing the minify cache failed.');
                 }
                 break;
             case 'object':
                 if (w3tc_objectcache_flush()) {
                     WP_CLI::success('The object cache is flushed successfully.');
                 } else {
                     WP_CLI::error('Flushing the object cache failed.');
                 }
                 break;
             case 'page':
                 if (w3tc_pgcache_flush()) {
                     WP_CLI::success('The page cache is flushed successfully.');
                 } else {
                     WP_CLI::error('Flushing the page cache failed.');
                 }
                 break;
             case 'post':
             default:
                 if (isset($assoc_args['post_id'])) {
                     if (is_numeric($assoc_args['post_id']) && get_post($assoc_args['post_id'])) {
                         if (w3tc_pgcache_flush_post($assoc_args['post_id'])) {
                             WP_CLI::success('Post ' . $assoc_args['post_id'] . ' is flushed successfully.');
                         } else {
                             WP_CLI::error('Flushing ' . $assoc_args['post_id'] . ' from cache failed.');
                         }
                     } else {
                         WP_CLI::error('This is not a valid post id.');
                     }
                 } elseif (isset($assoc_args['permalink'])) {
                     $id = url_to_postid($assoc_args['permalink']);
                     if (is_numeric($id) && $id > 0) {
                         if (w3tc_pgcache_flush_post($id)) {
                             WP_CLI::success($id . ' is flushed successfully.');
                         } else {
                             WP_CLI::error('Flushing ' . $id . ' from cache failed.');
                         }
                     } else {
                         WP_CLI::error('There is no post with this permalink.');
                     }
                 }
         }
     } while (!empty($args));
 }
开发者ID:netcon-source,项目名称:wp-cli,代码行数:67,代码来源:total-cache.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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