| @@ -44,10 +44,9 @@ | ||
| 44 | 44 | if( class_exists( 'WP_Upgrader' ) ){ |
| 45 | 45 | $upgrader = new WP_Upgrader(); |
| 46 | 46 | $key = eos_plugin_revision_key(); |
| 47 | 47 | if( $key ){ |
| 48 | - $zip_dirname = 'pr-'.$key.'-'.sanitize_option( 'upload_path',$version ).'-ver-'.dirname( $plugin ); | |
| 49 | - $destination = str_replace( dirname( $plugin ), $zip_dirname, sanitize_option( 'upload_path',plugin_dir_path( $path )) ); | |
| 48 | + $destination = str_replace( dirname( $plugin ),'pr-'.$key.'-'.sanitize_option( 'upload_path',$version ).'-ver-'.dirname( $plugin ),sanitize_option( 'upload_path',plugin_dir_path( $path )) ); | |
| 50 | 49 | if( !is_dir( $destination ) ){ |
| 51 | 50 | global $wp_filesystem; |
| 52 | 51 | if( empty( $wp_filesystem ) ){ |
| 53 | 52 | require_once ( ABSPATH .'/wp-admin/includes/file.php' ); |
| @@ -56,13 +55,8 @@ | ||
| 56 | 55 | $wp_filesystem->mkdir( $destination ); |
| 57 | 56 | } |
| 58 | 57 | if( !empty( $wp_filesystem ) && $wp_filesystem->is_dir( $destination ) ){ |
| 59 | 58 | $result = copy_dir( plugin_dir_path( $path ),$destination ); |
| 60 | - $zip_dirname .= '.zip'; | |
| 61 | - if( eos_pv_create_zip_pclzip( $destination, $zip_dirname ) ) { | |
| 62 | - // If zipped archive created delete the unzipped directory. | |
| 63 | - $wp_filesystem->delete( $destination, true ); | |
| 64 | - } | |
| 65 | 59 | eos_plugin_revisions_remove_versions( apply_filters( 'max_plugin_revisions',4 ),$plugin_name ); |
| 66 | 60 | } |
| 67 | 61 | } |
| 68 | 62 | } |
| @@ -74,9 +68,8 @@ | ||
| 74 | 68 | |
| 75 | 69 | add_filter( 'all_plugins',function( $plugins ){ |
| 76 | 70 | /** |
| 77 | 71 | * Remove plugin revisions from plugins table in the page wp-admin/plugins.php |
| 78 | - * Add link to restore previous unzipped versions for backward compatibility | |
| 79 | 72 | * |
| 80 | 73 | * @since 0.0.1 |
| 81 | 74 | */ |
| 82 | 75 | $key = eos_plugin_revision_key(); |
| @@ -287,36 +280,4 @@ | ||
| 287 | 280 | asort( $files ); |
| 288 | 281 | $files = array_keys( $files ); |
| 289 | 282 | return ( $files ) ? $files : false; |
| 290 | 283 | } |
| 291 | - | |
| 292 | -add_action( 'admin_init', 'eos_pv_restore_revision_links' ); | |
| 293 | -/** | |
| 294 | - * Add links to restore previous revisions from zipped plugins. | |
| 295 | - * | |
| 296 | - * @since 0.0.6 | |
| 297 | - */ | |
| 298 | -function eos_pv_restore_revision_links() { | |
| 299 | - $key = eos_plugin_revision_key(); | |
| 300 | - if( $key ){ | |
| 301 | - $all_plugin_files = scandir( WP_PLUGIN_DIR ); | |
| 302 | - if( $all_plugin_files && is_array( $all_plugin_files ) && ! empty( $all_plugin_files ) ) { | |
| 303 | - require_once PLUGIN_REVISIONS_PLUGIN_DIR . '/admin/classes/class-plugversions-restoring-link.php'; | |
| 304 | - foreach( $all_plugin_files as $plugin ) { | |
| 305 | - if( 'zip' === pathinfo( $plugin, PATHINFO_EXTENSION ) ) { | |
| 306 | - if( false !== strpos( $plugin, 'pr-' . $key .'-' ) && false !== strpos( $plugin, '-ver-' ) ) { | |
| 307 | - $arr = explode( 'ver-', $plugin ); | |
| 308 | - $arr = explode( '-', $arr[0] ); | |
| 309 | - if( 'pr' === $arr[0] && isset( $arr[1] ) && $key === $arr[1] && isset( $arr[2] ) ) { | |
| 310 | - $version = $arr[2]; | |
| 311 | - $plugin_name = str_replace( array( 'pr-' . $key . '-' . $version . '-ver-', '.zip' ), array( '', '' ), $plugin ); | |
| 312 | - if( is_dir( WP_PLUGIN_DIR . '/' . $plugin_name ) ) { | |
| 313 | - $link = new PlugVersions_Restoring_Link( $key, $version, $plugin, $plugin_name ); | |
| 314 | - } | |
| 315 | - } | |
| 316 | - } | |
| 317 | - } | |
| 318 | - } | |
| 319 | - } | |
| 320 | - } | |
| 321 | -} | |
| 322 | - | |