File tree Expand file tree Collapse file tree 3 files changed +25
-13
lines changed Expand file tree Collapse file tree 3 files changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ function gvs_main()
57
57
->saveLogToState ();
58
58
59
59
// add a notice of success
60
- $ gvs ->setNotice ('Plugin succesfully replaced. ' , 'success ' );
60
+ $ gvs ->setNotice ('Plugin ' . $ gvs -> plugin_version_short_name . ' successfully replaced. ' , 'success ' );
61
61
62
62
// do redirect
63
63
wp_redirect (get_admin_url () . '?page=gvs_page ' );
@@ -69,7 +69,7 @@ function gvs_main()
69
69
$ gvs ->saveLogToState ();
70
70
71
71
// add a notice of error
72
- $ gvs ->setNotice ('Error occurred: ' . $ e ->getMessage (), 'error ' );
72
+ $ gvs ->setNotice ('Error occurred during installation of ' . $ gvs -> plugin_version_short_name . ' : ' . $ e ->getMessage (), 'error ' );
73
73
74
74
// do redirect
75
75
wp_redirect (get_admin_url () . '?page=gvs_page ' );
Original file line number Diff line number Diff line change 1
1
<?php
2
- function gvs_log ($ msg )
3
- {
4
- error_log ('AVS_DEBUG: ' . var_export ($ msg ,true ));
5
- if (GVS_DEBUG_DISPLAY ) {
6
- if (is_string ($ msg )) {
7
- echo $ msg . "\n" ;
8
- } else {
9
- echo var_export ($ msg ) . "\n" ;
10
- }
11
- }
12
- }
13
2
14
3
function gvs_delete_folder_recursive ($ path )
15
4
{
@@ -82,3 +71,19 @@ function gvs_prepare_filesystem()
82
71
83
72
return true ;
84
73
}
74
+
75
+ function gvs_get_plugin_version_short_name ($ url )
76
+ {
77
+ $ regex_github = '/download\/([a-z,0-9].*)\/ ' . $ this ->process_plugin ->plugin_slug . '/ ' ;
78
+ preg_match_all ('/plugin\/([a-z,0-9].*\.zip)/ ' , $ url ,$ matches_wp );
79
+ preg_match_all ($ regex_github , $ url ,$ matches_github );
80
+
81
+ if (isset ($ matches_wp [1 ],$ matches_wp [1 ][0 ])) {
82
+ $ short = $ matches_wp [1 ][0 ];
83
+ }
84
+ if (isset ($ matches_github [1 ],$ matches_github [1 ][0 ])) {
85
+ $ short = $ this ->process_plugin ->inner_name . '- ' . $ matches_github [1 ][0 ];
86
+ }
87
+
88
+ return !empty ($ short ) ? $ short : $ this ->process_plugin ->inner_name ;
89
+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ class GVS
22
22
*/
23
23
private $ state_file = GVS_PLUGIN_DIR . '\files\state.gvs ' ;
24
24
25
+ /**
26
+ * @var
27
+ */
28
+ public $ plugin_version_short_name ;
29
+
25
30
public function __construct ()
26
31
{
27
32
$ this ->plugins_data ['apbct ' ] = new GVSPluginDataDTO (
@@ -190,6 +195,8 @@ public function downloadPluginZip($url)
190
195
throw new \Exception ('This URL is not allowed: ' . $ url );
191
196
}
192
197
198
+ $ this ->plugin_version_short_name = gvs_get_plugin_version_short_name ($ url );
199
+
193
200
$ this ->writeStreamLog ("Downloading content of $ url to $ output_path ... " );
194
201
195
202
if ( !is_dir ($ output_path ) ) {
You can’t perform that action at this time.
0 commit comments