PluginProbe
FeedWordPress / 2017.1020
FeedWordPress v2017.1020
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 2017.1020, at performance-page.php

123 lines 3.9 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 public function __construct() {
6 // Set meta-box context name
7 parent::__construct('feedwordpressperformancepage');
8 $this->dispatch = 'feedwordpress_performance';
9 $this->filename = __FILE__;
10 }
11
12 public 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', $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
83 } /* FeedWordPressPerformancePage::accept_POST () */
84
85 static function performance_box ($page, $box = NULL) {
86
87 // Hey ho, let's go...
88 ?>
89 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
90 <tr style="vertical-align: top">
91 <th width="33%" scope="row">Feed cache:</th>
92 <td width="67%"><input class="button" type="submit" name="clear_cache" value="Clear all cached feeds from WordPress database" />
93 <p>This will clear all cached copies of feed data from the WordPress database
94 and force FeedWordPress to make a fresh scan for updates on syndicated feeds.</p></td></tr>
95
96 <tr style="vertical-align: top">
97 <th width="33%" scope="row">Guid index:</th>
98 <td width="67%"><?php if (!FeedWordPress::has_guid_index()) : ?>
99 <input class="button" type="submit" name="create_index" value="Create index on guid column in posts database table" />
100 <p>Creating this index may significantly improve performance on some large
101 FeedWordPress installations.</p>
102 <?php else : ?>
103
104 <p>You have already created an index on the guid column in the WordPress posts
105 table. If you'd like to remove the index for any reason, you can do so here.</p>
106
107 <input class="button" type="submit" name="remove_index" value="Remove index on guid column in posts database table" />
108
109 <?php endif; ?>
110
111 </tr>
112
113 </td>
114 </tr>
115 </table>
116 <?php
117 } /* FeedWordPressPerformancePage::performance_box () */
118 } /* class FeedWordPressPerformancePage */
119
120 $performancePage = new FeedWordPressPerformancePage;
121 $performancePage->display();
122
123