PluginProbe
FeedWordPress / 2020.0118
FeedWordPress v2020.0118
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 2020.0118, at performance-page.php

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