@@ -68,10 +68,12 @@ private function updateComposer() {
68
68
}
69
69
70
70
private function updateThemes () {
71
+ $ exclude = '--exclude= ' . $ this ->getComposerPlugins ();
72
+
71
73
if (WP_CLI ::runcommand ('theme list --update=available ' , [
72
74
'return ' => true ,
73
75
])) {
74
- return WP_CLI ::runcommand ('theme update --all ' , [
76
+ return WP_CLI ::runcommand ('theme update --all ' . $ exclude , [
75
77
'return ' => true ,
76
78
'exit_error ' => false ,
77
79
]);
@@ -82,10 +84,12 @@ private function updateThemes() {
82
84
}
83
85
84
86
private function updatePlugins () {
87
+ $ exclude = '--exclude= ' . $ this ->getComposerPlugins ();
88
+
85
89
if (WP_CLI ::runcommand ('plugin list --update=available ' , [
86
90
'return ' => true ,
87
91
])) {
88
- return WP_CLI ::runcommand ('plugin update --all ' , [
92
+ return WP_CLI ::runcommand ('plugin update --all ' . $ exclude , [
89
93
'return ' => true ,
90
94
'exit_error ' => false ,
91
95
]);
@@ -95,6 +99,22 @@ private function updatePlugins() {
95
99
}
96
100
}
97
101
102
+ public function getComposerPlugins (){
103
+ $ output = shell_exec ('composer show --format=json ' );
104
+
105
+ $ dependencies = json_decode ($ output , true );
106
+
107
+ $ dependencyNames = [];
108
+ if (isset ($ dependencies ['installed ' ])) {
109
+ foreach ($ dependencies ['installed ' ] as $ dependency ) {
110
+ $ parts = explode ('/ ' , $ dependency ['name ' ]);
111
+ $ dependencyNames [] = end ($ parts );
112
+ }
113
+ }
114
+
115
+ return implode (', ' , $ dependencyNames );
116
+ }
117
+
98
118
private function getPlugins () {
99
119
return WP_CLI ::runcommand ('plugin list --fields=name,status,update,version,title --format=json ' , [
100
120
'parse ' => 'json ' ,
0 commit comments