Skip to content

Commit cb47e32

Browse files
committed
Added Update Blocker support, fixes #2
1 parent 285a3a5 commit cb47e32

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"php" : ">=5.3",
2222
"pimple/pimple" : "~2.0"
2323
},
24+
"suggest": {
25+
"rarst/update-blocker": "Prevents invalid updates from official repositories"
26+
},
2427
"autoload" : {
2528
"classmap": ["php/"]
2629
}

php/class-plugin.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Plugin extends \Pimple {
1515
public function run() {
1616

1717
add_action( 'init', array( $this, 'init' ) );
18+
add_filter( 'update_blocker_blocked', array( $this, 'update_blocker_blocked' ) );
1819
}
1920

2021
/**
@@ -34,6 +35,20 @@ public function init() {
3435
}
3536
}
3637

38+
/**
39+
* @see https://github.com/Rarst/update-blocker
40+
*
41+
* @param array $blocked
42+
*
43+
* @return array
44+
*/
45+
public function update_blocker_blocked( $blocked ) {
46+
47+
$blocked['plugins'][] = plugin_basename( dirname( __DIR__ ) . '/fragment-cache.php' );
48+
49+
return $blocked;
50+
}
51+
3752
/**
3853
* Add (or override) cache handler and enable it.
3954
*

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ add_filter( 'fc_skip_cache', function ( $skip, $type, $name, $args, $salt ) {
4646

4747
# Changelog
4848

49+
## 1.2
50+
51+
- added [Update Blocker](https://github.com/Rarst/update-blocker) support
52+
4953
## 1.1
5054

5155
- anonymized fragment generation in front end for consistency

0 commit comments

Comments
 (0)