[wp-trac] [WordPress Trac] #31138: Backup of a plugin / theme directory.

WordPress Trac noreply at wordpress.org
Thu Jan 29 10:20:10 UTC 2015


#31138: Backup of a plugin / theme directory.
-----------------------------+------------------------------
 Reporter:  aercolino        |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Upgrade/Install  |     Version:  4.1
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------------------

Comment (by aercolino):

 Would it make sense to expose the temporary directory and backup
 functionalities into a reusable API like below?

 TEMPORARY DIRECTORY: This is where plugin / theme authors can store
 temporary files and directories. When a temporary directory expires, the
 garbage collector will delete it.

 * '''tmp_dir_create'''( $expiration, $primary_file )
  * ==> string $absolute_path | WP_Error $error
  * Create a temporary directory specifically for the plugin/theme defined
 by $primary_file.

 * '''tmp_dir_info'''( $absolute_path, $with_listing = false )
  * ==> array $tmp_info | WP_Error $error
  * Get info about the temporary directory at $absolute_path.
  * $tmp_info contains $primary_file, $absolute_path, $expiration time and
 a (recursively obtained) file listing, if requested.

 * '''tmp_dir_expire'''( $absolute_path )
  * ==> WP_Error $error
  * Allow the garbage collector to delete the temporary directory ASAP,
 together with its transient.

 TEMPORARY BACKUP: This is how plugin / theme authors can take advantage of
 the same temporary backup API internally used by WordPress 4.2. (This is a
 lie at the moment... my patch is not exactly like this :-)

 * '''tmp_backup_create'''( $expiration, $primary_file, $relative_path =
 './' )
  * ==> string $backup_name | WP_Error $error
  * Recursively backup anything inside $relative_path, relative to the
 directory of the $primary_file.
  * The location of this backup could be different from that of a temporary
 directory.

 * '''tmp_backup_info'''( $backup_name, $with_listing = false )
  * ==> array $backup_info | WP_Error $error
  * Get info about the backup whose name is $backup_name.
  * $backup_info contains primary file, relative_path, backup path,
 expiration time and a recursive file listing, if requested.

 * '''tmp_backup_expire'''( $backup_name )
  * ==> WP_Error $error
  * Allow the garbage collector to delete the backup ASAP, together with
 its transient.

 * '''tmp_backup_like'''( $backup_name )
  * ==> array $backups | WP_Error $error
  * Get the names of all the currently non-expired backups whose names
 share the same prefix of $backup_name.
  * Items sorted from older to newer.

 * '''tmp_backup_expire_like'''( $backup_name )
  * ==> WP_Error $error
  * Allow the garbage collector to delete all the currently non-expired
 backups whose names share the same prefix of $backup_name ASAP, together
 with their transients.

 * '''tmp_backup_all'''( $primary_file )
  * ==> array $all_names | WP_Error $error
  * Get the names of all the currently non-expired backups for
 $primary_file.
  * Items sorted from older to newer.

 * '''tmp_backup_expire_all'''( $primary_file )
  * ==> WP_Error $error
  * Allow the garbage collector to delete all the backups ASAP, together
 with their transients.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31138#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list