PluginProbe
FeedWordPress / 2011.1018
FeedWordPress v2011.1018
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / performance-page.php

performance-page.php in FeedWordPress 2011.1018, at performance-page.php

120 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once(dirname(__FILE__) . '/admin-ui.php');
3
4 class FeedWordPressPerformancePage extends FeedWordPressAdminPage {
5 function FeedWordPressPerformancePage () {
6 // Set meta-box context name
7 FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressperformancepage');
8 $this->dispatch = 'feedwordpress_performance';
9 $this->filename = __FILE__;
10 }
11
12 function has_link () { return false; }
13
14 function display () {
15 global $wpdb, $wp_db_version, $fwp_path;
16 global $fwp_post;
17
18 if (FeedWordPress::needs_upgrade()) :
19 fwp_upgrade_page();
20 return;
21 endif;
22
23 // If this is a POST, validate source and user credentials
24 FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_performance', /*capability=*/ 'manage_options');
25
26 if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') :
27 $this->accept_POST($fwp_post);
28 do_action('feedwordpress_admin_page_performance_save', $GLOBALS['fwp_post'], $this);
29 endif;
30
31 ////////////////////////////////////////////////
32 // Prepare settings page ///////////////////////
33 ////////////////////////////////////////////////
34
35 $this->display_update_notice_if_updated('Performance');
36
37 $this->open_sheet('FeedWordPress Performance');
38 ?>
39 <div id="post-body">
40 <?php
41 $boxes_by_methods = array(
42 'performance_box' => __('Performance'),
43 );
44
45 foreach ($boxes_by_methods as $method => $title) :
46 add_meta_box(
47 /*id=*/ 'feedwordpress_'.$method,
48 /*title=*/ $title,
49 /*callback=*/ array('FeedWordPressPerformancePage', $method),
50 /*page=*/ $this->meta_box_context(),
51 /*context=*/ $this->meta_box_context()
52 );
53 endforeach;
54 do_action('feedwordpress_admin_page_performance_meta_boxes', $this);
55 ?>
56 <div class="metabox-holder">
57 <?php
58 fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this);
59 ?>
60 </div> <!-- class="metabox-holder" -->
61 </div> <!-- id="post-body" -->
62
63 <?php
64 $this->close_sheet();
65 } /* FeedWordPressPerformancePage::display () */
66
67 function accept_POST ($post) {
68 if (isset($post['create_index'])) :
69 FeedWordPress::create_guid_index();
70 $this->updated = __('guid column index created on database table.');
71 endif;
72 if (isset($post['remove_index'])) :
73 FeedWordPress::remove_guid_index();
74 $this->updated = __('guid column index removed from database table.');
75 endif;
76
77 if (isset($post['clear_cache'])) :
78 $N = FeedWordPress::clear_cache();
79 $feeds = (($N == 1) ? __("feed") : __("feeds"));
80 $this->updated = sprintf(__("Cleared %d cached %s from WordPress database."), $N, $feeds);
81 endif;
82 } /* FeedWordPressPerformancePage::accept_POST () */
83
84 /*static*/ function performance_box ($page, $box = NULL) {
85 // Hey ho, let's go...
86 ?>
87 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
88 <tr style="vertical-align: top">
89 <th width="33%" scope="row">Feed cache:</th>
90 <td width="67%"><input class="button" type="submit" name="clear_cache" value="Clear all cached feeds from WordPress database" />
91 <p>This will clear all cached copies of feed data from the WordPress database
92 and force FeedWordPress to make a fresh scan for updates on syndicated feeds.</p></td></tr>
93
94 <tr style="vertical-align: top">
95 <th width="33%" scope="row">Guid index:</th>
96 <td width="67%"><?php if (!FeedWordPress::has_guid_index()) : ?>
97 <input class="button" type="submit" name="create_index" value="Create index on guid column in posts database table" />
98 <p>Creating this index may significantly improve performance on some large
99 FeedWordPress installations.</p>
100 <?php else : ?>
101
102 <p>You have already created an index on the guid column in the WordPress posts
103 table. If you'd like to remove the index for any reason, you can do so here.</p>
104
105 <input class="button" type="submit" name="remove_index" value="Remove index on guid column in posts database table" />
106
107 <?php endif; ?>
108
109
110 </td>
111 </tr>
112 </table>
113 <?php
114 } /* FeedWordPressPerformancePage::performance_box () */
115 } /* class FeedWordPressPerformancePage */
116
117 $performancePage = new FeedWordPressPerformancePage;
118 $performancePage->display();
119
120