PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / trunk
WP STAGING – WordPress Backup, Restore, Migration & Clone vtrunk
4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backup / BackupDownload.php
wp-staging / Backup Last commit date
Ajax 1 month ago BackgroundProcessing 1 year ago Dto 1 week ago Entity 1 week ago Exceptions 1 year ago FileHeader 1 month ago Interfaces 6 months ago Job 1 month ago Request 1 year ago Service 1 week ago Storage 1 month ago Task 1 week ago Traits 10 months ago Utils 3 months ago AfterRestore.php 5 months ago BackupDeleter.php 2 months ago BackupDownload.php 8 months ago BackupFileIndex.php 1 year ago BackupGlitchReason.php 1 year ago BackupHeader.php 1 month ago BackupRepairer.php 6 months ago BackupRetentionHandler.php 1 month ago BackupScheduler.php 1 week ago BackupServiceProvider.php 1 month ago BackupValidator.php 6 months ago FileHeader.php 1 week ago FileHeaderAttribute.php 2 years ago WithBackupIdentifier.php 1 year ago
BackupDownload.php
32 lines
1 <?php
2
3 namespace WPStaging\Backup;
4
5 use WPStaging\Core\WPStaging;
6 use WPStaging\Framework\Adapter\Directory;
7
8 class BackupDownload
9 {
10 /**
11 * @return void
12 */
13 public function deleteUnfinishedDownloads()
14 {
15 $dir = WPStaging::make(Directory::class)->getDownloadsDirectory();
16 if (!is_dir($dir)) {
17 return;
18 }
19
20 $extension = ".wpstg"; // Extension of the file created when download starts.
21 if ($dh = opendir($dir)) {
22 while (($file = readdir($dh)) !== false) {
23 if (strpos($file, $extension) !== false) {
24 unlink($dir . '/' . $file);
25 }
26 }
27
28 closedir($dh);
29 }
30 }
31 }
32