Replace Auth System #3
@@ -30,9 +30,9 @@ class AutoStats extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->forceDelete();
|
PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->delete();
|
||||||
PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->forceDelete();
|
PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->delete();
|
||||||
PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->forceDelete();
|
PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->delete();
|
||||||
|
|
||||||
$this->comment('Automated Purge Stats Complete');
|
$this->comment('Automated Purge Stats Complete');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ class ResetUserDownloads extends Command
|
|||||||
|
|
||||||
// Clear old downloads which have expired
|
// Clear old downloads which have expired
|
||||||
UserDownload::where('created_at', '<=', Carbon::now()->subHour(6))
|
UserDownload::where('created_at', '<=', Carbon::now()->subHour(6))
|
||||||
->forceDelete();
|
->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AlertController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function delete(int $alert_id): \Illuminate\Http\RedirectResponse
|
public function delete(int $alert_id): \Illuminate\Http\RedirectResponse
|
||||||
{
|
{
|
||||||
Alert::where('id', $alert_id)->forceDelete();
|
Alert::where('id', $alert_id)->delete();
|
||||||
|
|
||||||
cache()->forget('alerts');
|
cache()->forget('alerts');
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class SiteBackgroundController extends Controller
|
|||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
$bg = SiteBackground::where('id', $id)->firstOrFail();
|
$bg = SiteBackground::where('id', $id)->firstOrFail();
|
||||||
$bg->forceDelete();
|
$bg->delete();
|
||||||
|
|
||||||
$resolutions = [1440, 1080, 720, 640];
|
$resolutions = [1440, 1080, 720, 640];
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SubtitleController extends Controller
|
|||||||
|
|
||||||
// Clear everything
|
// Clear everything
|
||||||
foreach($episode->subtitles as $sub) {
|
foreach($episode->subtitles as $sub) {
|
||||||
$sub->forceDelete();
|
$sub->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $request->input('subtitles')) {
|
if (! $request->input('subtitles')) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class NotificationController extends Controller
|
|||||||
->where('id', $request->input('id'))
|
->where('id', $request->input('id'))
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
$notification->forceDelete();
|
$notification->delete();
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,13 +105,11 @@ class PlaylistController extends Controller
|
|||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
$playlist = Playlist::where('user_id', $user->id)->where('id', $playlist_id)->firstOrFail();
|
$playlist = Playlist::where('user_id', $user->id)
|
||||||
|
->where('id', $playlist_id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
// Delete Playlist Episodes
|
$playlist->delete();
|
||||||
PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete();
|
|
||||||
|
|
||||||
// Delete Playlist
|
|
||||||
$playlist->forceDelete();
|
|
||||||
|
|
||||||
return to_route('profile.playlists');
|
return to_route('profile.playlists');
|
||||||
}
|
}
|
||||||
@@ -128,8 +126,14 @@ class PlaylistController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$playlist = Playlist::where('user_id', $request->user()->id)->where('id', (int) $request->input('playlist'))->firstOrFail();
|
$playlist = Playlist::where('user_id', $request->user()->id)
|
||||||
PlaylistEpisode::where('playlist_id', $playlist->id)->where('episode_id', (int) $request->input('episode'))->forceDelete();
|
->where('id', (int) $request->input('playlist'))
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
PlaylistEpisode::where('playlist_id', $playlist->id)
|
||||||
|
->where('episode_id', (int) $request->input('episode'))
|
||||||
|
->delete();
|
||||||
|
|
||||||
$this->playlistService->reorderPositions($playlist);
|
$this->playlistService->reorderPositions($playlist);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
@@ -152,13 +152,6 @@ class ProfileController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Playlist
|
|
||||||
$playlists = Playlist::where('user_id', $user->id)->get();
|
|
||||||
foreach($playlists as $playlist) {
|
|
||||||
PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete();
|
|
||||||
$playlist->forceDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update comments to deleted user
|
// Update comments to deleted user
|
||||||
DB::table('comments')->where('commenter_id', '=', $user->id)->update(['commenter_id' => 1]);
|
DB::table('comments')->where('commenter_id', '=', $user->id)->update(['commenter_id' => 1]);
|
||||||
|
|
||||||
@@ -169,7 +162,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
|
||||||
$user->forceDelete();
|
$user->delete();
|
||||||
|
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use Livewire\Component;
|
|||||||
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
|
|
||||||
class DownloadsFree extends Component
|
class DownloadsFree extends Component
|
||||||
{
|
{
|
||||||
@@ -51,7 +50,7 @@ class DownloadsFree extends Component
|
|||||||
// Check timestamp
|
// Check timestamp
|
||||||
if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) {
|
if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) {
|
||||||
// Already expired
|
// Already expired
|
||||||
$alreadyDownloaded->forceDelete();
|
$alreadyDownloaded->delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
if ($this->discord_id && $this->discord_avatar && !$this->avatar)
|
if ($this->discord_id && $this->discord_avatar && !$this->avatar)
|
||||||
{
|
{
|
||||||
return $this->discord_avatar;
|
return "https://external-content.duckduckgo.com/iu/?u={$this->discord_avatar}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->avatar)
|
if ($this->avatar)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CommentService
|
|||||||
if (Config::get('comments.soft_deletes') == true) {
|
if (Config::get('comments.soft_deletes') == true) {
|
||||||
$comment->delete();
|
$comment->delete();
|
||||||
} else {
|
} else {
|
||||||
$comment->forceDelete();
|
$comment->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class GalleryService
|
|||||||
foreach ($oldGallery as $oldImage) {
|
foreach ($oldGallery as $oldImage) {
|
||||||
Storage::disk('public')->delete($oldImage->image_url);
|
Storage::disk('public')->delete($oldImage->image_url);
|
||||||
Storage::disk('public')->delete($oldImage->thumbnail_url);
|
Storage::disk('public')->delete($oldImage->thumbnail_url);
|
||||||
$oldImage->forceDelete();
|
$oldImage->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
# Delete entries with "#" as URL
|
# Delete entries with "#" as URL
|
||||||
Downloads::where('url', '#')->forceDelete();
|
Downloads::where('url', '#')->delete();
|
||||||
|
|
||||||
# Remove duplicate entries
|
# Remove duplicate entries
|
||||||
$duplicates = DB::table('downloads')
|
$duplicates = DB::table('downloads')
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ return new class extends Migration
|
|||||||
->where('playlist_id', '=', $playlist->id)
|
->where('playlist_id', '=', $playlist->id)
|
||||||
->delete();
|
->delete();
|
||||||
|
|
||||||
$playlist->forceDelete();
|
$playlist->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user