InfiniteWP Client - Version 1.3.15

Version Description

  • Improvement: Security improvement.
  • Fix: Parent theme update showing as child theme update.
  • Fix: Bug fixes.
Download this release

Release Info

Developer infinitewp
Plugin Icon 128x128 InfiniteWP Client
Version 1.3.15
Comparing to
See all releases

Code changes from version 1.3.14 to 1.3.15

Files changed (4) hide show
  1. init.php +149 -2
  2. installer.class.php +61 -51
  3. plugins/cleanup/cleanup.php +3 -1
  4. readme.txt +5 -0
init.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: InfiniteWP - Client
4
Plugin URI: http://infinitewp.com/
5
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
6
Author: Revmakx
7
- Version: 1.3.14
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
@@ -26,7 +26,7 @@ Author URI: http://www.revmakx.com
26
**************************************************************/
27
28
if(!defined('IWP_MMB_CLIENT_VERSION'))
29
- define('IWP_MMB_CLIENT_VERSION', '1.3.14');
30
31
32
@@ -121,6 +121,8 @@ if( !function_exists ('iwp_mmb_parse_request')) {
121
122
iwp_mmb_create_backup_table();
123
124
$action = $iwp_action;
125
$_wp_using_ext_object_cache = false;
126
@set_time_limit(600);
@@ -1856,6 +1858,151 @@ if(!function_exists('iwp_mmb_add_zero_clipboard_scripts')){
1856
}
1857
}
1858
1859
if ( !get_option('iwp_client_public_key') && function_exists('add_action')){
1860
add_action('admin_enqueue_scripts', 'iwp_mmb_add_zero_clipboard_scripts');
1861
}
4
Plugin URI: http://infinitewp.com/
5
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
6
Author: Revmakx
7
+ Version: 1.3.15
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
26
**************************************************************/
27
28
if(!defined('IWP_MMB_CLIENT_VERSION'))
29
+ define('IWP_MMB_CLIENT_VERSION', '1.3.15');
30
31
32
121
122
iwp_mmb_create_backup_table();
123
124
+ run_hash_change_process();
125
+
126
$action = $iwp_action;
127
$_wp_using_ext_object_cache = false;
128
@set_time_limit(600);
1858
}
1859
}
1860
1861
+ if (!function_exists('run_hash_change_process')) {
1862
+ function run_hash_change_process(){
1863
+ //code to check whether old hash files are already changed from wp_option table flag
1864
+ $is_replaced = get_option('iwp_client_replaced_old_hash_backup_files');
1865
+ if($is_replaced){
1866
+ return true;
1867
+ }
1868
+
1869
+ global $wpdb;
1870
+ $table_name = $wpdb->base_prefix . "iwp_backup_status";
1871
+ $rows = $wpdb->get_results("SELECT historyID,taskResults FROM ".$table_name, ARRAY_A);
1872
+
1873
+ $hash_changed_files = array();
1874
+ $hash_changed_urls = array();
1875
+ foreach($rows as $k => $v){
1876
+ $this_his_id = $v['historyID'];
1877
+ $this_task_result = unserialize($v['taskResults']);
1878
+ if(!empty($this_task_result) && !empty($this_task_result['task_results']) && !empty($this_task_result['task_results'][$this_his_id]) && !empty($this_task_result['task_results'][$this_his_id]['server']) && !empty($this_task_result['task_results'][$this_his_id]['server']) && !empty($this_task_result['task_results'][$this_his_id]['server']['file_path']) && !empty($this_task_result['task_results'][$this_his_id]['server']['file_url'])){
1879
+ $new_task_result_server = modify_task_result_server($this_task_result['task_results'][$this_his_id]['server']);
1880
+ if(is_array($new_task_result_server) && array_key_exists("error")){
1881
+ continue;
1882
+ }
1883
+ $this_task_result['task_results'][$this_his_id]['server'] = $new_task_result_server;
1884
+ }
1885
+ if(!empty($this_task_result) && !empty($this_task_result['server']) && !empty($new_task_result_server['hash'])){
1886
+ $new_task_result_server = modify_task_result_server($this_task_result['server'], $new_task_result_server['hash']);
1887
+ if(is_array($new_task_result_server) && array_key_exists("error")){
1888
+ return $new_task_result_server;
1889
+ break;
1890
+ }
1891
+ $this_task_result['server'] = $new_task_result_server;
1892
+
1893
+ }
1894
+
1895
+ //updating table with new fileNames
1896
+ $new_task_result = serialize($this_task_result);
1897
+ $update = $wpdb->update($wpdb->base_prefix.'iwp_backup_status',array('taskResults' => $new_task_result ),array( 'historyID' => $this_his_id),array('%s'),array('%d'));
1898
+ }
1899
+ update_option('iwp_client_replaced_old_hash_backup_files', true);
1900
+ return true;
1901
+ }
1902
+ }
1903
+
1904
+ if (!function_exists('modify_task_result_server')) {
1905
+ function modify_task_result_server($task_result_server, $useThisHash=''){
1906
+ if(!is_array($task_result_server['file_path'])){
1907
+ $current_file = $task_result_server['file_path'];
1908
+ $task_result_server['file_path'] = array();
1909
+ $task_result_server['file_path'][0] = $current_file;
1910
+ }
1911
+ if(!is_array($task_result_server['file_url'])){
1912
+ $current_url = $task_result_server['file_url'];
1913
+ $task_result_server['file_url'] = array();
1914
+ $task_result_server['file_url'][0] = $current_url;
1915
+ }
1916
+
1917
+ $old_file_path = $task_result_server['file_path'];
1918
+ $old_file_url = $task_result_server['file_url'];
1919
+
1920
+ $new_file_path = replace_old_hash_with_new_hash($old_file_path, $useThisHash);
1921
+ foreach($new_file_path['files'] as $ke => $va){
1922
+
1923
+ //rename file
1924
+ $rename_result = rename_old_backup_file_name($va['old'], $va['new']);
1925
+ if(is_array($rename_result) && array_key_exists("error")){
1926
+ return $rename_result;
1927
+ break;
1928
+ }
1929
+ $task_result_server['file_path'][$ke] = $va['new'];
1930
+ }
1931
+ $task_result_server['hash'] = $new_file_path['hash'];
1932
+
1933
+ $new_file_url = replace_old_hash_with_new_hash($old_file_url, $new_file_path['hash']);
1934
+ foreach($new_file_url['files'] as $ke => $va){
1935
+ $task_result_server['file_url'][$ke] = $va['new'];
1936
+ }
1937
+
1938
+ //for single backup fix
1939
+ if(count($task_result_server['file_path']) === 1){
1940
+ $temp_val = $task_result_server['file_path'][0];
1941
+ unset($task_result_server['file_path']);
1942
+ $task_result_server['file_path'] = $temp_val;
1943
+ }
1944
+ if(count($task_result_server['file_url']) === 1){
1945
+ $temp_val = $task_result_server['file_url'][0];
1946
+ unset($task_result_server['file_url']);
1947
+ $task_result_server['file_url'] = $temp_val;
1948
+ }
1949
+ return $task_result_server;
1950
+ }
1951
+ }
1952
+
1953
+ if (!function_exists('replace_old_hash_with_new_hash')) {
1954
+
1955
+ function replace_old_hash_with_new_hash($backFileArr, $useThisHash='') {
1956
+ $newbackupfileArr = array();
1957
+ $newbackupfileArr['files'] = array();
1958
+ $newbackupfileArr['hash'] = '';
1959
+
1960
+ if(empty($useThisHash)){
1961
+ $newBackupHash = md5(microtime(true).uniqid('',true).substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, rand(20,60)));
1962
+ $useThisHash = $newBackupHash;
1963
+ }
1964
+ else{
1965
+ $newBackupHash = $useThisHash;
1966
+ }
1967
+ foreach($backFileArr as $k => $backFile){
1968
+ $iwpPart = '.zip';
1969
+ $tempBackupFile = $backFile;
1970
+
1971
+ $iwpPartIndex = strpos($backFile, '_iwp_part');
1972
+ if($iwpPartIndex !== false){
1973
+ $iwpPart = substr($backFile, $iwpPartIndex);
1974
+ $backFile = substr($backFile, 0, $iwpPartIndex);
1975
+ }
1976
+
1977
+ $backFileInArray = explode("_", $backFile);
1978
+ $hashIndex = count($backFileInArray) - 1;
1979
+
1980
+ $backupHashWithZip = $backFileInArray[$hashIndex];
1981
+ $backupHash = substr($backupHashWithZip, 0, 32);
1982
+
1983
+ $newBackupHashWithZip = $newBackupHash . $iwpPart;
1984
+ $newBackupFile = substr($backFile, 0, strpos($backFile, $backupHashWithZip));
1985
+ $newBackupFile = $newBackupFile . $newBackupHashWithZip;
1986
+ $newbackupfileArr['files'][$k]['new'] = $newBackupFile;
1987
+ $newbackupfileArr['files'][$k]['old'] = $tempBackupFile;
1988
+ }
1989
+ $newbackupfileArr['hash'] = $newBackupHash;
1990
+ return $newbackupfileArr;
1991
+ }
1992
+
1993
+ }
1994
+
1995
+
1996
+ if (!function_exists('rename_old_backup_file_name')) {
1997
+
1998
+ function rename_old_backup_file_name($oldName, $newName) {
1999
+ if (!@rename($oldName, $newName)) {
2000
+ return array('error' => 'Unable to rename old files', 'error_code' => 'unable_to_remane_old_backup_files');
2001
+ }
2002
+ return true;
2003
+ }
2004
+ }
2005
+
2006
if ( !get_option('iwp_client_public_key') && function_exists('add_action')){
2007
add_action('admin_enqueue_scripts', 'iwp_mmb_add_zero_clipboard_scripts');
2008
}
installer.class.php CHANGED
@@ -657,62 +657,72 @@ class IWP_MMB_Installer extends IWP_MMB_Core
657
return array();
658
}
659
660
- function get_upgradable_themes( $filter = array() )
661
- {
662
- if(function_exists('wp_get_themes')){
663
- $all_themes = wp_get_themes();
664
- $upgrade_themes = array();
665
-
666
- $current = $this->iwp_mmb_get_transient('update_themes');
667
- if (!empty($current->response)) {
668
- foreach ((array) $all_themes as $theme_template => $theme_data) {
669
- if(isset($theme_data->{'Parent Theme'}) && !empty($theme_data->{'Parent Theme'}))
670
- continue;
671
-
672
- if(isset($theme_data->Name) && in_array($theme_data->Name, $filter))
673
- continue;
674
-
675
- foreach ($current->response as $current_themes => $theme) {
676
- if ($theme_data->Template == $current_themes) {
677
- if (strlen($theme_data->Name) > 0 && strlen($theme_data->Version) > 0) {
678
- $current->response[$current_themes]['name'] = $theme_data->Name;
679
- $current->response[$current_themes]['old_version'] = $theme_data->Version;
680
- $current->response[$current_themes]['theme_tmp'] = $theme_data->Template;
681
- $upgrade_themes[] = $current->response[$current_themes];
682
- }
683
- }
684
- }
685
- }
686
- }
687
- }else{
688
- $all_themes = get_themes();
689
-
690
- $upgrade_themes = array();
691
-
692
- $current = $this->iwp_mmb_get_transient('update_themes');
693
- if (!empty($current->response)) {
694
- foreach ((array) $all_themes as $theme_template => $theme_data) {
695
- if(isset($theme_data['Parent Theme']) && !empty($theme_data['Parent Theme']))
696
- continue;
697
-
698
- if(isset($theme_data['Name']) && in_array($theme_data['Name'], $filter))
699
- continue;
700
-
701
- foreach ($current->response as $current_themes => $theme) {
702
- if ($theme_data['Template'] == $current_themes) {
703
- if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
704
- $current->response[$current_themes]['name'] = $theme_data['Name'];
705
- $current->response[$current_themes]['old_version'] = $theme_data['Version'];
706
- $current->response[$current_themes]['theme_tmp'] = $theme_data['Template'];
707
- $upgrade_themes[] = $current->response[$current_themes];
708
}
709
}
710
}
711
}
712
}
713
- }
714
-
715
-
716
return $upgrade_themes;
717
}
718
657
return array();
658
}
659
660
+ function get_upgradable_themes($filter = array()) {
661
+ if (function_exists('wp_get_themes')) {
662
+ $all_themes = wp_get_themes();
663
+ $upgrade_themes = array();
664
+
665
+ $current = $this->iwp_mmb_get_transient('update_themes');
666
+ if (!empty($current->response)) {
667
+ foreach ((array) $all_themes as $theme_template => $theme_data) {
668
+
669
+ if (isset($theme_data->{'Parent Theme'}) && !empty($theme_data->{'Parent Theme'})) {
670
+ continue;
671
+ }
672
+
673
+ if (isset($theme_data->Name) && in_array($theme_data->Name, $filter)) {
674
+ continue;
675
+ }
676
+
677
+ if (!$theme_data->parent()) {
678
+ foreach ($current->response as $current_themes => $theme) {
679
+ if ($theme_data->Template == $current_themes) {
680
+ if (strlen($theme_data->Name) > 0 && strlen($theme_data->Version) > 0) {
681
+
682
+ $current->response[$current_themes]['name'] = $theme_data->Name;
683
+ $current->response[$current_themes]['old_version'] = $theme_data->Version;
684
+ $current->response[$current_themes]['theme_tmp'] = $theme_data->Template;
685
+ $upgrade_themes[] = $current->response[$current_themes];
686
+
687
+ }
688
+ }
689
}
690
}
691
}
692
}
693
+ } else {
694
+ $all_themes = get_themes();
695
+
696
+ $upgrade_themes = array();
697
+
698
+ $current = $this->iwp_mmb_get_transient('update_themes');
699
+
700
+ if (!empty($current->response)) {
701
+ foreach ((array) $all_themes as $theme_template => $theme_data) {
702
+ if (isset($theme_data['Parent Theme']) && !empty($theme_data['Parent Theme'])) {
703
+ continue;
704
+ }
705
+
706
+ if (isset($theme_data['Name']) && in_array($theme_data['Name'], $filter)) {
707
+ continue;
708
+ }
709
+ if (!$theme_data->parent()) {
710
+ foreach ($current->response as $current_themes => $theme) {
711
+ if ($theme_data['Template'] == $current_themes) {
712
+ if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
713
+ $current->response[$current_themes]['name'] = $theme_data['Name'];
714
+ $current->response[$current_themes]['old_version'] = $theme_data['Version'];
715
+ $current->response[$current_themes]['theme_tmp'] = $theme_data['Template'];
716
+ $upgrade_themes[] = $current->response[$current_themes];
717
+ }
718
+ }
719
+ }
720
+ }
721
+ }
722
+ }
723
+
724
}
725
+
726
return $upgrade_themes;
727
}
728
plugins/cleanup/cleanup.php CHANGED
@@ -119,6 +119,8 @@ function iwp_mmb_handle_overhead($clear = false)
119
$tables = $wpdb->get_results($query, ARRAY_A);
120
$total_gain = 0;
121
$table_string = '';
122
foreach ($tables as $table) {
123
if (in_array($table['Engine'], array(
124
'MyISAM',
@@ -146,7 +148,7 @@ function iwp_mmb_handle_overhead($clear = false)
146
//$total_gain += $table['Data_free'] > 100*1024*1024 ? $table['Data_free'] / 1024 : 0;
147
}
148
}
149
-
150
if ($clear) {
151
$table_string = substr($table_string, 0, strlen($table_string) - 1); //remove last ,
152
119
$tables = $wpdb->get_results($query, ARRAY_A);
120
$total_gain = 0;
121
$table_string = '';
122
+ if (!empty($table) && is_array($table)) {
123
+
124
foreach ($tables as $table) {
125
if (in_array($table['Engine'], array(
126
'MyISAM',
148
//$total_gain += $table['Data_free'] > 100*1024*1024 ? $table['Data_free'] / 1024 : 0;
149
}
150
}
151
+ }
152
if ($clear) {
153
$table_string = substr($table_string, 0, strlen($table_string) - 1); //remove last ,
154
readme.txt CHANGED
@@ -48,6 +48,11 @@ Credits: [Vladimir Prelovac](http://prelovac.com/vladimir) for his worker plugin
48
49
== Changelog ==
50
51
= 1.3.14 =
52
* Fix: Bug fix.
53
48
49
== Changelog ==
50
51
+ = 1.3.15 =
52
+ * Improvement: Security improvement.
53
+ * Fix: Parent theme update showing as child theme update.
54
+ * Fix: Bug fixes.
55
+
56
= 1.3.14 =
57
* Fix: Bug fix.
58