use Cubist\Util\ArrayUtil;
use Cubist\Util\ObjectUtil;
use Cubist\Util\PHP;
+use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
class WorkshopMigration extends CubistCommand
{
- protected $signature = 'ws:migrate {--publications=v2} {--documents=missing}';
+ protected $signature = 'ws:migrate {--publications=v2} {--documents=missing} {--quick}';
protected $description = 'Migrate data from Workshop V2';
protected $_wsRanks = [];
protected $_oldDB = 'extranet_clean';
'Clean caches' => 'cleanCache'
];
+ if ($this->option('quick')) {
+ $actions = ['Import publications' => 'importPublications'];
+ }
+
$this->progressBar = $this->output->createProgressBar(count($actions));
$this->line(' Data migration, please wait');
protected function migrate()
{
- $this->executeProcessQuiet('php artisan cubist:magic:generate');
- $this->executeProcessQuiet('php artisan cubist:magic:migrate');
+ Artisan::call('cubist:magic:generate');
+ Artisan::call('cubist:magic:migrate');
}
protected function backup()
{
- $this->executeProcessQuiet('php artisan backup:run');
+ Artisan::call('backup:run');
}
protected function cleanCache()
{
- $this->executeProcessQuiet('php artisan optimize:clear');
+ Artisan::call('optimize:clear');
}
protected function importDocuments()
$anchorExists[$linkData['to']] = $linkData;
}
if ($linkData['type'] == 35 || $linkData['type'] == 15 || $linkData['type'] == 39) {
- $linkData = Links::decryptLink($linkData);
+ $linkData = Link::decryptLink($linkData);
$animations = ContentLink::parseAnimations($linkData['image_rollover']);
foreach ($animations as $animation) {
if (isset($animation['backgroundcolor']) && $animation['backgroundcolor'] !== 'transparent') {
use Cubist\Util\Graphics\Image;
use Cubist\Util\Json;
use Datetime;
+use Illuminate\Support\Facades\Artisan;
// __('!!Paramètres des fluidbooks')
class FluidbookPublication extends ToolboxSettingsModel
protected function _baseReplicate(array $except = null)
{
- $new = parent::replicate($except);
+ $current = $this;
+ if ($this->syncFromWorkshop()) {
+ $current = static::find($this->id);
+ }
+ $new = $current->replicate($except);
if (backpack_user()) {
$new->owner = backpack_user()->id;
}
return $new;
}
- public function replicate(array $except = null)
+ public function replicateFull(array $except = null)
{
$new = $this->_baseReplicate($except);
$new->save();
return $new;
}
+ public function syncFromWorkshop()
+ {
+ if ($this->id >= WorkshopMigration::WS3_BOOK_ID) {
+ return false;
+ }
+ Artisan::call('ws:migrate --publications=' . $this->id . ' --documents=missing --quick');
+ return true;
+ }
+
protected function _replicateMedia($newId)
{