Version Description
Download this release
Release Info
Developer | mitchoyoshitaka |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 3.1.3b1 |
Comparing to | |
See all releases |
Code changes from version 3.1.2 to 3.1.3b1
- install.txt +3 -3
- magic.php +6 -5
- options.php +0 -12
- readme.txt +4 -0
- services.php +0 -40
- yarpp.php +2 -2
install.txt
CHANGED
@@ -5,11 +5,11 @@ Support forum: http://wordpress.org/tags/yet-another-related-posts-plugin
|
|
5 |
|
6 |
== INSTALLATION ==
|
7 |
|
8 |
-
1. Copy the folder `yet-another-related-posts-plugin` into the directory `wp-content/plugins/` and (optionally) the sample
|
9 |
|
10 |
2. Activate the plugin.
|
11 |
|
12 |
-
3. Find the Related Posts (YARPP) settings page in your `wp-admin
|
13 |
|
14 |
NOTE: If you run a large and complex site and/or worry about your SQL query volume, it may be better to simply make sure the "compute related posts on the fly" option is turned on and *not* try to build the cache all at once.
|
15 |
|
@@ -25,4 +25,4 @@ Read the FAQ:
|
|
25 |
http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/faq/
|
26 |
|
27 |
If it's not in the FAQ, find it or ask it in the forum:
|
28 |
-
http://wordpress.org/
|
5 |
|
6 |
== INSTALLATION ==
|
7 |
|
8 |
+
1. Copy the folder `yet-another-related-posts-plugin` into the directory `wp-content/plugins/` and (optionally) the sample template files inside the `yarpp-templates` folder into your active theme.
|
9 |
|
10 |
2. Activate the plugin.
|
11 |
|
12 |
+
3. Find the Related Posts (YARPP) settings page in your `wp-admin` and update if necessary.
|
13 |
|
14 |
NOTE: If you run a large and complex site and/or worry about your SQL query volume, it may be better to simply make sure the "compute related posts on the fly" option is turned on and *not* try to build the cache all at once.
|
15 |
|
25 |
http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/faq/
|
26 |
|
27 |
If it's not in the FAQ, find it or ask it in the forum:
|
28 |
+
http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform
|
magic.php
CHANGED
@@ -384,7 +384,8 @@ function yarpp_save_cache($post_ID,$force=true) {
|
|
384 |
|
385 |
function yarpp_cache_clear($reference_IDs) {
|
386 |
global $wpdb;
|
387 |
-
|
|
|
388 |
}
|
389 |
|
390 |
function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
|
@@ -393,10 +394,10 @@ function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
|
|
393 |
if ($reference_ID === '' || $reference_ID === false)
|
394 |
return false;
|
395 |
|
396 |
-
$timeout = 600;
|
397 |
-
|
398 |
if (!$force) {
|
399 |
-
if ($wpdb->get_var("select count(*) as count from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID
|
|
|
|
|
400 |
if ($yarpp_debug) echo "<!--YARPP is using the cache right now.-->";
|
401 |
return false;
|
402 |
}
|
@@ -415,7 +416,7 @@ function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
|
|
415 |
// if changes were made, let's find out which ones are new. We'll want to clear their caches
|
416 |
// so that they will be rebuilt when they're hit next.
|
417 |
if ($wpdb->rows_affected) {
|
418 |
-
$new_relations = $wpdb->get_col("select ID from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID
|
419 |
yarpp_cache_clear($new_relations);
|
420 |
}
|
421 |
|
384 |
|
385 |
function yarpp_cache_clear($reference_IDs) {
|
386 |
global $wpdb;
|
387 |
+
if (is_array($reference_IDs) && count($reference_IDs))
|
388 |
+
$wpdb->query("delete from {$wpdb->prefix}yarpp_related_cache where reference_ID in (".implode(',',$reference_IDs).")");
|
389 |
}
|
390 |
|
391 |
function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
|
394 |
if ($reference_ID === '' || $reference_ID === false)
|
395 |
return false;
|
396 |
|
|
|
|
|
397 |
if (!$force) {
|
398 |
+
if ($wpdb->get_var("select count(*) as count from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID")) {
|
399 |
+
// 3.1.3: removed the cache timeout
|
400 |
+
// and date > date_sub(now(),interval 600 minute)
|
401 |
if ($yarpp_debug) echo "<!--YARPP is using the cache right now.-->";
|
402 |
return false;
|
403 |
}
|
416 |
// if changes were made, let's find out which ones are new. We'll want to clear their caches
|
417 |
// so that they will be rebuilt when they're hit next.
|
418 |
if ($wpdb->rows_affected) {
|
419 |
+
$new_relations = $wpdb->get_col("select ID from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID and ID != 0");
|
420 |
yarpp_cache_clear($new_relations);
|
421 |
}
|
422 |
|
options.php
CHANGED
@@ -98,12 +98,6 @@ if (isset($_POST['update_yarpp'])) {
|
|
98 |
}
|
99 |
echo '<div class="updated fade" style="background-color: rgb(207, 235, 247);"><p>'.__('Options saved!','yarpp').'</p></div>';
|
100 |
}
|
101 |
-
|
102 |
-
// check if the cache is complete or not.
|
103 |
-
$cache_complete = $wpdb->get_var("select (count(p.ID)-sum(c.ID IS NULL))/count(p.ID)
|
104 |
-
FROM $wpdb->posts as p
|
105 |
-
LEFT JOIN {$wpdb->prefix}yarpp_related_cache as c ON ( p.ID = c.reference_ID )
|
106 |
-
WHERE p.post_status = 'publish' ");
|
107 |
|
108 |
//compute $tagmap
|
109 |
$tagmap = array();
|
@@ -383,12 +377,6 @@ function load_display_discats() {
|
|
383 |
load_display_distags();
|
384 |
load_display_demo_web();
|
385 |
load_display_demo_rss();
|
386 |
-
jQuery('#build-cache-button').click(function() {
|
387 |
-
jQuery('#yarpp-cache-message').hide();
|
388 |
-
jQuery('#build-cache-button').hide();
|
389 |
-
jQuery('#build-display').css('display','block');
|
390 |
-
yarppBuildRequest();
|
391 |
-
});
|
392 |
|
393 |
version = jQuery('#yarpp-version').html();
|
394 |
|
98 |
}
|
99 |
echo '<div class="updated fade" style="background-color: rgb(207, 235, 247);"><p>'.__('Options saved!','yarpp').'</p></div>';
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
//compute $tagmap
|
103 |
$tagmap = array();
|
377 |
load_display_distags();
|
378 |
load_display_demo_web();
|
379 |
load_display_demo_rss();
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
|
381 |
version = jQuery('#yarpp-version').html();
|
382 |
|
readme.txt
CHANGED
@@ -148,6 +148,10 @@ If you are a bilingual speaker of English and another language and an avid user
|
|
148 |
|
149 |
== Changelog ==
|
150 |
|
|
|
|
|
|
|
|
|
151 |
= 3.1.2 =
|
152 |
* Bugfix: [saving posts would sometimes timeout](http://wordpress.org/support/topic/343001)
|
153 |
= 3.1.1 =
|
148 |
|
149 |
== Changelog ==
|
150 |
|
151 |
+
= 3.1.3 =
|
152 |
+
* Turning off cache expiration, made possible by smarter caching system of 3.1—should improve database performance over time
|
153 |
+
* Code cleanup
|
154 |
+
* Bugfix: [`yearpp_clear_cache` bug on empty input](http://wordpress.org/support/topic/343001)
|
155 |
= 3.1.2 =
|
156 |
* Bugfix: [saving posts would sometimes timeout](http://wordpress.org/support/topic/343001)
|
157 |
= 3.1.1 =
|
services.php
CHANGED
@@ -6,7 +6,6 @@ if (function_exists('add_action')) {
|
|
6 |
add_action('wp_ajax_yarpp_display_distags', 'yarpp_ajax_display_distags');
|
7 |
add_action('wp_ajax_yarpp_display_demo_web', 'yarpp_ajax_display_demo_web');
|
8 |
add_action('wp_ajax_yarpp_display_demo_rss', 'yarpp_ajax_display_demo_rss');
|
9 |
-
add_action('wp_ajax_yarpp_build_cache_action', 'yarpp_build_cache');
|
10 |
}
|
11 |
|
12 |
function yarpp_ajax_display_discats() {
|
@@ -52,42 +51,3 @@ function yarpp_ajax_display_demo_rss() {
|
|
52 |
echo ereg_replace("[\n\r]",'',nl2br(htmlspecialchars($return)));
|
53 |
exit;
|
54 |
}
|
55 |
-
|
56 |
-
function yarpp_build_cache() {
|
57 |
-
global $wpdb;
|
58 |
-
if (!is_user_logged_in() || !current_user_can('level_10')) {
|
59 |
-
wp_die(__('You cannot rebuild the YARPP cache.', 'yarpp'));
|
60 |
-
}
|
61 |
-
|
62 |
-
if (!$_POST['i']) {
|
63 |
-
$id = $wpdb->get_var("select min(ID), count(ID) from $wpdb->posts where post_status = 'publish'",0);
|
64 |
-
$i = 1;
|
65 |
-
$m = $wpdb->get_var(null,1);
|
66 |
-
} else {
|
67 |
-
$id = $_POST['id'];
|
68 |
-
$i = $_POST['i'];
|
69 |
-
$m = $_POST['m'];
|
70 |
-
}
|
71 |
-
|
72 |
-
$timeout = 2; // seconds
|
73 |
-
$start = yarpp_microtime_float();
|
74 |
-
while ((yarpp_microtime_float() - $start) < $timeout and $i <= $m) {
|
75 |
-
$result = yarpp_cache_enforce(array('post'),$id,true);
|
76 |
-
|
77 |
-
if (!$result) {
|
78 |
-
header('Content-Type: application/json');
|
79 |
-
echo "{result:'error',id: '$id', title: '".addslashes($title)."', i: $i, m: $m, percent: '".(floor(1000 * $i/$m)/10)."'}";
|
80 |
-
exit();
|
81 |
-
}
|
82 |
-
|
83 |
-
$id = $wpdb->get_var("select ID, post_title from $wpdb->posts where ID > $id and post_status = 'publish' and ifnull(post_title,'') != '' order by ID asc limit 1",0);
|
84 |
-
$title = $wpdb->get_var(null,1);
|
85 |
-
$i++;
|
86 |
-
}
|
87 |
-
|
88 |
-
header('Content-Type: application/json');
|
89 |
-
echo "{result:'success',time:'".(yarpp_microtime_float() - $start)."', id: '$id', title: '".addslashes($title)."', i: $i, m: $m, percent: '".(floor(1000 * $i/$m)/10)."'}";
|
90 |
-
exit();
|
91 |
-
}
|
92 |
-
|
93 |
-
?>
|
6 |
add_action('wp_ajax_yarpp_display_distags', 'yarpp_ajax_display_distags');
|
7 |
add_action('wp_ajax_yarpp_display_demo_web', 'yarpp_ajax_display_demo_web');
|
8 |
add_action('wp_ajax_yarpp_display_demo_rss', 'yarpp_ajax_display_demo_rss');
|
|
|
9 |
}
|
10 |
|
11 |
function yarpp_ajax_display_discats() {
|
51 |
echo ereg_replace("[\n\r]",'',nl2br(htmlspecialchars($return)));
|
52 |
exit;
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yarpp.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
-
Version: 3.1.
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
10 |
*/
|
11 |
|
12 |
-
define('YARPP_VERSION','3.1.
|
13 |
|
14 |
require_once('includes.php');
|
15 |
require_once('related-functions.php');
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
+
Version: 3.1.3b1
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
10 |
*/
|
11 |
|
12 |
+
define('YARPP_VERSION','3.1.3b1');
|
13 |
|
14 |
require_once('includes.php');
|
15 |
require_once('related-functions.php');
|