mirror of https://github.com/pixelfed/pixelfed
Update SettingsController, fix double json encoding and cache settings for 7 days
parent
ef0d1f84ae
commit
4514ab1dbe
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\UserSetting;
|
||||||
|
|
||||||
|
class FixDoubleJsonEncodedSettingsInUsersettingsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
UserSetting::whereNotNull('compose_settings')
|
||||||
|
->chunk(50, function($settings) {
|
||||||
|
foreach($settings as $userSetting) {
|
||||||
|
if(is_array($userSetting->compose_settings)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$userSetting->compose_settings = json_decode($userSetting->compose_settings);
|
||||||
|
$userSetting->save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue