public function handle()
{
- $user = AuthUser::where('id', self::$_admin)->first();
- backpack_auth()->login($user);
-
$actions = [
//'Backup current database' => 'backup',
'Migrate magic models' => 'migrate',
$this->line(' Data migration, please wait');
$this->progressBar->start();
-
foreach ($actions as $comment => $action) {
$this->line($comment);
$this->$action();
$q = DB::table($this->_oldDB . '.documents')->orderBy('document_id', 'desc');
if ($this->option('documents') === 'missing') {
- $maxID = FluidbookDocument::where('id', '<', self::WS3_DOC_ID)->orderBy('id', 'DESC')->first()->id;
+ $maxID = FluidbookDocument::withoutGlobalScopes()->where('id', '<', self::WS3_DOC_ID)->orderBy('id', 'DESC')->first()->id;
$q = DB::table($this->_oldDB . '.documents')->where('document_id', '>', $maxID)->orderBy('document_id', 'desc');
} else if ($this->option('documents') === 'v2') {
FluidbookDocument::truncate();
} else {
$range = ArrayUtil::parseRange($this->option('documents'));
- FluidbookDocument::whereIn('id', $range)->delete();
+ FluidbookDocument::withoutGlobalScopes()->whereIn('id', $range)->delete();
$q->whereIn('document_id', $range);
}
FluidbookPublication::truncate();
} else {
$range = ArrayUtil::parseRange($this->option('publications'));
- FluidbookPublication::whereIn('id', $range)->delete();
+ FluidbookPublication::withoutGlobalScopes()->whereIn('id', $range)->delete();
$q->whereIn('book_id', $range);
}
$l10n = FluidbookTranslate::getCompiledTranslations();
}
$res = $l10n[$defaultLocale];
+
if ($this->translations) {
+ if(is_string($this->translations)) {
+ if (Json::isJson($this->translations)) {
+ $this->translations = json_decode($this->translations);
+ }else{
+ $this->translations=[];
+ }
+ }
foreach ($this->translations as $k => $v) {
$res[$k] = $v;
}