How to prepare (compress/zip) a plugin to enable updating instead of adding new instance?

This is the default behaviour for WordPress. But there is a plugin called “Easy theme and plugin upgrades” that handles this for plugin and template updates: https://de.wordpress.org/plugins/easy-theme-and-plugin-upgrades/ After installing the plugin, you can just upload a new zip and it wont’t install another plugin/theme instance. Instead, the plugin generates a backup of the older version … Read more

WordPress can’t use ZipArchive

I successfully created zip file in root folder of WordPress using following code: $files = array(__DIR__.’/test.jpg’, __DIR__.’/screenshot.png’); $zipname=”images.zip”; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE) or die(‘ cant open ‘); foreach ($files as $file) { if( $zip->addFile($file)){ echo “<br>$file Added To Zip Sucessfully”; }else { echo “<br>Can not add $file file”; } } $zip->close(); if(file_exists($zipname)){ echo … Read more

unzip_file not working with the remote file

As @Buttered_Toast and @Sébastien Serre mentioned I first need to save file to a local directory before unzipping. So here is my final code: $source=”http://downloads.wordpress.org/theme/ona-creative.1.0.0.zip”; $file = get_theme_root() . “https://wordpress.stackexchange.com/” . $slug . ‘.zip’; file_put_contents( $file, file_get_contents( $source )); $unzipfile = unzip_file( $file, get_theme_root() );

What should I pass for $needed_dirs when calling _unzip_file_pclzip (aka PclZip)?

@Scott B I have not tested this script, taken from inlcudes/file.php -> line 559 _unzip_file_pclzip assumes WP_Filesystem() has already been called, so you need to set up global $wp_filesystem global $wp_filesystem; $needed_dirs = array(); $target = trailingslashit($target); // Determine any parent dir’s needed (of the upgrade directory) if ( ! $wp_filesystem->is_dir($target) ) { //Only do … Read more

How can I fix my server so core/plugins/theme update don’t silently fail?

There is a bug in some versions of PHP itself, unzip hangs. PHP 5.2.17 hangs, PHP 5.3.24 works as expected. PHP Change Log http://www.php.net/ChangeLog-5.php#5.3.4 says PHP Version 5.3.4 released 09-Dec-2010 – “Fixed crash in zip extract method (possible CWE-170)”. (Note: 5.3.24 released 11-April-2013, and is no longer the latest version.) http://lcblog.lernerconsult.com/2013-php-unzip-bug-makes-wordpress-updates-hang/ has the PHP program … Read more

Can a manually uploaded plugin be made to track updates from the WordPress.org plugin directory?

As long as everything was made according to WP best practices all your manually installed versions will update the same as the ones installed from wordpress.org. The updater looks at many things to identify your plugin. However, the most important is the plugin URI (you can change the directory of many plugins and they will … Read more

How do you use unzip_file()?

require_once(ABSPATH .’/wp-admin/includes/file.php’); global $wp_filesystem; if ( ! $filesystem ) { WP_Filesystem(); if ( ! $wp_filesystem ) nuke_the_world_because_wpfs_cannot_be_initialized_in_case_of_missing_arguments(‘!’); } $result = unzip_file( $zip, $dest ); if ( is_wp_error( $result ) ) nuke_the_world(); Maybe some error handling make it easier.

techhipbettruvabetnorabahisbahis forumutaraftarium24eduedueduseduseduseduedueduedusedu