From: Vincent Vanwaelscappel Date: Fri, 3 Sep 2021 16:49:53 +0000 (+0200) Subject: wip #4666 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=86bc81a120e61fcc9fa28e800199b7338c2dc3c4;p=odl.git wip #4666 @3 --- diff --git a/app/Jobs/ProcessFluidbook.php b/app/Jobs/ProcessFluidbook.php index 44a11da..57ea47d 100644 --- a/app/Jobs/ProcessFluidbook.php +++ b/app/Jobs/ProcessFluidbook.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use Cubist\Util\CommandLine; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; @@ -9,10 +10,17 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -class ProcessFluidbook implements ShouldQueue +class ProcessFluidbook implements ShouldQueue, ShouldBeUnique { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; + protected $in; + protected $out; + + protected $pages; + protected $width; + protected $height; + /** * Create a new job instance. * @@ -20,7 +28,8 @@ class ProcessFluidbook implements ShouldQueue */ public function __construct() { - // + $this->in = storage_path('fluidbook/in/'); + $this->out = storage_path('fluidbook/out/'); } /** @@ -30,6 +39,59 @@ class ProcessFluidbook implements ShouldQueue */ public function handle() { - // + $this->resetOutput(); + $this->getInfos(); + $this->pdfToImages(); + $this->getTexts(); + $this->getLinks(); + $this->writeConfig(); + } + + protected function resetOutput() + { + $stub = resource_path('fluidbook/'); + $cmd = "rm -rfv $this->out;cp -rv $stub $this->out"; + `$cmd`; + } + + public function getInfos() + { + $fwstk = new CommandLine(base_path('tools/fwstk.sh')); + $fwstk->setArg('--input ' . $this->in . 'in.pdf'); + $fwstk->setArg('--infos'); + $fwstk->execute(); + + $infos = $fwstk->getOutput(); + + if (preg_match('/Pages:\s*(\d+)/', $infos, $matches)) { + $this->pages = (int)$matches[1]; + } + if (preg_match('/Page 1 size:\s*([0-9.]+)[ptsx\s]+([0-9.]+)/', $infos, $matches)) { + $this->width = (float)$matches[1]; + $this->height = (float)$matches[2]; + } + + file_put_contents($this->in . '/infos.txt', $infos); + } + + public function pdfToImages() + { + + } + + public function getTexts() + { + + } + + public function getLinks() + { + } + + public function writeConfig() + { + + } + } diff --git a/composer.json b/composer.json index ec54c7c..7156ab2 100644 --- a/composer.json +++ b/composer.json @@ -12,31 +12,27 @@ "license": "MIT", "require": { "php": "^7.3|^8.0", - "fruitcake/laravel-cors": "^2.0", - "guzzlehttp/guzzle": "^7.0.1", - "laravel/framework": "^8.58", - "laravel/sanctum": "^2.11", - "laravel/tinker": "^2.5", "ext-json": "*", "ext-simplexml": "*", "ext-tidy": "*", "ext-zip": "*", + "ext-redis": "*", "cubist/cms-back": "dev-master", + "fruitcake/laravel-cors": "^2.0", + "guzzlehttp/guzzle": "^7.3", + "laravel/framework": "^8.58", + "laravel/sanctum": "^2.11", + "laravel/tinker": "^2.6", + "mxl/laravel-job": "^1.2", "predis/predis": "^1.1" }, "require-dev": { - "facade/ignition": "^2.5", - "fakerphp/faker": "^1.9.1", - "laravel/sail": "^1.0.1", + "facade/ignition": "^2.12", + "fakerphp/faker": "^1.15", + "laravel/sail": "^1.10", "mockery/mockery": "^1.4.2", - "nunomaduro/collision": "^5.0", - "phpunit/phpunit": "^9.3.3", - "ext-json": "*", - "ext-simplexml": "*", - "ext-tidy": "*", - "ext-zip": "*", - "cubist/cms-back": "dev-master", - "predis/predis": "^1.1" + "nunomaduro/collision": "^5.9", + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ef03726..bbc2d2f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e8ee131ea1f792b178463f11763287e2", + "content-hash": "90fd3102e33006c8e1bfaef9432159d3", "packages": [ { "name": "asm89/stack-cors", @@ -1152,17 +1152,17 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/cubist_cms-back.git", - "reference": "e171e566d742696ca4a1b9f48faf602bb1ca72e9" + "reference": "2a39df6e8b6e6da4c70cafbd359a7e7900bb54df" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-a520cd.tar", - "reference": "e171e566d742696ca4a1b9f48faf602bb1ca72e9", - "shasum": "57074a4c19045c56760c0166101007ebc21ff495" + "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-78721e.tar", + "reference": "2a39df6e8b6e6da4c70cafbd359a7e7900bb54df", + "shasum": "8268c601330917a9c23ab1dcf5ee5dbf70779f08" }, "require": { "backpack/backupmanager": "^3.0", - "backpack/crud": "^4.1", + "backpack/crud": "^4.1.51", "backpack/logmanager": "^4.0", "backpack/permissionmanager": "^6.0", "backpack/revise-operation": "^1.0", @@ -1182,14 +1182,14 @@ "ext-libxml": "*", "fideloper/proxy": "^4.4", "genealabs/laravel-model-caching": "^0.11", - "graham-campbell/markdown": "^v13.1.0", + "graham-campbell/markdown": "^v13.1", "laravel/framework": "^v8.58", "lavary/laravel-menu": "^v1.8", "league/commonmark": "^1.6", "predis/predis": "^v1.1", "spatie/laravel-honeypot": "^4.0", "spatie/laravel-translatable": "^5.0", - "swayok/alternative-laravel-cache": "^5.4", + "swayok/alternative-laravel-cache": "^6.1", "venturecraft/revisionable": "^1.38" }, "require-dev": { @@ -1235,7 +1235,7 @@ } ], "description": "Cubist Backpack extension", - "time": "2021-09-02T10:05:06+00:00" + "time": "2021-09-03T14:57:36+00:00" }, { "name": "cubist/cms-front", @@ -4291,6 +4291,65 @@ ], "time": "2021-07-23T07:42:52+00:00" }, + { + "name": "mxl/laravel-job", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/mxl/laravel-job.git", + "reference": "826e472f5282d3c630dca3fccf99784fa379ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mxl/laravel-job/zipball/826e472f5282d3c630dca3fccf99784fa379ce5c", + "reference": "826e472f5282d3c630dca3fccf99784fa379ce5c", + "shasum": "" + }, + "require": { + "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "MichaelLedin\\LaravelJob\\LaravelJobServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "MichaelLedin\\LaravelJob\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Ledin", + "email": "mledin89@gmail.com" + } + ], + "description": "Laravel job tools", + "homepage": "https://github.com/mxl/laravel-job", + "keywords": [ + "command", + "dispatch", + "job", + "laravel", + "tools" + ], + "support": { + "issues": "https://github.com/mxl/laravel-job/issues", + "source": "https://github.com/mxl/laravel-job" + }, + "time": "2020-09-11T06:40:19+00:00" + }, { "name": "myclabs/php-enum", "version": "1.8.3", @@ -6390,28 +6449,36 @@ }, { "name": "swayok/alternative-laravel-cache", - "version": "5.4.13", + "version": "6.1.2", "source": { "type": "git", "url": "https://github.com/swayok/alternative-laravel-cache.git", - "reference": "3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9" + "reference": "31f1a5c4de90ce257ccb40fef4d38874ddb1b275" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swayok/alternative-laravel-cache/zipball/3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9", - "reference": "3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9", + "url": "https://api.github.com/repos/swayok/alternative-laravel-cache/zipball/31f1a5c4de90ce257ccb40fef4d38874ddb1b275", + "reference": "31f1a5c4de90ce257ccb40fef4d38874ddb1b275", "shasum": "" }, "require": { "cache/adapter-common": "^1.0.0", "cache/hierarchical-cache": "^1.0.0", - "laravel/framework": ">=5.4|>=6.0|>=7.0|>=8.0", - "php": "^5.6 || ^7.0", + "laravel/framework": ">=6.0|>=7.0|>=8.0", + "php": "^7.2.5|^8.0", "psr/cache": "^1.0.0", "psr/simple-cache": "^1.0.0" }, + "require-dev": { + "cache/filesystem-adapter": "^1.0", + "cache/memcached-adapter": "^1.0", + "cache/predis-adapter": "^1.0", + "cache/redis-adapter": "^1.0", + "phpunit/phpunit": "^8.5" + }, "suggest": { "cache/filesystem-adapter": "Required to use file-based cache", + "cache/memcached-adapter": "Required to use Memcache-based cache", "cache/predis-adapter": "Required to use Redis-based cache through predis/predis package", "cache/redis-adapter": "Required to use Redis-based cache through php-redis extension (recommended - faster and more stable then predis)" }, @@ -6424,8 +6491,8 @@ } }, "autoload": { - "psr-0": { - "AlternativeLaravelCache": "/src" + "psr-4": { + "AlternativeLaravelCache\\": "AlternativeLaravelCache/" } }, "notification-url": "https://packagist.org/downloads/", @@ -6448,9 +6515,9 @@ ], "support": { "issues": "https://github.com/swayok/alternative-laravel-cache/issues", - "source": "https://github.com/swayok/alternative-laravel-cache/tree/5.4.13" + "source": "https://github.com/swayok/alternative-laravel-cache/tree/6.1.2" }, - "time": "2020-09-08T17:10:42+00:00" + "time": "2021-05-18T20:39:07+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -11481,6 +11548,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -11657,11 +11725,6 @@ "ext-tidy": "*", "ext-zip": "*" }, - "platform-dev": { - "ext-json": "*", - "ext-simplexml": "*", - "ext-tidy": "*", - "ext-zip": "*" - }, + "platform-dev": [], "plugin-api-version": "2.1.0" } diff --git a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php index 7044a70..71d7efc 100644 --- a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php +++ b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php @@ -28,3 +28,16 @@ @endcan +@canany('maintenance') + +@endcanany diff --git a/storage/.gitignore b/storage/.gitignore new file mode 100644 index 0000000..59b0d5e --- /dev/null +++ b/storage/.gitignore @@ -0,0 +1 @@ +fluidbook diff --git a/storage/fluidbook/in/in.pdf b/storage/fluidbook/in/in.pdf new file mode 100644 index 0000000..96ec569 Binary files /dev/null and b/storage/fluidbook/in/in.pdf differ diff --git a/tools/fwstk.sh b/tools/fwstk.sh index 867a7f1..7584ed4 100644 --- a/tools/fwstk.sh +++ b/tools/fwstk.sh @@ -1,2 +1,3 @@ #!/bin/sh -java -jar ./fwstk/out/artifacts/fwstk_jar/fwstk.jar $* +DIR="$( cd "$( dirname "$0" )" && pwd )" +java -jar "$DIR/fwstk/out/artifacts/fwstk_jar/fwstk.jar" $* diff --git a/tools/fwstk/fwstk.iml b/tools/fwstk/fwstk.iml new file mode 100644 index 0000000..b3a49f9 --- /dev/null +++ b/tools/fwstk/fwstk.iml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file