php8.1-intl \
php8.1-memcached \
php8.1-mysql \
+ php8.1-sqlite \
php8.1-redis \
php8.1-soap \
php8.1-ssh2 \
$doc = FluidbookDocument::find($this->argument('id'));
$doc->clearAllFiles();
$user = User::withoutGlobalScope('ownerclause')->where('id', $doc->owner)->first();
- FluidbookDocumentUpload::dispatchSync(Str::random(), $doc, $user);
+ $job = new FluidbookDocumentUpload(Str::random(), $doc, $user);
+ $job->handle(true);
}
}
{
protected static $_farmServers = [
['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 24],
- ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6],
+ //['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6],
['name' => 'clockwork', 'host' => 'clockwork.cubedesigners.com', 'weight' => 2],
['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 3],
['name' => 'elephantman', 'host' => 'elephantman.cubedesigners.com', 'weight' => 1],
['name' => 'her', 'host' => 'her2.cubedesigners.com', 'weight' => 4],
['name' => 'isleofdogs', 'host' => 'paris.cubedesigners.com', 'port' => 9458, 'weight' => 2],
['name' => 'jumanji', 'host' => 'paris.cubedesigners.com', 'port' => 9459, 'weight' => 2],
- ['name' => 'kingkong', 'host' => 'kingkong.cubedesigners.com', 'weight' => 2],
+ //['name' => 'kingkong', 'host' => 'kingkong.cubedesigners.com', 'weight' => 2],
];
protected static function _pingCache()
$start = microtime(true);
$farmer = self::pickOneServer();
+ $path = str_replace('/protected/fluidbookpublication/docs/', '/fluidbook/docs/', $path);
+
$params = ['page' => $page, 'format' => $format, 'resolution' => $resolution, 'withText' => $withText, 'withGraphics' => $withGraphics, 'version' => $version, 'force' => $force, 'out' => $path, 'resolutionRatio' => $resolutionRatio, 'mobileRatio' => $mobileFirstRatio];
$output = self::sendRequest($farmer, 'process.php', $params);
- if (preg_match('|/data1/extranet/www/[^\s]+|', $output, $matches)) {
- $o = $matches[0];
+
+ if (preg_match('|^/application/fluidbook/docs/[^\s]+$|', $output, $matches)) {
+ $o = str_replace('/fluidbook/docs/', '/protected/fluidbookpublication/docs/', $matches[0]);
} else {
$o = $output;
}
}
$time = round(microtime(true) - $start, 4);
- $log = '[' . $farmer['name'] . ']' . "\t" . date('Y-m-d H:i:s') . "\t" . $time . "\t$page|$format|$resolution|$withText|$withGraphics|$version\t$res\t" . $output . "\n";
+ $log = '[' . $farmer['name'] . ']' . "\t" . date('Y-m-d H:i:s') . "\t" . $time . "\t$page|$format|$resolution|$withText|$withGraphics|$version\t($res)\t>>" . $output . "\n";
error_log($log);
- return str_replace('/fluidbook/docs/', '/protected/fluidbookpublication/docs/', $res);
+ return $res;
}
public static function ping($echo = true, $force = false)
--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+class FluidbookExternalInstallServerCrudController extends \Cubist\Backpack\Magic\Controllers\CubistMagicController
+{
+ use \Cubist\Backpack\Magic\Operations\CreateOperation;
+ use \Cubist\Backpack\Http\Controllers\Operations\CloneEditOperation;
+ use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
+ use \Cubist\Backpack\Http\Controllers\Operations\BulkPublishOperation;
+ use \Backpack\CRUD\app\Http\Controllers\Operations\CloneOperation;
+ use \Backpack\CRUD\app\Http\Controllers\Operations\BulkCloneOperation;
+ use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
+ use \Backpack\CRUD\app\Http\Controllers\Operations\BulkDeleteOperation;
+ use \Cubist\Backpack\Http\Controllers\Operations\ReviseOperation;
+
+
+
+ /*
+ __('serveur')
+ __('serveurs')
+ */
+
+ protected $_modelNamespace = 'App\Models\FluidbookExternalInstallServer';
+ protected $_routeURL = 'fluidbook-external-install-server';
+ protected $_singular = 'serveur';
+ protected $_plural = 'serveurs';
+ protected $_oneInstance= false;
+}
$document->owner = backpack_user()->id;
$document->save();
move_uploaded_file($file->getPathname(), Files::mkdir($document->path()) . 'original.pdf');
- FluidbookDocumentUpload::updateProgression($uploadID, __('Mise en file d\'attente du traitement du document'), 1.2);
+ FluidbookDocumentUpload::updateProgression($uploadID, $document->id, __('Mise en file d\'attente du traitement du document'), 1.2);
FluidbookDocumentUpload::dispatch($uploadID, $document, backpack_user(), request('fluidbook_id', null));
return response()->json(['uploadID' => $uploadID, 'document' => $document->id]);
}
protected $withText;
protected $withGraphics;
protected $version;
- protected $force;
+ protected $forceCheck;
+ protected $forceProcess;
- public function __construct($document, $page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $force = false)
+ protected $finish = false;
+
+ public function __construct($document, $page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $forceCheck = false, $forceProcess = false)
{
$this->onQueue('fluidbookprocess');
$this->document = $document;
$this->withGraphics = $withGraphics;
$this->withText = $withText;
$this->version = $version;
- $this->force = $force;
+ $this->forceCheck = $forceCheck || $forceProcess;
+ $this->forceProcess = $forceProcess;
}
public function handle()
{
- $this->document->getFile($this->page, $this->format, $this->resolution, $this->withText, $this->withGraphics, $this->version, $this->force);
+ $this->finish = false;
+ echo $this->document->getFile($this->page, $this->format, $this->resolution, $this->withText, $this->withGraphics, $this->version, $this->forceCheck, $this->forceProcess) . "\n";
+ $this->finish = true;
}
/**
*/
public function isDone()
{
- return $this->document->hasFile($this->page, $this->format, $this->resolution, $this->withText, $this->withGraphics, $this->version);
+ return $this->finish || $this->isOK();
+ }
+
+ public function isOK()
+ {
+ return $this->document->hasFile($this->page, $this->format, $this->resolution, $this->withText, $this->withGraphics, $this->version, $this->forceCheck);
+ }
+
+ public function isError()
+ {
+ return $this->finish && !$this->isOK();
}
}
$this->setUser($user);
}
- public function handle()
+ public function handle($sync = false)
{
- FluidbookDocumentUpload::updateProgression($this->uploadID, __('Début du traitement du document'), 1.25);
- $this->document->processUpload($this->uploadID, false);
+ try {
+ FluidbookDocumentUpload::updateProgression($this->uploadID, $this->document->id, __('Début du traitement du document'), 1.25);
+ $this->document->processUpload($this->uploadID, $sync);
+ } catch (\Exception $e) {
+ error_log($e);
+ }
}
- public static function updateProgression($id, $message, $progress)
+ public static function updateProgression($id, $document_id, $message, $progress)
{
- Cache::put('FluidbookDocumentUpload_' . $id, ['message' => $message, 'progress' => $progress]);
+ Cache::put('FluidbookDocumentUpload_' . $id, ['message' => $message, 'document' => $document_id, 'progress' => $progress]);
}
public static function getProgression($id)
$.ajax({
url: '{{backpack_url($entry->getOption('name').'/uploadProgress')}}' + '/' + uploadID,
success: function (data) {
- showProgressBar(data.message, parseFloat(data.progress), uploadID);
+ let message = data.message;
+ if (data.document) {
+ message += '<br><i style="font-size: 80%;opacity: 0.6">Document #' + data.document + '</i>';
+ }
+ showProgressBar(message, parseFloat(data.progress), uploadID);
}
});
}
$('body').append('<div id="compositionProgress"><div><span></span><progress data-progress="" data-step="0" value="0" max="100"></progress></div></div>');
}
if (message !== '' && progress > 0) {
- $("#compositionProgress span").text(message);
+ $("#compositionProgress span").html(message);
if ($("#compositionProgress progress").attr('data-progress') == progress) {
return;
}