if (!file_exists($lock) || filemtime($lock) < time() - 3600) {
touch($lock);
- $url = 'https://workshop.fluidbook.com/viewerh/' . $id . '_' . $fluidbook->hash . '_' . time() . '/?nointerface=1';
+ $url = 'https://toolbox.fluidbook.com/fluidbook-publication/preview/' . $id . '_' . $fluidbook->hash . '_' . time() . '/?nointerface=1';
if ((file_exists($res) && filemtime($res) < $limit) || isset($_GET['forcecompile'])) {
$url .= '&force=1';
}
$cl->setArg('dest', $res);
$cl->setArg('url', $url);
$cl->execute();
+ $cl->debug();
unlink($lock);
}
}
--- /dev/null
+<?php
+
+namespace App\Jobs\Maintenance;
+
+use App\Jobs\Base;
+use App\Models\FluidbookPublication;
+use App\Models\Traits\CheckHash;
+
+class CheckPublicationsHashAndCid extends Base
+{
+ public function handle()
+ {
+ /** @var FluidbookPublication $fluidbook */
+ foreach (FluidbookPublication::withoutGlobalScopes()->whereNull('hash')->orWhere('hash', '')->orWhereNull('cid')->orWhere('cid', '')->get() as $fluidbook) {
+ $fluidbook->save();
+ echo 'Process ' . $fluidbook->id . "\n";
+ }
+ }
+}
use Cubist\Util\Str;
use Datetime;
use Illuminate\Support\Facades\Artisan;
+use Illuminate\Support\Facades\Log;
// __('!!Paramètres des fluidbooks')
class FluidbookPublication extends ToolboxSettingsModel
protected function setComposedAttributes()
{
/** @var \App\Models\User $owner */
- $owner = \App\Models\User::find($this->owner);
+ $owner = \App\Models\User::withoutGlobalScopes()->find($this->owner);
if (null === $owner) {
$this->owner = 1;
$this->saveQuietly();
- $owner = \App\Models\User::find(1);
+ $owner = \App\Models\User::withoutGlobalScopes()->find(1);
}
/** @var Company $company */
- $company = Company::withoutGlobalScopes()->find($owner->company);
+ if (null !== $owner) {
+ $company = Company::withoutGlobalScopes()->find($owner->company);
- $this->admin = $company->admin;
- $this->super_admin = '';
- $this->owner_company_name = $company->company_with_name;
- $this->owner_name = $owner->name;
+ $this->admin = $company->admin;
+ $this->super_admin = '';
+ $this->owner_company_name = $company->company_with_name;
+ $this->owner_name = $owner->name;
+
+ } else {
+ Log::warning('Fluidbook ' . $this->id . ' has no owner : ' . $this->owner);
+ }
$this->invoicable = '';
$this->invoicable_company = '';
$this->extranet_project = '';
+
$this->c_title = $this->title;
$this->c_pages = count($this->composition);
}
executablePath: 'google-chrome-stable',
});
const page = await browser.newPage();
- page.on('console', msg => console.log('PAGE LOG:', msg._text));
+ page.on('console', msg => console.log('PAGE LOG:', msg));
await page.setViewport({
width: options.width / options.scale,
height: options.height / options.scale,