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

PHP wp_suspend_cache_invalidation函数代码示例

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

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



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

示例1: convert

 /**
  * Suspend caching and run the converter
  */
 function convert()
 {
     wp_suspend_cache_invalidation(true);
     $this->process_jobs();
     $this->process_taxonomies();
     wp_suspend_cache_invalidation(false);
 }
开发者ID:ThemeGit,项目名称:wp-job-manager-jobroller-import,代码行数:10,代码来源:wp-job-manager-jobroller-import.php


示例2: import_stepped

 function import_stepped($file, $stepNumber = 1, $numberOfSteps = 1)
 {
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $this->import_start($file);
     $this->get_author_mapping();
     wp_suspend_cache_invalidation(true);
     $this->process_categories();
     $this->process_tags();
     $this->process_terms();
     //the processing of posts is stepped
     $this->process_posts_stepped($stepNumber, $numberOfSteps);
     wp_suspend_cache_invalidation(false);
     //we do this only on the last step
     if ($stepNumber == $numberOfSteps) {
         //we process the menus because there are problems when the pages, posts, etc that don't first exist
         $this->process_menus();
     }
     //		$this->prepare_yarpp();
     // update incorrect/missing information in the DB
     $this->backfill_parents();
     $this->backfill_attachment_urls();
     $this->remap_featured_images();
     $this->import_end();
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:25,代码来源:wpgrade-import-class.php


示例3: import

 /**
  * The main controller for the actual import stage.
  *
  * @param string $file Path to the WXR file for importing
  */
 function import($file)
 {
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $info_star = $this->import_start($file);
     //if error display it
     if (is_wp_error($info_star)) {
         return new WP_Error('import_error', $info_star->get_error_message());
     }
     ob_start();
     $this->get_author_mapping();
     wp_suspend_cache_invalidation(true);
     $this->process_categories();
     $this->process_tags();
     $this->process_terms();
     $this->process_posts();
     wp_suspend_cache_invalidation(false);
     // update incorrect/missing information in the DB
     $this->backfill_parents();
     $this->backfill_attachment_urls();
     $this->remap_featured_images();
     $this->import_end();
     $messages = ob_get_contents();
     ob_end_clean();
     return array('notices' => $messages);
 }
开发者ID:andreimarin90,项目名称:bbt_fw_plugin,代码行数:31,代码来源:bbt_wp_importer_class.php


示例4: edit_term_action

 /**
  * Restores cache invalidation, after the slow term relationship cache invalidation
  * has been skipped
  */
 public function edit_term_action($term_id, $tt_id, $taxonomy)
 {
     // `edit_term` is only called from inside `wp_update_term`, so the backtrace
     // check is not required
     //let's restore the cache invalidation to previous value
     wp_suspend_cache_invalidation($this->was_suspended);
 }
开发者ID:Automattic,项目名称:vip-mu-plugins-public,代码行数:11,代码来源:vip-clean-term-cache.php


示例5: create

 /**
  * Generate some terms.
  *
  * ## OPTIONS
  *
  * <taxonomy>
  * : The taxonomy for the generated terms.
  *
  * [--count=<number>]
  * : How many terms to generate. Default: 100
  *
  * [--max_depth=<number>]
  * : Generate child terms down to a certain depth. Default: 1
  *
  * ## EXAMPLES
  *
  *     wp term-gen create category --count=50 --max_depth=6
  */
 public function create($args, $assoc_args)
 {
     global $wpdb;
     list($taxonomy) = $args;
     $defaults = array('count' => 100, 'max_depth' => 1);
     extract(array_merge($defaults, $assoc_args), EXTR_SKIP);
     $notify = \WP_CLI\Utils\make_progress_bar('Generating terms', $count);
     if (!taxonomy_exists($taxonomy)) {
         WP_CLI::error(sprintf("'%s' is not a registered taxonomy.", $taxonomy));
     }
     $label = get_taxonomy($taxonomy)->labels->singular_name;
     $slug = sanitize_title_with_dashes($label);
     $hierarchical = get_taxonomy($taxonomy)->hierarchical;
     $previous_term_id = 0;
     $current_parent = 0;
     $current_depth = 1;
     $max_id = (int) $wpdb->get_var("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} ORDER BY term_taxonomy_id DESC LIMIT 1");
     $suspend_cache_invalidation = wp_suspend_cache_invalidation(true);
     $created = array();
     $names = array();
     $this->text = file_get_contents(plugin_dir_path(__FILE__) . '/lorem-terms.txt');
     for ($i = $max_id + 1; $i <= $max_id + $count; $i++) {
         if ($hierarchical) {
             if ($previous_term_id && $this->maybe_make_child() && $current_depth < $max_depth) {
                 $current_parent = $previous_term_id;
                 $current_depth++;
             } else {
                 if ($this->maybe_reset_depth()) {
                     $current_parent = 0;
                     $current_depth = 1;
                 }
             }
         }
         $name = $this->get_random_term_name();
         $name = $this->get_unique_term_name($name, $taxonomy, $names);
         $args = array('parent' => $current_parent, 'slug' => sanitize_title($name));
         $term = wp_insert_term($name, $taxonomy, $args);
         if (is_wp_error($term)) {
             WP_CLI::warning($term);
         } else {
             $created[] = $term['term_id'];
             $previous_term_id = $term['term_id'];
             $names[] = $name;
         }
         $notify->tick();
         if (0 == $i % 200) {
             sleep(3);
         }
     }
     wp_suspend_cache_invalidation($suspend_cache_invalidation);
     clean_term_cache($created, $taxonomy);
     $notify->finish();
     if (count($created)) {
         WP_CLI::success(sprintf("%s terms created.", count($created)));
     } else {
         WP_CLI::warning("No terms created,");
     }
 }
开发者ID:keesiemeijer,项目名称:term-gen,代码行数:76,代码来源:term-gen-cli.php


示例6: import

 /**
  * The main controller for the actual import stage.
  */
 public function import()
 {
     add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
     $this->import_start();
     wp_suspend_cache_invalidation(true);
     $this->import_sliders();
     wp_suspend_cache_invalidation(false);
     $this->import_end();
 }
开发者ID:amitmula,项目名称:amitandaastha.in,代码行数:12,代码来源:importer.php


示例7: import

 /**
  * The main controller for the actual import stage.
  *
  * @param string $file Path to the WXR file for importing
  */
 function import($file)
 {
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
     $this->import_start($file);
     wp_suspend_cache_invalidation(true);
     $this->process_nav_menu_meta();
     wp_suspend_cache_invalidation(false);
     $this->import_end();
 }
开发者ID:JaneJieYing,项目名称:HiFridays,代码行数:15,代码来源:class.Nav_Menu_Roles_Import.php


示例8: import

 /**
  * The main controller for the actual import stage.
  *
  * @since 1.7
  * @param string $file Path to the XML file for importing
  */
 public function import($file)
 {
     $this->import_start($file);
     wp_suspend_cache_invalidation(true);
     $this->process_forms();
     $this->process_fields();
     $this->process_entries();
     $this->process_form_designs();
     $this->process_payments();
     wp_suspend_cache_invalidation(false);
     $this->import_end();
 }
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:18,代码来源:class-import.php


示例9: dispatch

 /**
  * Active sample data exist!
  *
  */
 function dispatch()
 {
     set_time_limit(0);
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $this->import_start();
     wp_suspend_cache_invalidation(true);
     $this->process_authors();
     $this->process_categories();
     $this->process_tags();
     $this->process_terms();
     $this->process_posts();
     wp_suspend_cache_invalidation(false);
     $this->backfill_parents();
     $this->backfill_attachment_urls();
     $this->remap_featured_images();
     $this->import_end();
 }
开发者ID:maratdev,项目名称:alllancer,代码行数:22,代码来源:class-ae-importer.php


示例10: import

 /**
  * The main controller for the actual import stage.
  *
  * @param string $file Path to the WXR file for importing
  */
 function import($file)
 {
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $this->import_start($file);
     $this->get_author_mapping();
     wp_suspend_cache_invalidation(true);
     $this->process_categories();
     $this->process_tags();
     $this->process_terms();
     $this->process_posts();
     wp_suspend_cache_invalidation(false);
     // update incorrect/missing information in the DB
     $this->backfill_parents();
     $this->backfill_attachment_urls();
     $this->remap_featured_images();
     $this->import_end();
 }
开发者ID:purgesoftwares,项目名称:purges,代码行数:23,代码来源:bootstrap.php


示例11: import

 public function import($file)
 {
     add_filter('wp_import_post_comments', '__return_empty_array');
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $this->import_start($file);
     global $wpdb;
     $this->get_author_mapping();
     wp_suspend_cache_invalidation(true);
     $wpdb->query('SET autocommit = 0');
     $this->process_categories();
     $this->process_tags();
     $this->process_terms();
     $this->process_posts();
     $wpdb->query('COMMIT');
     $wpdb->query('SET autocommit = 1');
     wp_suspend_cache_invalidation(false);
     // update incorrect/missing information in the DB
     $this->backfill_parents();
     $this->import_end();
 }
开发者ID:purgesoftwares,项目名称:purges,代码行数:21,代码来源:class-circleflip-import.php


示例12: wpImportAttachments

 public function wpImportAttachments($file, $import_limit = 10)
 {
     $wp_import = new WP_Import();
     $wp_import->fetch_attachments = true;
     // load data from saved option
     $wp_import->post_orphans = get_option('_cri_post_orphans', array());
     $wp_import->processed_posts = get_option('_cri_processed_posts', array());
     $wp_import->url_remap = get_option('_cri_url_remap', array());
     add_filter('import_post_meta_key', array($wp_import, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$wp_import, 'bump_request_timeout'));
     // start buffer
     ob_start();
     // parse file and gather data
     $wp_import->import_start($file);
     // map author
     $wp_import->get_author_mapping();
     // attachment to be imported
     $attachments = array();
     foreach ($wp_import->posts as $post) {
         // only import attachment
         if ($post['post_type'] == 'attachment') {
             // if attachment has been imported already
             if (isset($wp_import->processed_posts[$post['post_id']]) && !empty($post['post_id'])) {
                 continue;
             }
             // if limit exceed, kill the loop
             if ($import_limit < 1) {
                 break;
             } else {
                 $import_limit--;
             }
             $attachments[] = $post;
         }
     }
     // if attachments reach to zero, we are done
     if (empty($attachments)) {
         return true;
     }
     // set importable posts to attachments
     $wp_import->posts = $attachments;
     // this process the attachments, turn off/on cache
     wp_suspend_cache_invalidation(true);
     $wp_import->process_posts();
     wp_suspend_cache_invalidation(false);
     // end has output, so buffer it out
     $wp_import->import_end();
     ob_end_clean();
     // save all post_orphans, processed_posts & url_remap to be used on the next run. also this will run on post import
     update_option('_cri_post_orphans', $wp_import->post_orphans);
     update_option('_cri_processed_posts', $wp_import->processed_posts);
     update_option('_cri_url_remap', $wp_import->url_remap);
     // false means we are going to continue
     return false;
 }
开发者ID:AlchemyMomentum,项目名称:public_html,代码行数:54,代码来源:radium-importer.php


示例13: import

 /**
  * The main controller for the actual import stage.
  */
 public function import()
 {
     global $woocommerce, $wpdb;
     wp_suspend_cache_invalidation(true);
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $this->log->add('csv-import', '---');
     }
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $this->log->add('csv-import', __('Processing products.', 'wc_csv_import'));
     }
     foreach ($this->parsed_data as $key => &$item) {
         $product = $this->parser->parse_product($item, $this->merge_empty_cells);
         if (!is_wp_error($product)) {
             $this->process_product($product);
         } else {
             $this->add_import_result('failed', $product->get_error_message(), 'Not parsed', json_encode($item), '-');
         }
         unset($item, $product);
     }
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $this->log->add('csv-import', __('Finished processing products.', 'wc_csv_import'));
     }
     wp_suspend_cache_invalidation(false);
 }
开发者ID:Brandonsmith23,项目名称:behind,代码行数:27,代码来源:class-wc-pcsvis-product-import.php


示例14: die_nicer

 public function die_nicer($batch_code, $batch)
 {
     global $woocsv_product;
     //turn stuff back on again
     if (function_exists('wp_suspend_cache_invalidation')) {
         wp_suspend_cache_invalidation(false);
     }
     if (function_exists('wp_defer_term_counting ')) {
         wp_defer_term_counting(false);
     }
     //are we done?
     if ($batch['status'] == 'done') {
         $post_data['done'] = 1;
     } else {
         $post_data['batch_code'] = $batch_code;
         $post_data['status'] = 0;
     }
     woocsv_batches::update($batch_code, $batch);
     //=============================
     // Check if we need to debug
     //=============================
     if ($this->get_debug() == 0) {
         ob_get_clean();
     }
     $post_data['batch'] = $batch;
     echo json_encode($post_data);
     unset($post_data);
     wp_die();
 }
开发者ID:bailoo,项目名称:DagnaMusicWP,代码行数:29,代码来源:class-woocsv-import.php


示例15: split_all_shared_terms

/**
 * Split all shared taxonomy terms.
 *
 * @since 4.3.0
 */
function split_all_shared_terms()
{
    global $wpdb;
    // Get a list of shared terms (those with more than one associated row in term_taxonomy).
    $shared_terms = $wpdb->get_results("SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt\n\t\t LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id\n\t\t GROUP BY t.term_id\n\t\t HAVING term_tt_count > 1");
    if (empty($shared_terms)) {
        return;
    }
    // Rekey shared term array for faster lookups.
    $_shared_terms = array();
    foreach ($shared_terms as $shared_term) {
        $term_id = intval($shared_term->term_id);
        $_shared_terms[$term_id] = $shared_term;
    }
    $shared_terms = $_shared_terms;
    // Get term taxonomy data for all shared terms.
    $shared_term_ids = implode(',', array_keys($shared_terms));
    $shared_tts = $wpdb->get_results("SELECT * FROM {$wpdb->term_taxonomy} WHERE `term_id` IN ({$shared_term_ids})");
    // Split term data recording is slow, so we do it just once, outside the loop.
    $suspend = wp_suspend_cache_invalidation(true);
    $split_term_data = get_option('_split_terms', array());
    $skipped_first_term = $taxonomies = array();
    foreach ($shared_tts as $shared_tt) {
        $term_id = intval($shared_tt->term_id);
        // Don't split the first tt belonging to a given term_id.
        if (!isset($skipped_first_term[$term_id])) {
            $skipped_first_term[$term_id] = 1;
            continue;
        }
        if (!isset($split_term_data[$term_id])) {
            $split_term_data[$term_id] = array();
        }
        // Keep track of taxonomies whose hierarchies need flushing.
        if (!isset($taxonomies[$shared_tt->taxonomy])) {
            $taxonomies[$shared_tt->taxonomy] = 1;
        }
        // Split the term.
        $split_term_data[$term_id][$shared_tt->taxonomy] = _split_shared_term($shared_terms[$term_id], $shared_tt, false);
    }
    // Rebuild the cached hierarchy for each affected taxonomy.
    foreach (array_keys($taxonomies) as $tax) {
        delete_option("{$tax}_children");
        _get_term_hierarchy($tax);
    }
    wp_suspend_cache_invalidation($suspend);
    update_option('_split_terms', $split_term_data);
}
开发者ID:nasrulhazim,项目名称:WordPress,代码行数:52,代码来源:upgrade.php


示例16: import

 /**
  * The main controller for the actual import stage.
  *
  * @param string $file Path to the WXR file for importing
  */
 function import($file)
 {
     //header("Content-Type: text/plain");
     //header("Content-Length: " . ($size * $times));
     add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
     add_filter('http_request_timeout', array(&$this, 'bump_request_timeout'));
     $this->import_start($file);
     $this->update_import_status(0);
     $this->get_author_mapping();
     $this->update_import_status(5);
     wp_suspend_cache_invalidation(true);
     $this->process_categories();
     $this->update_import_status(10);
     $this->process_tags();
     $this->update_import_status(20);
     $this->process_terms();
     $this->update_import_status(35);
     $this->process_posts();
     $this->update_import_status(60);
     wp_suspend_cache_invalidation(false);
     // update incorrect/missing information in the DB
     $this->backfill_parents();
     $this->update_import_status(80);
     $this->backfill_attachment_urls();
     $this->update_import_status(90);
     $this->remap_featured_images();
     $this->update_import_status(100);
     $this->import_end();
 }
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:34,代码来源:wordpress-importer.php


示例17: cherry_plugin_import_attachment

function cherry_plugin_import_attachment()
{
    $nonce = $_POST['nonce'];
    if (!wp_verify_nonce($nonce, 'import_ajax-nonce')) {
        exit('instal_error');
    }
    if (session_id() != "import_xml") {
        session_name("import_xml");
        session_start();
    }
    if (!empty($_SESSION['attachment_posts'])) {
        do_action('cherry_plugin_import_attachment');
        $_SESSION['missing_menu_items'] = array();
        $_SESSION['attachment_metapost'] = array();
        $posts_array = $_SESSION['attachment_posts'];
        $posts_array = apply_filters('wp_import_posts', $posts_array);
        $author = (int) get_current_user_id();
        foreach ($posts_array as $post) {
            $post = apply_filters('wp_import_post_data_raw', $post);
            $postdata = array('import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'], 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'], 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'], 'post_status' => $post['status'], 'post_name' => $post['post_name'], 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], 'guid' => $post['guid'], 'menu_order' => $post['menu_order'], 'post_type' => $post['post_type'], 'post_password' => $post['post_password']);
            $postdata = apply_filters('wp_import_post_data_processed', $postdata, $post);
            $remote_url = !empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid'];
            // try to use _wp_attached file for upload folder placement to ensure the same location as the export site
            // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload()
            $postdata['upload_date'] = $post['post_date'];
            $file_url = UPLOAD_DIR . basename($remote_url);
            if (file_exists($file_url)) {
                cherry_plugin_add_attachment($postdata, $remote_url);
            }
        }
    }
    wp_suspend_cache_invalidation(false);
    exit('generate_attachment_metadata');
}
开发者ID:drupalninja,项目名称:schome_org,代码行数:34,代码来源:import-functions.php


示例18: restore_cache_invalidation

 /**
  * Restore the cache invalidation to its previous value.
  *
  * @since bbPress (r4011)
  * @uses wp_suspend_cache_invalidation()
  */
 public function restore_cache_invalidation()
 {
     wp_suspend_cache_invalidation($this->original_cache_invalidation);
 }
开发者ID:hscale,项目名称:webento,代码行数:10,代码来源:cache.php


示例19: crop_images

 /**
  * Helper method to crop gallery images to the specified sizes.
  *
  * @since 1.0.0
  *
  * @param array $args  Array of args used when cropping the images.
  * @param int $post_id The current post ID.
  */
 public function crop_images($args, $post_id)
 {
     // Gather all available images to crop.
     $gallery_data = get_post_meta($post_id, '_eg_gallery_data', true);
     $images = !empty($gallery_data['gallery']) ? $gallery_data['gallery'] : false;
     $common = Envira_Gallery_Common_Lite::get_instance();
     // Loop through the images and crop them.
     if ($images) {
         // Increase the time limit to account for large image sets and suspend cache invalidations.
         set_time_limit(0);
         wp_suspend_cache_invalidation(true);
         foreach ($images as $id => $item) {
             // Get the full image attachment. If it does not return the data we need, skip over it.
             $image = wp_get_attachment_image_src($id, 'full');
             if (!is_array($image)) {
                 continue;
             }
             // Generate the cropped image.
             $cropped_image = $common->resize_image($image[0], $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina']);
             // If there is an error, possibly output error message, otherwise woot!
             if (is_wp_error($cropped_image)) {
                 // If WP_DEBUG is enabled, and we're logged in, output an error to the user
                 if (defined('WP_DEBUG') && WP_DEBUG && is_user_logged_in()) {
                     echo '<pre>Envira: Error occured resizing image (these messages are only displayed to logged in WordPress users):<br />';
                     echo 'Error: ' . $cropped_image->get_error_message() . '<br />';
                     echo 'Image: ' . $image . '<br />';
                     echo 'Args: ' . var_export($args, true) . '</pre>';
                 }
             }
         }
         // Turn off cache suspension and flush the cache to remove any cache inconsistencies.
         wp_suspend_cache_invalidation(false);
         wp_cache_flush();
     }
 }
开发者ID:codeforpakistan,项目名称:PDMA-Emergency,代码行数:43,代码来源:metaboxes.php


示例20: runImport

 public static function runImport()
 {
     global $wooProduct, $woocsvImport, $wpdb;
     wp_suspend_cache_invalidation(true);
     /* ! 1.2.7 disable term counting */
     wp_defer_term_counting(true);
     $postData = $_POST;
     /* ! 1.2.7 solve escape problem when running on windows */
     if (isset($postData['filename'])) {
         //get the filename and save it
         $filename = $postData['filename'];
         update_option('woocsv-importfile', $filename);
         unset($postData['filename']);
     } else {
         $filename = get_option('woocsv-importfile');
     }
     $count = 0;
     $csvcontent = '';
     $handle = fopen($filename, 'r');
     //================================
     //! only import the rows needed.
     //================================
     while (($line = fgetcsv($handle, 0, $woocsvImport->options['seperator'])) !== FALSE) {
         if ($count >= $postData['currentrow'] && $count < (int) $postData['currentrow'] + (int) $postData['blocksize']) {
             $csvContent[$count] = $line;
         }
         $count++;
     }
     unset($handle, $line);
     //========================================================
     //! Run only the block from currentrow and the blocksize
     //========================================================
     for ($i = 1; $i <= $woocsvImport->options['blocksize']; $i++) {
         $wooProduct = new woocsvImportProduct();
         $wooProduct->header = $woocsvImport->header;
         $realRow = $postData['currentrow'] + 1;
         //===================
         //! We are finished
         //===================
         if ($postData['currentrow'] >= $postData['rows']) {
             ob_get_clean();
             update_option('woocsv-lastrun', array('date' => date("Y-m-d H:i:s"), 'filename' => basename($filename), 'rows' => $postData['rows']));
             delete_option('woocsv-importfile');
             do_action('woocsv_after_import_finished');
             self::dieNice($postData, true);
         }
         // count the rows here else we have a row and than die.
         $woocsvImport->importLog[] = "--> " . __('row', 'woocsv-import') . ":" . $realRow . " / " . (int) $postData['rows'];
         //==================================
         //! We want to skip the first line
         //==================================
         if ($woocsvImport->options['skipfirstline'] == 1 && $postData['currentrow'] == 0) {
             $postData['currentrow']++;
             $woocsvImport->importLog[] = __('Skipping the first row', 'woocsv-import');
             self::dieNice($postData);
         }
         //=========================================
         //! We do not want to skip the first line
         //=========================================
         if ($woocsvImport->options['skipfirstline'] == 0 && $postData['currentrow'] == 0) {
             $wooProduct->rawData = $csvContent[0];
         }
         if ($postData['currentrow'] > 0) {
             $wooProduct->rawData = $csvContent[$postData['currentrow']];
         }
         $postData['currentrow']++;
         //=========================
         //! Lets fill in the data
         //=========================
         do_action('woocsv_before_fill_in_data');
         $wooProduct->fillInData();
         do_action('woocsv_after_fill_in_data');
         //===================
         //! version 2.0.0
         //  lets parse data
         //===================
         $wooProduct->parseData();
         //=======================
         //! let's save the data
         //=======================
         try {
             $id = $wooProduct->save();
         } catch (Exception $e) {
             $id = '';
         }
         //===============================================
         //! lets fill in the memory stuff for debugging
         //===============================================
         $postData['memory'] = round(memory_get_usage() / 1024 / 1024, 2);
     }
     wp_suspend_cache_invalidation(false);
     /* ! 1.2.7 */
     wp_defer_term_counting(false);
     //==========================
     //! version 2.0.0
     //  New die nice function
     //==========================
     self::dieNice($postData);
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:99,代码来源:class-woocsv-admin-import.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wp_table函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_suspend_cache_addition函数代码示例发布时间: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