This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wordmove-exclude
executable file
·73 lines (62 loc) · 1.84 KB
/
wordmove-exclude
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/php
<?php
if ($argc == 1 || $argc > 3 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
?>
wordmove-exclude V 1.0
Adds in Movefile in the the parameter exclude all themes or all plugins.
Parameter:
-t - themes
-p - plugins
Made by Mte90 - http://www.mte90.net
With the --help, -help, -h, or -? options, you can get this help.
<?php
} else {
if(file_exists('Movefile')) {
//Read the movefile
$movefile = yaml_parse(file_get_contents('Movefile'));
$exclude1 = array();
$exclude2 = array();
if($argv[1] == '-t' || $argv[2] == '-t') {
echo 'Loading the themes...'."\n";
if ($handle = opendir('wp-content/themes')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.php") {
if(is_dir('wp-content/themes/'.$file)) {
$exclude1[] = 'wp-content/themes/'.$file.'/';
}else {
$exclude1[] = 'wp-content/themes/'.$file;
}
}
}
closedir($handle);
}
}
if($argv[1] == '-p' || $argv[2] == '-p') {
echo 'Loading the plugins...'."\n";
if ($handle = opendir('wp-content/plugins')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.php") {
if(is_dir('wp-content/plugins/'.$file)) {
$exclude2[] = 'wp-content/plugins/'.$file.'/';
}else {
$exclude2[] = 'wp-content/plugins/'.$file;
}
}
}
closedir($handle);
}
}
$exclude = array_merge($exclude1,$exclude2);
$exclude[] = 'node_modules/*';
foreach ($movefile as $key => $enviroment) {
if($key != 'local') {
//Insert value
$movefile[$key]['exclude'] = array_merge($movefile[$key]['exclude'],$exclude);
}
}
$yaml = yaml_emit($movefile);
echo 'Save the Movefile...'."\n";
file_put_contents('Movefile',$yaml);
}
}
?>