VaultPress - Version 1.5.9

Version Description

  • Feature: If available, use command line md5sum and sha1sum to get checksums for large files.
Download this release

Release Info

Developer briancolinger
Plugin Icon 128x128 VaultPress
Version 1.5.9
Comparing to
See all releases

Code changes from version 1.5.8 to 1.5.9

Files changed (3) hide show
  1. class.vaultpress-filesystem.php +46 -2
  2. readme.txt +4 -1
  3. vaultpress.php +2 -2
class.vaultpress-filesystem.php CHANGED
@@ -69,6 +69,50 @@ class VaultPress_Filesystem {
69
  die();
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  function stat( $file, $md5=true, $sha1=true ) {
73
  $rval = array();
74
  foreach ( stat( $file ) as $i => $v ) {
@@ -79,9 +123,9 @@ class VaultPress_Filesystem {
79
  $rval['type'] = filetype( $file );
80
  if ( $rval['type'] == 'file' ) {
81
  if ( $md5 )
82
- $rval['md5'] = md5_file( $file );
83
  if ( $sha1 )
84
- $rval['sha1'] = sha1_file( $file );
85
  }
86
  $dir = $this->dir;
87
  if ( 0 !== strpos( $file, $dir ) && 'wp-config.php' == basename( $file ) ) {
69
  die();
70
  }
71
 
72
+ function exec_checksum( $file, $method ) {
73
+ if ( !function_exists( 'exec' ) )
74
+ return false;
75
+ $out = array();
76
+ if ( 'md5' == $method )
77
+ $method_bin = 'md5sum';
78
+ if ( 'sha1' == $method )
79
+ $method_bin = 'sha1sum';
80
+ $checksum = '';
81
+ exec( sprintf( '%s %s', escapeshellcmd( $method_bin ), escapeshellarg( $file ) ), $out );
82
+ if ( !empty( $out ) )
83
+ $checksum = trim( array_shift( explode( ' ', array_pop( $out ) ) ) );
84
+ if ( !empty( $checksum ) )
85
+ return $checksum;
86
+ return false;
87
+ }
88
+
89
+ function checksum_file( $file, $method ) {
90
+ $use_exec = false;
91
+ if ( filesize( $file ) >= 104857600 )
92
+ $use_exec = true;
93
+ switch( $method ) {
94
+ case 'md5':
95
+ if ( $use_exec ) {
96
+ $checksum = $this->exec_checksum( $file, $method );
97
+ if ( !empty( $checksum ) )
98
+ return $checksum;
99
+ }
100
+ return md5_file( $file );
101
+ break;
102
+ case 'sha1':
103
+ if ( $use_exec ) {
104
+ $checksum = $this->exec_checksum( $file, $method );
105
+ if ( !empty( $checksum ) )
106
+ return $checksum;
107
+ }
108
+ return sha1_file( $file );
109
+ break;
110
+ default:
111
+ return false;
112
+ break;
113
+ }
114
+ }
115
+
116
  function stat( $file, $md5=true, $sha1=true ) {
117
  $rval = array();
118
  foreach ( stat( $file ) as $i => $v ) {
123
  $rval['type'] = filetype( $file );
124
  if ( $rval['type'] == 'file' ) {
125
  if ( $md5 )
126
+ $rval['md5'] = $this->checksum_file( $file, 'md5' );
127
  if ( $sha1 )
128
+ $rval['sha1'] = $this->checksum_file( $file, 'sha1' );
129
  }
130
  $dir = $this->dir;
131
  if ( 0 !== strpos( $file, $dir ) && 'wp-config.php' == basename( $file ) ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, apokalyptik, briancolinger, josephscott, shaunandrews,
3
  Tags: security, malware, virus, backups, scanning
4
  Requires at least: 2.9.2
5
  Tested up to: 3.9.1
6
- Stable tag: 1.5.8
7
  License: GPLv2
8
 
9
  VaultPress is a subscription service offering realtime backup, automated security scanning, and support from WordPress experts.
@@ -51,6 +51,9 @@ A VaultPress subscription is for a single WordPress site. You can purchase addit
51
  Yes, VaultPress supports Multisite installs. Each site will require its own subscription.
52
 
53
  == Changelog ==
 
 
 
54
  = 1.5.8 =
55
  * Security: Add a new security hotfix.
56
 
3
  Tags: security, malware, virus, backups, scanning
4
  Requires at least: 2.9.2
5
  Tested up to: 3.9.1
6
+ Stable tag: 1.5.9
7
  License: GPLv2
8
 
9
  VaultPress is a subscription service offering realtime backup, automated security scanning, and support from WordPress experts.
51
  Yes, VaultPress supports Multisite installs. Each site will require its own subscription.
52
 
53
  == Changelog ==
54
+ = 1.5.9 =
55
+ * Feature: If available, use command line md5sum and sha1sum to get checksums for large files.
56
+
57
  = 1.5.8 =
58
  * Security: Add a new security hotfix.
59
 
vaultpress.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: VaultPress
4
  * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&utm_medium=plugin-description&utm_campaign=1.0
5
  * Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
- * Version: 1.5.8
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
9
  * License: GPL2+
@@ -18,7 +18,7 @@ if ( !defined( 'ABSPATH' ) )
18
  class VaultPress {
19
  var $option_name = 'vaultpress';
20
  var $db_version = 3;
21
- var $plugin_version = '1.5.8';
22
 
23
  function __construct() {
24
  register_activation_hook( __FILE__, array( $this, 'activate' ) );
3
  * Plugin Name: VaultPress
4
  * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
5
  * Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
+ * Version: 1.5.9
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
9
  * License: GPL2+
18
  class VaultPress {
19
  var $option_name = 'vaultpress';
20
  var $db_version = 3;
21
+ var $plugin_version = '1.5.9';
22
 
23
  function __construct() {
24
  register_activation_hook( __FILE__, array( $this, 'activate' ) );