w0bm.com v1.5z FULL.RETARD.BUILD.BUT.STILL.WORKS
This commit is contained in:
92
app/Console/Commands/AddTags.php
Normal file
92
app/Console/Commands/AddTags.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Video;
|
||||
use App\Models\User;
|
||||
use App\Models\Category;
|
||||
|
||||
|
||||
class AddTags extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'tags';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Adds category names as tags and changes filters from users.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// Videos
|
||||
echo 'UPDATING VIDEOS', PHP_EOL, '===============', PHP_EOL;
|
||||
$count = 0;
|
||||
Video::withTrashed()->with('category')->chunk(200, function($videos) use ($count) {
|
||||
foreach($videos as $v) {
|
||||
echo 'Updating Video with ID: ', $v->id, PHP_EOL;
|
||||
$v->detag();
|
||||
// quick and dirty. not 100% correct though.
|
||||
if($v->category->shortname === 'pr0n')
|
||||
$v->tag('nsfw');
|
||||
else
|
||||
$v->tag('sfw');
|
||||
|
||||
$v->tag(array_filter([$v->category->shortname
|
||||
, $v->category->name
|
||||
, $v->interpret
|
||||
, $v->songtitle
|
||||
, $v->imgsource
|
||||
], function($elem) {
|
||||
return !empty(trim($elem));
|
||||
}));
|
||||
$count++;
|
||||
}
|
||||
});
|
||||
echo PHP_EOL, PHP_EOL, 'Updated ', $count, ' Videos.', PHP_EOL, PHP_EOL, PHP_EOL;
|
||||
|
||||
|
||||
// User filters
|
||||
echo 'UPDATING USERS', PHP_EOL, '==============', PHP_EOL;
|
||||
$count = 0;
|
||||
$categories = Category::withTrashed()->get()->keyBy('id');
|
||||
|
||||
User::withTrashed()->chunk(200, function($users) use (&$count, $categories) {
|
||||
foreach($users as $u) {
|
||||
echo 'Updating User: ', $u->username, PHP_EOL;
|
||||
$u->categories = array_values($categories->filter(function($cat) use($u) {
|
||||
return !in_array($cat->id, $u->categories);
|
||||
})->map(function($cat) {
|
||||
return $cat->shortname;
|
||||
})->all());
|
||||
$u->save();
|
||||
$count++;
|
||||
}
|
||||
});
|
||||
|
||||
echo PHP_EOL, PHP_EOL, 'Updated ', $count, ' Users.', PHP_EOL, PHP_EOL, PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
33
app/Console/Commands/Inspire.php
Normal file
33
app/Console/Commands/Inspire.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
class Inspire extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'inspire';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
}
|
52
app/Console/Commands/ReadException.php
Normal file
52
app/Console/Commands/ReadException.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ReadException extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'exception {file=php://stdin}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Decrypts encrypted exception messages';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$input = $this->argument('file');
|
||||
$c = file_get_contents($input);
|
||||
if (false === $c) {
|
||||
$this->error('File not found');
|
||||
return;
|
||||
}
|
||||
//dd(explode(PHP_EOL, $c));
|
||||
list($iv, $c) = explode(PHP_EOL, $c);
|
||||
$iv = hex2bin($iv);
|
||||
$m = openssl_decrypt($c, 'aes128', env('APP_KEY'), 0, $iv);
|
||||
$this->line($m);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user