Version Description
Download this release
Release Info
Developer | cory@lamle.org |
Plugin | Duplicator – WordPress Migration Plugin |
Version | 1.1.22 |
Comparing to | |
See all releases |
Code changes from version 1.1.20 to 1.1.22
- classes/package.archive.php +315 -305
- classes/package.php +4 -1
- define.php +1 -1
- duplicator.php +11 -9
- readme.txt +2 -2
classes/package.archive.php
CHANGED
@@ -1,306 +1,316 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
|
3 |
-
|
4 |
-
require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.zip.php');
|
5 |
-
require_once (DUPLICATOR_PLUGIN_PATH . 'lib/forceutf8/Encoding.php');
|
6 |
-
|
7 |
-
/**
|
8 |
-
* The base class for all filter types Directories/Files/Extentions
|
9 |
-
*/
|
10 |
-
class DUP_Archive_Filter_Scope_Base
|
11 |
-
{
|
12 |
-
//All internal storage items that duplicator decides to filter
|
13 |
-
public $Core = array();
|
14 |
-
|
15 |
-
//Items when creating a package or template that a user decides to filter
|
16 |
-
public $Instance = array();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* The filter types that belong to directories
|
21 |
-
*/
|
22 |
-
class DUP_Archive_Filter_Scope_Directory extends DUP_Archive_Filter_Scope_Base
|
23 |
-
{
|
24 |
-
//Items that are not readable
|
25 |
-
public $Warning = array();
|
26 |
-
|
27 |
-
//Items that are not readable
|
28 |
-
public $Unreadable = array();
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* The filter types that belong to files
|
33 |
-
*/
|
34 |
-
class DUP_Archive_Filter_Scope_File extends DUP_Archive_Filter_Scope_Directory
|
35 |
-
{
|
36 |
-
//Items that are too large
|
37 |
-
public $Size = array();
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* The filter information object which store all information about the filtered
|
42 |
-
* data that is gathered to the execution of a scan process
|
43 |
-
*/
|
44 |
-
class DUP_Archive_Filter_Info
|
45 |
-
{
|
46 |
-
//Contains all folder filter info
|
47 |
-
public $Dirs = array();
|
48 |
-
|
49 |
-
//Contains all file filter info
|
50 |
-
public $Files = array();
|
51 |
-
|
52 |
-
//Contains all extensions filter info
|
53 |
-
public $Exts = array();
|
54 |
-
|
55 |
-
public $UDirCount = 0;
|
56 |
-
public $UFileCount = 0;
|
57 |
-
public $UExtCount = 0;
|
58 |
-
|
59 |
-
public function __construct()
|
60 |
-
{
|
61 |
-
$this->Dirs = new DUP_Archive_Filter_Scope_Directory();
|
62 |
-
$this->Files = new DUP_Archive_Filter_Scope_File();
|
63 |
-
$this->Exts = new DUP_Archive_Filter_Scope_Base();
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
-
class DUP_Archive
|
69 |
-
{
|
70 |
-
//PUBLIC
|
71 |
-
public $FilterDirs;
|
72 |
-
public $FilterExts;
|
73 |
-
public $FilterDirsAll = array();
|
74 |
-
public $FilterExtsAll = array();
|
75 |
-
public $FilterOn;
|
76 |
-
public $File;
|
77 |
-
public $Format;
|
78 |
-
public $PackDir;
|
79 |
-
public $Size = 0;
|
80 |
-
public $Dirs = array();
|
81 |
-
public $Files = array();
|
82 |
-
public $FilterInfo;
|
83 |
-
|
84 |
-
//PROTECTED
|
85 |
-
protected $Package;
|
86 |
-
|
87 |
-
public function __construct($package)
|
88 |
-
{
|
89 |
-
$this->Package = $package;
|
90 |
-
$this->FilterOn = false;
|
91 |
-
$this->FilterInfo = new DUP_Archive_Filter_Info();
|
92 |
-
}
|
93 |
-
|
94 |
-
public function Build($package)
|
95 |
-
{
|
96 |
-
try
|
97 |
-
{
|
98 |
-
$this->Package = $package;
|
99 |
-
if (!isset($this->PackDir) && ! is_dir($this->PackDir)) throw new Exception("The 'PackDir' property must be a valid diretory.");
|
100 |
-
if (!isset($this->File)) throw new Exception("A 'File' property must be set.");
|
101 |
-
|
102 |
-
$this->Package->SetStatus(DUP_PackageStatus::ARCSTART);
|
103 |
-
switch ($this->Format)
|
104 |
-
{
|
105 |
-
case 'TAR': break;
|
106 |
-
case 'TAR-GZIP': break;
|
107 |
-
default:
|
108 |
-
if (class_exists(ZipArchive))
|
109 |
-
{
|
110 |
-
$this->Format = 'ZIP';
|
111 |
-
DUP_Zip::Create($this);
|
112 |
-
}
|
113 |
-
break;
|
114 |
-
}
|
115 |
-
|
116 |
-
$storePath = "{$this->Package->StorePath}/{$this->File}";
|
117 |
-
$this->Size = @filesize($storePath);
|
118 |
-
$this->Package->SetStatus(DUP_PackageStatus::ARCDONE);
|
119 |
-
|
120 |
-
}
|
121 |
-
catch (Exception $e)
|
122 |
-
{
|
123 |
-
echo 'Caught exception: ', $e->getMessage(), "\n";
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
public function GetFilterDirAsArray()
|
128 |
-
{
|
129 |
-
return array_map('DUP_Util::SafePath', explode(";", $this->FilterDirs, -1));
|
130 |
-
}
|
131 |
-
|
132 |
-
public function GetFilterExtsAsArray()
|
133 |
-
{
|
134 |
-
return explode(";", $this->FilterExts, -1);
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Get the directory size recursively, but don't calc the snapshot directory, exclusion diretories
|
139 |
-
* @link http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx Windows filename restrictions
|
140 |
-
*/
|
141 |
-
public function Stats()
|
142 |
-
{
|
143 |
-
$this->createFilterInfo();
|
144 |
-
$this->getDirs();
|
145 |
-
$this->getFiles();
|
146 |
-
return $this;
|
147 |
-
}
|
148 |
-
|
149 |
-
//Build Filter Data
|
150 |
-
private function createFilterInfo()
|
151 |
-
{
|
152 |
-
//FILTER: INSTANCE ITEMS
|
153 |
-
//Add the items generated at create time
|
154 |
-
if ($this->FilterOn)
|
155 |
-
{
|
156 |
-
$this->FilterInfo->Dirs->Instance = array_map('DUP_Util::SafePath', explode(";", $this->FilterDirs, -1));
|
157 |
-
$this->FilterInfo->Exts->Instance = explode(";", $this->FilterExts, -1);
|
158 |
-
}
|
159 |
-
|
160 |
-
//FILTER: CORE ITMES
|
161 |
-
//Filters Duplicator free packages & All pro local directories
|
162 |
-
$this->FilterInfo->Dirs->Core[] = DUPLICATOR_SSDIR_PATH;
|
163 |
-
|
164 |
-
$this->FilterDirsAll = array_merge($this->FilterInfo->Dirs->Instance,
|
165 |
-
$this->FilterInfo->Dirs->Core);
|
166 |
-
|
167 |
-
$this->FilterExtsAll = array_merge($this->FilterInfo->Exts->Instance,
|
168 |
-
$this->FilterInfo->Exts->Core);
|
169 |
-
}
|
170 |
-
|
171 |
-
|
172 |
-
//Get All Directories then filter
|
173 |
-
private function getDirs()
|
174 |
-
{
|
175 |
-
|
176 |
-
$rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH, '//' ));
|
177 |
-
$this->Dirs = array();
|
178 |
-
|
179 |
-
//If the root directory is a filter then we will only need the root files
|
180 |
-
if (in_array($this->PackDir, $this->FilterDirsAll))
|
181 |
-
{
|
182 |
-
$this->Dirs[] = $this->PackDir;
|
183 |
-
}
|
184 |
-
else
|
185 |
-
{
|
186 |
-
|
187 |
-
$this->Dirs[] = $this->PackDir;
|
188 |
-
}
|
189 |
-
|
190 |
-
//Filter Directories
|
191 |
-
//Invalid test contains checks for: characters over 250, invlaid characters,
|
192 |
-
//empty string and directories ending with period (Windows incompatable)
|
193 |
-
foreach ($this->Dirs as $key => $val)
|
194 |
-
{
|
195 |
-
//
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
$
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
if ($
|
255 |
-
{
|
256 |
-
$
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
?>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
|
3 |
+
|
4 |
+
require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.zip.php');
|
5 |
+
require_once (DUPLICATOR_PLUGIN_PATH . 'lib/forceutf8/Encoding.php');
|
6 |
+
|
7 |
+
/**
|
8 |
+
* The base class for all filter types Directories/Files/Extentions
|
9 |
+
*/
|
10 |
+
class DUP_Archive_Filter_Scope_Base
|
11 |
+
{
|
12 |
+
//All internal storage items that duplicator decides to filter
|
13 |
+
public $Core = array();
|
14 |
+
|
15 |
+
//Items when creating a package or template that a user decides to filter
|
16 |
+
public $Instance = array();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* The filter types that belong to directories
|
21 |
+
*/
|
22 |
+
class DUP_Archive_Filter_Scope_Directory extends DUP_Archive_Filter_Scope_Base
|
23 |
+
{
|
24 |
+
//Items that are not readable
|
25 |
+
public $Warning = array();
|
26 |
+
|
27 |
+
//Items that are not readable
|
28 |
+
public $Unreadable = array();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The filter types that belong to files
|
33 |
+
*/
|
34 |
+
class DUP_Archive_Filter_Scope_File extends DUP_Archive_Filter_Scope_Directory
|
35 |
+
{
|
36 |
+
//Items that are too large
|
37 |
+
public $Size = array();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The filter information object which store all information about the filtered
|
42 |
+
* data that is gathered to the execution of a scan process
|
43 |
+
*/
|
44 |
+
class DUP_Archive_Filter_Info
|
45 |
+
{
|
46 |
+
//Contains all folder filter info
|
47 |
+
public $Dirs = array();
|
48 |
+
|
49 |
+
//Contains all file filter info
|
50 |
+
public $Files = array();
|
51 |
+
|
52 |
+
//Contains all extensions filter info
|
53 |
+
public $Exts = array();
|
54 |
+
|
55 |
+
public $UDirCount = 0;
|
56 |
+
public $UFileCount = 0;
|
57 |
+
public $UExtCount = 0;
|
58 |
+
|
59 |
+
public function __construct()
|
60 |
+
{
|
61 |
+
$this->Dirs = new DUP_Archive_Filter_Scope_Directory();
|
62 |
+
$this->Files = new DUP_Archive_Filter_Scope_File();
|
63 |
+
$this->Exts = new DUP_Archive_Filter_Scope_Base();
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
class DUP_Archive
|
69 |
+
{
|
70 |
+
//PUBLIC
|
71 |
+
public $FilterDirs;
|
72 |
+
public $FilterExts;
|
73 |
+
public $FilterDirsAll = array();
|
74 |
+
public $FilterExtsAll = array();
|
75 |
+
public $FilterOn;
|
76 |
+
public $File;
|
77 |
+
public $Format;
|
78 |
+
public $PackDir;
|
79 |
+
public $Size = 0;
|
80 |
+
public $Dirs = array();
|
81 |
+
public $Files = array();
|
82 |
+
public $FilterInfo;
|
83 |
+
|
84 |
+
//PROTECTED
|
85 |
+
protected $Package;
|
86 |
+
|
87 |
+
public function __construct($package)
|
88 |
+
{
|
89 |
+
$this->Package = $package;
|
90 |
+
$this->FilterOn = false;
|
91 |
+
$this->FilterInfo = new DUP_Archive_Filter_Info();
|
92 |
+
}
|
93 |
+
|
94 |
+
public function Build($package)
|
95 |
+
{
|
96 |
+
try
|
97 |
+
{
|
98 |
+
$this->Package = $package;
|
99 |
+
if (!isset($this->PackDir) && ! is_dir($this->PackDir)) throw new Exception("The 'PackDir' property must be a valid diretory.");
|
100 |
+
if (!isset($this->File)) throw new Exception("A 'File' property must be set.");
|
101 |
+
|
102 |
+
$this->Package->SetStatus(DUP_PackageStatus::ARCSTART);
|
103 |
+
switch ($this->Format)
|
104 |
+
{
|
105 |
+
case 'TAR': break;
|
106 |
+
case 'TAR-GZIP': break;
|
107 |
+
default:
|
108 |
+
if (class_exists(ZipArchive))
|
109 |
+
{
|
110 |
+
$this->Format = 'ZIP';
|
111 |
+
DUP_Zip::Create($this);
|
112 |
+
}
|
113 |
+
break;
|
114 |
+
}
|
115 |
+
|
116 |
+
$storePath = "{$this->Package->StorePath}/{$this->File}";
|
117 |
+
$this->Size = @filesize($storePath);
|
118 |
+
$this->Package->SetStatus(DUP_PackageStatus::ARCDONE);
|
119 |
+
|
120 |
+
}
|
121 |
+
catch (Exception $e)
|
122 |
+
{
|
123 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
public function GetFilterDirAsArray()
|
128 |
+
{
|
129 |
+
return array_map('DUP_Util::SafePath', explode(";", $this->FilterDirs, -1));
|
130 |
+
}
|
131 |
+
|
132 |
+
public function GetFilterExtsAsArray()
|
133 |
+
{
|
134 |
+
return explode(";", $this->FilterExts, -1);
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get the directory size recursively, but don't calc the snapshot directory, exclusion diretories
|
139 |
+
* @link http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx Windows filename restrictions
|
140 |
+
*/
|
141 |
+
public function Stats()
|
142 |
+
{
|
143 |
+
$this->createFilterInfo();
|
144 |
+
$this->getDirs();
|
145 |
+
$this->getFiles();
|
146 |
+
return $this;
|
147 |
+
}
|
148 |
+
|
149 |
+
//Build Filter Data
|
150 |
+
private function createFilterInfo()
|
151 |
+
{
|
152 |
+
//FILTER: INSTANCE ITEMS
|
153 |
+
//Add the items generated at create time
|
154 |
+
if ($this->FilterOn)
|
155 |
+
{
|
156 |
+
$this->FilterInfo->Dirs->Instance = array_map('DUP_Util::SafePath', explode(";", $this->FilterDirs, -1));
|
157 |
+
$this->FilterInfo->Exts->Instance = explode(";", $this->FilterExts, -1);
|
158 |
+
}
|
159 |
+
|
160 |
+
//FILTER: CORE ITMES
|
161 |
+
//Filters Duplicator free packages & All pro local directories
|
162 |
+
$this->FilterInfo->Dirs->Core[] = DUPLICATOR_SSDIR_PATH;
|
163 |
+
|
164 |
+
$this->FilterDirsAll = array_merge($this->FilterInfo->Dirs->Instance,
|
165 |
+
$this->FilterInfo->Dirs->Core);
|
166 |
+
|
167 |
+
$this->FilterExtsAll = array_merge($this->FilterInfo->Exts->Instance,
|
168 |
+
$this->FilterInfo->Exts->Core);
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
//Get All Directories then filter
|
173 |
+
private function getDirs()
|
174 |
+
{
|
175 |
+
|
176 |
+
$rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH, '//' ));
|
177 |
+
$this->Dirs = array();
|
178 |
+
|
179 |
+
//If the root directory is a filter then we will only need the root files
|
180 |
+
if (in_array($this->PackDir, $this->FilterDirsAll))
|
181 |
+
{
|
182 |
+
$this->Dirs[] = $this->PackDir;
|
183 |
+
}
|
184 |
+
else
|
185 |
+
{
|
186 |
+
$this->Dirs = $this->dirsToArray($rootPath, $this->FilterDirsAll);
|
187 |
+
$this->Dirs[] = $this->PackDir;
|
188 |
+
}
|
189 |
+
|
190 |
+
//Filter Directories
|
191 |
+
//Invalid test contains checks for: characters over 250, invlaid characters,
|
192 |
+
//empty string and directories ending with period (Windows incompatable)
|
193 |
+
foreach ($this->Dirs as $key => $val)
|
194 |
+
{
|
195 |
+
//WARNING: Find OS items that may have issues
|
196 |
+
// was commented out in pro
|
197 |
+
$name = basename($val);
|
198 |
+
|
199 |
+
$warn_test = strlen($val) > 250
|
200 |
+
|| preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name)
|
201 |
+
|| trim($name) == ""
|
202 |
+
|| (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.')
|
203 |
+
|| preg_match('/[^\x20-\x7f]/', $name);
|
204 |
+
if ($warn_test)
|
205 |
+
{
|
206 |
+
$this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
|
207 |
+
}
|
208 |
+
|
209 |
+
//UNREADABLE: Directory is unreadable flag it
|
210 |
+
if (! is_readable($this->Dirs[$key]))
|
211 |
+
{
|
212 |
+
unset($this->Dirs[$key]);
|
213 |
+
$this->FilterInfo->Dirs->Unreadable[] = $val;
|
214 |
+
$this->FilterDirsAll[] = $val;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
//Get all files and filter out error prone subsets
|
220 |
+
private function getFiles()
|
221 |
+
{
|
222 |
+
foreach ($this->Dirs as $key => $val)
|
223 |
+
{
|
224 |
+
$files = DUP_Util::ListFiles($val);
|
225 |
+
foreach ($files as $filePath)
|
226 |
+
{
|
227 |
+
$fileName = basename($filePath);
|
228 |
+
if (!is_dir($filePath))
|
229 |
+
{
|
230 |
+
if (!in_array(@pathinfo($filePath, PATHINFO_EXTENSION), $this->FilterExtsAll))
|
231 |
+
{
|
232 |
+
//Unreadable
|
233 |
+
if (!is_readable($filePath))
|
234 |
+
{
|
235 |
+
$this->FilterInfo->Files->Unreadable[] = $filePath;
|
236 |
+
continue;
|
237 |
+
}
|
238 |
+
|
239 |
+
$fileSize = @filesize($filePath);
|
240 |
+
$fileSize = empty($fileSize) ? 0 : $fileSize;
|
241 |
+
$invalid_test = strlen($filePath) > 250 ||
|
242 |
+
preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $fileName) ||
|
243 |
+
trim($fileName) == "";
|
244 |
+
|
245 |
+
if ($invalid_test || preg_match('/[^\x20-\x7f]/', $fileName))
|
246 |
+
{
|
247 |
+
$filePath = DUP_Encoding::toUTF8($filePath);
|
248 |
+
$this->FilterInfo->Files->Warning[] = $filePath;
|
249 |
+
}
|
250 |
+
$this->Size += $fileSize;
|
251 |
+
$this->Files[] = $filePath;
|
252 |
+
|
253 |
+
|
254 |
+
if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE)
|
255 |
+
{
|
256 |
+
$this->FilterInfo->Files->Size[] = $filePath . ' [' . DUP_Util::ByteSize($fileSize) . ']';
|
257 |
+
}
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
//Recursive function to get all Directories in a wp install
|
265 |
+
//Older PHP logic which is more stable on older version of PHP
|
266 |
+
//NOTE RecursiveIteratorIterator is problematic on some systems issues include:
|
267 |
+
// - error 'too many files open' for recursion
|
268 |
+
// - $file->getExtension() is not reliable as it silently fails at least in php 5.2.9
|
269 |
+
// - issues with when a file has a permission such as 705 and trying to get info (had to fallback to pathinfo)
|
270 |
+
// - basic conclusion wait on the SPL libs untill after php 5.4 is a requiremnt
|
271 |
+
// - since we are in a tight recursive loop lets remove the utiltiy call DUP_Util::SafePath("{$path}/{$file}") and
|
272 |
+
// squeeze out as much performance as we possible can
|
273 |
+
|
274 |
+
private function dirsToArray($path, $filterDirsAll)
|
275 |
+
{
|
276 |
+
$items = array();
|
277 |
+
$handle = @opendir($path);
|
278 |
+
if ($handle)
|
279 |
+
{
|
280 |
+
while (($file = readdir($handle)) !== false)
|
281 |
+
{
|
282 |
+
if ($file != '.' && $file != '..')
|
283 |
+
{
|
284 |
+
$fullPath = str_replace("\\", '/', "{$path}/{$file}");
|
285 |
+
|
286 |
+
if (is_dir($fullPath))
|
287 |
+
{
|
288 |
+
$addDir = true;
|
289 |
+
|
290 |
+
//Remove path filter directories
|
291 |
+
foreach ($filterDirsAll as $filterDir)
|
292 |
+
{
|
293 |
+
$trimmedFilterDir = rtrim($filterDir, '/');
|
294 |
+
|
295 |
+
if ($fullPath == $trimmedFilterDir || strstr($fullPath, $trimmedFilterDir . '/'))
|
296 |
+
{
|
297 |
+
$addDir = false;
|
298 |
+
break;
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
if($addDir)
|
303 |
+
{
|
304 |
+
$items = array_merge($items, $this->dirsToArray($fullPath, $filterDirsAll));
|
305 |
+
$items[] = $fullPath;
|
306 |
+
}
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
closedir($handle);
|
311 |
+
}
|
312 |
+
|
313 |
+
return $items;
|
314 |
+
}
|
315 |
+
}
|
316 |
?>
|
classes/package.php
CHANGED
@@ -140,7 +140,10 @@ class DUP_Package {
|
|
140 |
$db['Status']['Rows'],
|
141 |
$db['Status']['Case']);
|
142 |
|
143 |
-
|
|
|
|
|
|
|
144 |
|
145 |
$report['RPT']['Warnings'] = $warn_counts['Warn'];
|
146 |
$report['RPT']['Success'] = $warn_counts['Good'];
|
140 |
$db['Status']['Rows'],
|
141 |
$db['Status']['Case']);
|
142 |
|
143 |
+
//array_count_values will throw a warning message if it has null values,
|
144 |
+
//so lets replace all nulls with empty string
|
145 |
+
$warnings_safe = array_replace($warnings, array_fill_keys(array_keys($warnings, null),''));
|
146 |
+
$warn_counts = is_array($warnings_safe) ? array_count_values($warnings_safe) : 0;
|
147 |
|
148 |
$report['RPT']['Warnings'] = $warn_counts['Warn'];
|
149 |
$report['RPT']['Success'] = $warn_counts['Good'];
|
define.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
//Prevent directly browsing to the file
|
3 |
if (function_exists('plugin_dir_url'))
|
4 |
{
|
5 |
-
define('DUPLICATOR_VERSION', '1.1.
|
6 |
define('DUPLICATOR_HOMEPAGE', 'http://lifeinthegrid.com/labs/duplicator');
|
7 |
define('DUPLICATOR_GIVELINK', 'http://lifeinthegrid.com/partner');
|
8 |
define('DUPLICATOR_HELPLINK', 'http://lifeinthegrid.com/duplicator-docs');
|
2 |
//Prevent directly browsing to the file
|
3 |
if (function_exists('plugin_dir_url'))
|
4 |
{
|
5 |
+
define('DUPLICATOR_VERSION', '1.1.22');
|
6 |
define('DUPLICATOR_HOMEPAGE', 'http://lifeinthegrid.com/labs/duplicator');
|
7 |
define('DUPLICATOR_GIVELINK', 'http://lifeinthegrid.com/partner');
|
8 |
define('DUPLICATOR_HELPLINK', 'http://lifeinthegrid.com/duplicator-docs');
|
duplicator.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Duplicator
|
4 |
Plugin URI: http://www.lifeinthegrid.com/duplicator/
|
5 |
Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
|
6 |
-
Version: 1.1.
|
7 |
Author: LifeInTheGrid
|
8 |
Author URI: http://www.lifeinthegrid.com
|
9 |
Text Domain: duplicator
|
@@ -57,15 +57,17 @@ if (is_admin() == true) {
|
|
57 |
$table_name = $wpdb->prefix . "duplicator_packages";
|
58 |
|
59 |
//PRIMARY KEY must have 2 spaces before for dbDelta to work
|
|
|
60 |
$sql = "CREATE TABLE `{$table_name}` (
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
require_once(DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php');
|
71 |
@dbDelta($sql);
|
3 |
Plugin Name: Duplicator
|
4 |
Plugin URI: http://www.lifeinthegrid.com/duplicator/
|
5 |
Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
|
6 |
+
Version: 1.1.22
|
7 |
Author: LifeInTheGrid
|
8 |
Author URI: http://www.lifeinthegrid.com
|
9 |
Text Domain: duplicator
|
57 |
$table_name = $wpdb->prefix . "duplicator_packages";
|
58 |
|
59 |
//PRIMARY KEY must have 2 spaces before for dbDelta to work
|
60 |
+
//see: https://codex.wordpress.org/Creating_Tables_with_Plugins
|
61 |
$sql = "CREATE TABLE `{$table_name}` (
|
62 |
+
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
63 |
+
name VARCHAR(250) NOT NULL,
|
64 |
+
hash VARCHAR(50) NOT NULL,
|
65 |
+
status INT(11) NOT NULL,
|
66 |
+
created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
67 |
+
owner VARCHAR(60) NOT NULL,
|
68 |
+
package MEDIUMBLOB NOT NULL,
|
69 |
+
PRIMARY KEY (id),
|
70 |
+
KEY hash (hash))";
|
71 |
|
72 |
require_once(DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php');
|
73 |
@dbDelta($sql);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: www.lifeinthegrid.com/partner
|
|
4 |
Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2
|
9 |
|
10 |
Duplicate, clone, backup, move and transfer an entire site from one location to another.
|
@@ -112,7 +112,7 @@ No. Hopefully in future versions we will support MU
|
|
112 |
== Changelog ==
|
113 |
|
114 |
Please see the following url:
|
115 |
-
|
116 |
|
117 |
|
118 |
|
4 |
Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 1.1.22
|
8 |
License: GPLv2
|
9 |
|
10 |
Duplicate, clone, backup, move and transfer an entire site from one location to another.
|
112 |
== Changelog ==
|
113 |
|
114 |
Please see the following url:
|
115 |
+
https://snapcreek.com/duplicator/docs/changelog?lite
|
116 |
|
117 |
|
118 |
|