PluginProbe
FeedWordPress / 2022.0222
FeedWordPress v2022.0222
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 2022.0222, at performance-page.php

122 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 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();
25 do_action('feedwordpress_admin_page_performance_save', null, $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 () {
65 global $feedwordpress;
66
67 if ( ! is_null( FeedWordPress::post( 'create_index' ) ) ) :
68 FeedWordPress::create_guid_index();
69 $this->updated = __('guid column index created on database table.');
70 endif;
71 if ( ! is_null( FeedWordPress::post( 'remove_index' ) ) ) :
72 FeedWordPress::remove_guid_index();
73 $this->updated = __('guid column index removed from database table.');
74 endif;
75
76 if ( ! is_null( FeedWordPress::post( 'clear_cache' ) ) ) :
77 $N = $feedwordpress->clear_cache();
78 $feeds = (($N == 1) ? __("feed") : __("feeds"));
79 $this->updated = sprintf( __("Cleared %d cached %s from WordPress database."), $N, $feeds );
80 endif;
81
82 } /* FeedWordPressPerformancePage::accept_POST () */
83
84 static function performance_box ($page, $box = NULL) {
85
86 // Hey ho, let's go...
87 ?>
88 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
89 <tr style="vertical-align: top">
90 <th width="33%" scope="row">Feed cache:</th>
91 <td width="67%"><input class="button" type="submit" name="clear_cache" value="Clear all cached feeds from WordPress database" />
92 <p>This will clear all cached copies of feed data from the WordPress database
93 and force FeedWordPress to make a fresh scan for updates on syndicated feeds.</p></td></tr>
94
95 <tr style="vertical-align: top">
96 <th width="33%" scope="row">Guid index:</th>
97 <td width="67%"><?php if (!FeedWordPress::has_guid_index()) : ?>
98 <input class="button" type="submit" name="create_index" value="Create index on guid column in posts database table" />
99 <p>Creating this index may significantly improve performance on some large
100 FeedWordPress installations.</p>
101 <?php else : ?>
102
103 <p>You have already created an index on the guid column in the WordPress posts
104 table. If you'd like to remove the index for any reason, you can do so here.</p>
105
106 <input class="button" type="submit" name="remove_index" value="Remove index on guid column in posts database table" />
107
108 <?php endif; ?>
109
110 </tr>
111
112 </td>
113 </tr>
114 </table>
115 <?php
116 } /* FeedWordPressPerformancePage::performance_box () */
117 } /* class FeedWordPressPerformancePage */
118
119 $performancePage = new FeedWordPressPerformancePage;
120 $performancePage->display();
121
122