cleanup + fail in php < 5.2 + log tune
This commit is contained in:
parent
03d5b738a7
commit
b46481d78f
3 changed files with 19 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
=== wp-resized2cache ===
|
=== wp-resized2cache ===
|
||||||
Contributors: cadeyrn
|
Contributors: cadeyrn
|
||||||
Donate link:
|
Donate link: https://paypal.me/petermolnar/3
|
||||||
Tags: image, cache, image quality,
|
Tags: image, cache, image quality,
|
||||||
Requires at least: 3.0
|
Requires at least: 3.0
|
||||||
Tested up to: 4.4
|
Tested up to: 4.4
|
||||||
|
|
|
@ -33,6 +33,8 @@ class WP_RESIZED2CACHE {
|
||||||
const cachedir = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache';
|
const cachedir = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache';
|
||||||
|
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
|
register_activation_hook( __FILE__ , array( &$this, 'plugin_activate' ) );
|
||||||
|
|
||||||
if (!is_dir(static::cachedir)) {
|
if (!is_dir(static::cachedir)) {
|
||||||
if (!mkdir(static::cachedir)) {
|
if (!mkdir(static::cachedir)) {
|
||||||
static::debug('failed to create ' . static::cachedir);
|
static::debug('failed to create ' . static::cachedir);
|
||||||
|
@ -53,6 +55,16 @@ class WP_RESIZED2CACHE {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* activate hook
|
||||||
|
*/
|
||||||
|
public static function plugin_activate() {
|
||||||
|
if ( version_compare( phpversion(), 5.3, '<' ) ) {
|
||||||
|
die( 'The minimum PHP version required for this plugin is 5.3' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called on attachment deletion and takes care of removing the moved files
|
* called on attachment deletion and takes care of removing the moved files
|
||||||
*
|
*
|
||||||
|
@ -110,8 +122,10 @@ class WP_RESIZED2CACHE {
|
||||||
|
|
||||||
$size = @getimagesize($resized);
|
$size = @getimagesize($resized);
|
||||||
|
|
||||||
if ( !$size )
|
if ( !$size ) {
|
||||||
|
static::debug("Unable to get size");
|
||||||
return $resized;
|
return $resized;
|
||||||
|
}
|
||||||
|
|
||||||
//$cachedir = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache';
|
//$cachedir = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue