| 3 | | 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. |
| 4 | | |
| 5 | | * '''tmp_dir_create'''( $expiration, $primary_file ) |
| 6 | | * ==> string $absolute_path | WP_Error $error |
| 7 | | * Create a temporary directory specifically for the plugin/theme defined by $primary_file. |
| 8 | | |
| 9 | | * '''tmp_dir_info'''( $absolute_path, $with_listing = false ) |
| 10 | | * ==> array $tmp_info | WP_Error $error |
| 11 | | * Get info about the temporary directory at $absolute_path. |
| 12 | | * $tmp_info contains $primary_file, $absolute_path, $expiration time and a (recursively obtained) file listing, if requested. |
| 13 | | |
| 14 | | * '''tmp_dir_expire'''( $absolute_path ) |
| 15 | | * ==> WP_Error $error |
| 16 | | * Allow the garbage collector to delete the temporary directory ASAP, together with its transient. |
| 17 | | |
| 18 | | 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 :-) |
| 19 | | |
| 20 | | * '''tmp_backup_create'''( $expiration, $primary_file, $relative_path = './' ) |
| 21 | | * ==> string $backup_name | WP_Error $error |
| 22 | | * Recursively backup anything inside $relative_path, relative to the directory of the $primary_file. |
| 23 | | * The location of this backup could be different from that of a temporary directory. |
| 24 | | |
| 25 | | * '''tmp_backup_info'''( $backup_name, $with_listing = false ) |
| 26 | | * ==> array $backup_info | WP_Error $error |
| 27 | | * Get info about the backup whose name is $backup_name. |
| 28 | | * $backup_info contains primary file, relative_path, backup path, expiration time and a recursive file listing, if requested. |
| 29 | | |
| 30 | | * '''tmp_backup_expire'''( $backup_name ) |
| 31 | | * ==> WP_Error $error |
| 32 | | * Allow the garbage collector to delete the backup ASAP, together with its transient. |
| 33 | | |
| 34 | | * '''tmp_backup_find_like'''( $backup_name ) |
| 35 | | * ==> array $backups | WP_Error $error |
| 36 | | * Get the names of all the currently non-expired backups whose names share the same prefix of $backup_name. |
| 37 | | * Items sorted from older to newer. |
| 38 | | |
| 39 | | * '''tmp_backup_expire_like'''( $backup_name ) |
| 40 | | * ==> WP_Error $error |
| 41 | | * 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. |
| 42 | | |
| 43 | | * '''tmp_backup_find_all'''( $primary_file ) |
| 44 | | * ==> array $all_names | WP_Error $error |
| 45 | | * Get the names of all the currently non-expired backups for $primary_file. |
| 46 | | * Items sorted from older to newer. |
| 47 | | |
| 48 | | * '''tmp_backup_expire_all'''( $primary_file ) |
| 49 | | * ==> WP_Error $error |
| 50 | | * Allow the garbage collector to delete all the backups ASAP, together with their transients. |
| | 3 | [https://gist.github.com/aercolino/f7a184264540db1a84d0 example of WordPress tmp API] |