Ajax
2 days ago
BackgroundProcessing
2 days ago
Dto
2 days ago
Entity
2 days ago
Exceptions
2 days ago
FileHeader
2 days ago
Interfaces
2 days ago
Job
2 days ago
Request
2 days ago
Service
2 days ago
Storage
2 days ago
Task
2 days ago
Traits
2 days ago
Utils
2 days ago
AfterRestore.php
2 days ago
BackupDeleter.php
2 days ago
BackupDownload.php
2 days ago
BackupFileIndex.php
2 days ago
BackupGlitchReason.php
2 days ago
BackupHeader.php
2 days ago
BackupNextOffer.php
2 days ago
BackupRepairer.php
2 days ago
BackupRetentionHandler.php
2 days ago
BackupScheduler.php
2 days ago
BackupServiceProvider.php
2 days ago
BackupValidator.php
2 days ago
BeforeUpdateRowStatus.php
2 days ago
FileHeader.php
2 days ago
FileHeaderAttribute.php
2 days ago
UpdateProtectionPausedNotice.php
2 days ago
WithBackupIdentifier.php
2 days 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 | |
| 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"; |
| 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 |