当前位置: 首页>>代码示例>>PHP>>正文


PHP add_clean_index函数代码示例

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


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

示例1: upgrade_101

function upgrade_101()
{
    global $wpdb;
    // Clean up indices, add a few
    add_clean_index($wpdb->posts, 'post_name');
    add_clean_index($wpdb->posts, 'post_status');
    add_clean_index($wpdb->categories, 'category_nicename');
    add_clean_index($wpdb->comments, 'comment_approved');
    add_clean_index($wpdb->comments, 'comment_post_ID');
    add_clean_index($wpdb->links, 'link_category');
    add_clean_index($wpdb->links, 'link_visible');
}
开发者ID:johnwonder,项目名称:WordPressLearn,代码行数:12,代码来源:upgrade-functions.php

示例2: activation

 /**
  * Create the tables if needed
  *
  * @param void
  * @return void
  * @author Nicolas Juen
  */
 public static function activation()
 {
     /* @var $wpdb wpdb */
     global $wpdb;
     // Charset
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     // Add one library admin function for next function
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     // Campaign Table
     maybe_create_table($wpdb->bea_s_campaigns, "CREATE TABLE " . $wpdb->bea_s_campaigns . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`add_date` datetime NOT NULL,\n\t\t\t`scheduled_from` datetime NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`from_name` varchar(255) NOT NULL,\n\t\t\t`from` varchar(255) NOT NULL,\n\t\t\t`subject` text NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_campaigns, 'id');
     add_clean_index($wpdb->bea_s_campaigns, 'current_status');
     // Receiver Table
     maybe_create_table($wpdb->bea_s_receivers, "CREATE TABLE " . $wpdb->bea_s_receivers . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`email` varchar(255) NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`bounce_cat` varchar(20) NOT NULL,\n\t\t\t`bounce_type` varchar(20) NOT NULL,\n\t\t\t`bounce_no` varchar(10) NOT NULL\n\t\t) {$charset_collate};");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_cat', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_cat char(20)");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_type', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_type char(20)");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_no', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_no char(10)");
     add_clean_index($wpdb->bea_s_receivers, 'email');
     add_clean_index($wpdb->bea_s_receivers, 'current_status');
     // Recesiver/campaign link table
     maybe_create_table($wpdb->bea_s_re_ca, "CREATE TABLE " . $wpdb->bea_s_re_ca . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`id_campaign` int NOT NULL,\n\t\t\t`id_receiver` int NOT NULL,\n\t\t\t`id_content` int NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`response` varchar(10) NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_re_ca, 'current_status');
     add_clean_index($wpdb->bea_s_re_ca, 'id_campaign');
     add_clean_index($wpdb->bea_s_re_ca, 'id_receiver');
     // Content Table
     maybe_create_table($wpdb->bea_s_contents, "CREATE TABLE " . $wpdb->bea_s_contents . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`html` longtext NOT NULL,\n\t\t\t`text` longtext NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_contents, 'id');
     // Attachment Table
     maybe_create_table($wpdb->bea_s_attachments, "CREATE TABLE " . $wpdb->bea_s_attachments . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`campaign_id` int NOT NULL,\n\t\t\t`path` longtext NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_attachments, 'id');
     add_clean_index($wpdb->bea_s_attachments, 'campaign_id');
 }
开发者ID:asadowski10,项目名称:bea-sender,代码行数:44,代码来源:class.client.php

示例3: step3

 function step3()
 {
     global $wpdb;
     do_action('import_start');
     set_time_limit(0);
     update_option('ljapi_step', 3);
     echo '<div id="ljapi-status">';
     echo '<h3>' . __('Threading Comments&#8230;') . '</h3>';
     echo '<p>' . __('We are now re-building the threading of your comments (this can also take a while if you have lots of comments)...') . '</p>';
     ob_flush();
     flush();
     // Only bother adding indexes if they have over 5000 comments (arbitrary number)
     $imported_comments = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'");
     $added_indices = false;
     if (5000 < $imported_comments) {
         include_once ABSPATH . 'wp-admin/includes/upgrade.php';
         $added_indices = true;
         add_clean_index($wpdb->comments, 'comment_type');
         add_clean_index($wpdb->comments, 'comment_karma');
         add_clean_index($wpdb->comments, 'comment_agent');
     }
     // Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them
     while ($comments = $wpdb->get_results("SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT)) {
         foreach ($comments as $comment) {
             $wpdb->update($wpdb->comments, array('comment_parent' => $this->get_wp_comment_ID($comment->comment_agent), 'comment_type' => 'livejournal-done'), array('comment_ID' => $comment->comment_ID));
         }
         wp_cache_flush();
         $wpdb->flush();
     }
     // Revert the comments table back to normal and optimize it to reclaim space
     if ($added_indices) {
         drop_index($wpdb->comments, 'comment_type');
         drop_index($wpdb->comments, 'comment_karma');
         drop_index($wpdb->comments, 'comment_agent');
         $wpdb->query("OPTIMIZE TABLE {$wpdb->comments}");
     }
     // Clean up database and we're out
     $this->cleanup();
     do_action('import_done', 'livejournal');
     if ($imported_comments > 1) {
         echo '<p>' . sprintf(__("Successfully re-threaded %s comments."), number_format($imported_comments)) . '</p>';
     }
     echo '<h3>';
     printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
     echo '</h3>';
     echo '</div>';
 }
开发者ID:beaucollins,项目名称:wp,代码行数:47,代码来源:livejournal.php

示例4: upgrade_101

function upgrade_101()
{
    global $wpdb, $tableoptionvalues, $tablelinkcategories, $tableposts, $tablecategories, $tablecomments, $tablelinks;
    // Fix possible duplicate problem from CVS
    $option59 = $wpdb->get_results("SELECT * FROM {$tableoptionvalues} WHERE option_id  = '59'");
    if (1 < count($option59)) {
        $wpdb->query("DELETE FROM {$tableoptionvalues} WHERE option_id = '59' AND optionvalue LIKE('%FROM  order%')");
    }
    // Remove 'automatic' option for comment moderation until it actually does something
    $wpdb->query("DELETE FROM {$tableoptionvalues} WHERE optionvalue = 'auto'");
    // Less intrusive default
    $wpdb->query("ALTER TABLE `{$tablelinkcategories}` CHANGE `show_description` `show_description` ENUM( 'Y', 'N' ) DEFAULT 'N' NOT NULL");
    // Clean up indices, add a few
    add_clean_index($tableposts, 'post_name');
    add_clean_index($tableposts, 'post_status');
    add_clean_index($tablecategories, 'category_nicename');
    add_clean_index($tablecomments, 'comment_approved');
    add_clean_index($tablecomments, 'comment_post_ID');
    add_clean_index($tablelinks, 'link_category');
    add_clean_index($tablelinks, 'link_visible');
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:21,代码来源:upgrade-functions.php


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