From e0f3c7f8ab09ade5df8e6e7b0ca0e744f0518c7c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 13 Sep 2021 19:11:36 +0200 Subject: [PATCH] wip #4666 @1 --- app/Jobs/ProcessFluidbook.php | 69 +++++++++++++------ composer.lock | 122 +++++++++++++++++----------------- 2 files changed, 111 insertions(+), 80 deletions(-) diff --git a/app/Jobs/ProcessFluidbook.php b/app/Jobs/ProcessFluidbook.php index 8890c83..3e53a69 100644 --- a/app/Jobs/ProcessFluidbook.php +++ b/app/Jobs/ProcessFluidbook.php @@ -4,6 +4,7 @@ namespace App\Jobs; use Cubist\Util\CommandLine; use Cubist\Util\Files\Files; +use Cubist\Util\Files\VirtualDirectory; use Cubist\Util\PHP; use Fluidbook\Tools\FluidbookTools; use Fluidbook\Tools\Jobs\ProcessFile; @@ -26,6 +27,9 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique protected $in; protected $out; + /** @var VirtualDirectory */ + protected $vdir; + /** * Create a new job instance. * @@ -50,37 +54,26 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique } start_measure('Process Fluidbook'); - $this->resetOutput(); $this->processPages($sync); $this->getTexts(); $this->getLinks(); - $this->writeConfig(); + $this->compileFluidbook(); stop_measure('Process Fluidbook'); } - protected function resetOutput() - { - start_measure("Reset Fluidbook Output"); - $stub = resource_path('fluidbook/'); - $cmd = "rm -rfv $this->out;cp -rv $stub $this->out"; - `$cmd`; - stop_measure("Reset Fluidbook Output"); - } - - public function processPages($sync = false) { start_measure('Process Pages'); - $out = $this->getOutputPath(); + $out = $this->getConvertPath(); Files::mkdir($out); $this->in->processPages($out, [new ProcessFile('jpg', 'thumb'), - new ProcessFile('jpg', 150, false, true), - new ProcessFile('svg', 300, true, false), + new ProcessFile('jpg', 150, true, false), + new ProcessFile('svg', 300, false, true), ], $sync); stop_measure('Process Pages'); } - public function getOutputPath() + public function getConvertPath() { return storage_path('fluidbook/convert/' . $this->in->getHash() . '/'); } @@ -88,20 +81,58 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique public function getTexts() { start_measure('Process texts'); - $this->in->processTexts($this->getOutputPath()); + $this->in->processTexts($this->getConvertPath()); start_measure('Process texts'); } public function getLinks() { start_measure('Process links'); - $this->in->processLinks($this->getOutputPath()); + $this->in->processLinks($this->getConvertPath()); start_measure('Process links'); } - public function writeConfig() + protected function compileFluidbook() { + start_measure('Compile fluidbook'); + + $this->vdir = new VirtualDirectory($this->out); + $this->vdir->copyDirectory(resource_path('fluidbook/'), '/'); + + $this->compileContents(); + $this->compileLinks(); + $this->compileSearch(); + $this->compileConfig(); + $this->vdir->sync(true); + + stop_measure('Compile fluidbook'); + } + + public function compileContents() + { + $cp = $this->getConvertPath(); + for ($i = 1; $i <= $this->in->getPages(); $i++) { + $this->vdir->copy($cp . 'html/t-' . $i . '.-150.jpg', 'data/background/150/t' . $i . '.jpg'); + $this->vdir->copy($cp . 'html/to-' . $i . '.svg', 'data/contents/p' . $i . '.svg'); + $this->vdir->copy($cp . 'html/p' . $i . '.jpg', 'data/thumbnails/p' . $i . '.jpg'); + } } + public function compileLinks() + { + + } + + public function compileSearch() + { + + } + + public function compileConfig() + { + + } + + } diff --git a/composer.lock b/composer.lock index d4466e3..bea22f7 100644 --- a/composer.lock +++ b/composer.lock @@ -1012,16 +1012,16 @@ }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.3", + "version": "1.11.99.4", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "fff576ac850c045158a250e7e27666e146e78d18" + "reference": "b174585d1fe49ceed21928a945138948cb394600" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/fff576ac850c045158a250e7e27666e146e78d18", - "reference": "fff576ac850c045158a250e7e27666e146e78d18", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", + "reference": "b174585d1fe49ceed21928a945138948cb394600", "shasum": "" }, "require": { @@ -1065,7 +1065,7 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.3" + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" }, "funding": [ { @@ -1081,7 +1081,7 @@ "type": "tidelift" } ], - "time": "2021-08-17T13:49:14+00:00" + "time": "2021-09-13T08:41:34+00:00" }, { "name": "creativeorange/gravatar", @@ -1486,13 +1486,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/cubist_util.git", - "reference": "12177cd5bd8abcefa708e3aabdf9985ef3e3b85d" + "reference": "68279da429ce0b6b7488797541eab9766756910e" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-610682.tar", - "reference": "12177cd5bd8abcefa708e3aabdf9985ef3e3b85d", - "shasum": "91ae258076cacde665055cd5c1f7b728b95ea4e2" + "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-655975.tar", + "reference": "68279da429ce0b6b7488797541eab9766756910e", + "shasum": "52ae14dbe977ac8e58a9803a5830bc955be5e6f7" }, "require": { "cubist/net": "dev-master", @@ -1522,7 +1522,7 @@ } ], "description": "Utilities class", - "time": "2021-09-03T16:57:58+00:00" + "time": "2021-09-13T15:58:30+00:00" }, { "name": "cviebrock/eloquent-sluggable", @@ -1827,16 +1827,16 @@ }, { "name": "doctrine/dbal", - "version": "3.1.1", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "8e0fde2b90e3f61361013d1e928621beeea07bc0" + "reference": "3ee2622b57370c786f531678f6641208747f7bfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/8e0fde2b90e3f61361013d1e928621beeea07bc0", - "reference": "8e0fde2b90e3f61361013d1e928621beeea07bc0", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/3ee2622b57370c786f531678f6641208747f7bfc", + "reference": "3ee2622b57370c786f531678f6641208747f7bfc", "shasum": "" }, "require": { @@ -1848,15 +1848,15 @@ }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2020.2", - "phpstan/phpstan": "0.12.81", - "phpstan/phpstan-strict-rules": "^0.12.2", + "jetbrains/phpstorm-stubs": "2021.1", + "phpstan/phpstan": "0.12.96", + "phpstan/phpstan-strict-rules": "^0.12.11", "phpunit/phpunit": "9.5.5", - "psalm/plugin-phpunit": "0.13.0", + "psalm/plugin-phpunit": "0.16.1", "squizlabs/php_codesniffer": "3.6.0", "symfony/cache": "^5.2|^6.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.6.4" + "vimeo/psalm": "4.10.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -1916,7 +1916,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.1" + "source": "https://github.com/doctrine/dbal/tree/3.1.2" }, "funding": [ { @@ -1932,7 +1932,7 @@ "type": "tidelift" } ], - "time": "2021-06-19T17:59:55+00:00" + "time": "2021-09-12T20:56:32+00:00" }, { "name": "doctrine/deprecations", @@ -2612,13 +2612,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/fluidbook_tools.git", - "reference": "21176c4e485d13bdb24c43cf3c038539df01e01d" + "reference": "e4d1738be232282a488c1a50ffd10d1a7cdb0211" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-0bc471.tar", - "reference": "21176c4e485d13bdb24c43cf3c038539df01e01d", - "shasum": "15f3ddd393e9e20dfc589c933b27e8a0e830f788" + "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-2d42a0.tar", + "reference": "e4d1738be232282a488c1a50ffd10d1a7cdb0211", + "shasum": "8b01a492d6c5f8819c7bb834969034c8407e10e6" }, "require": { "barryvdh/laravel-debugbar": "^3.6", @@ -2631,7 +2631,7 @@ "ext-mbstring": "*", "ext-simplexml": "*", "laravel/framework": "~5.8|^6.0|^7.0|^8.0", - "php": ">=7.0.0" + "php": ">=8.0" }, "default-branch": true, "type": "library", @@ -2650,7 +2650,7 @@ } ], "description": "Fluidbook Tools", - "time": "2021-09-08T14:14:45+00:00" + "time": "2021-09-13T15:58:41+00:00" }, { "name": "fruitcake/laravel-cors", @@ -4171,16 +4171,16 @@ }, { "name": "mockery/mockery", - "version": "1.4.3", + "version": "1.4.4", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea" + "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/d1339f64479af1bee0e82a0413813fe5345a54ea", - "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e01123a0e847d52d186c5eb4b9bf58b0c6d00346", + "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346", "shasum": "" }, "require": { @@ -4237,9 +4237,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.4.3" + "source": "https://github.com/mockery/mockery/tree/1.4.4" }, - "time": "2021-02-24T09:51:49+00:00" + "time": "2021-09-13T15:28:59+00:00" }, { "name": "monolog/monolog", @@ -5834,16 +5834,16 @@ }, { "name": "spatie/laravel-backup", - "version": "6.16.3", + "version": "6.16.5", "source": { "type": "git", "url": "https://github.com/spatie/laravel-backup.git", - "reference": "d923991b8790954bdd7b1ffc99b997fe8b82309a" + "reference": "332fae80b12cacb9e4161824ba195d984b28c8fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/d923991b8790954bdd7b1ffc99b997fe8b82309a", - "reference": "d923991b8790954bdd7b1ffc99b997fe8b82309a", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/332fae80b12cacb9e4161824ba195d984b28c8fb", + "reference": "332fae80b12cacb9e4161824ba195d984b28c8fb", "shasum": "" }, "require": { @@ -5908,7 +5908,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-backup/issues", - "source": "https://github.com/spatie/laravel-backup/tree/6.16.3" + "source": "https://github.com/spatie/laravel-backup/tree/6.16.5" }, "funding": [ { @@ -5920,7 +5920,7 @@ "type": "other" } ], - "time": "2021-09-01T14:55:00+00:00" + "time": "2021-09-12T10:04:18+00:00" }, { "name": "spatie/laravel-googletagmanager", @@ -9450,16 +9450,16 @@ }, { "name": "facade/flare-client-php", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/facade/flare-client-php.git", - "reference": "47b639dc02bcfdfc4ebb83de703856fa01e35f5f" + "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/47b639dc02bcfdfc4ebb83de703856fa01e35f5f", - "reference": "47b639dc02bcfdfc4ebb83de703856fa01e35f5f", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/b2adf1512755637d0cef4f7d1b54301325ac78ed", + "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed", "shasum": "" }, "require": { @@ -9503,7 +9503,7 @@ ], "support": { "issues": "https://github.com/facade/flare-client-php/issues", - "source": "https://github.com/facade/flare-client-php/tree/1.8.1" + "source": "https://github.com/facade/flare-client-php/tree/1.9.1" }, "funding": [ { @@ -9511,26 +9511,26 @@ "type": "github" } ], - "time": "2021-05-31T19:23:29+00:00" + "time": "2021-09-13T12:16:46+00:00" }, { "name": "facade/ignition", - "version": "2.12.0", + "version": "2.13.1", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "74dcc32a2895a126d1e5f2cd3bbab499cac66db1" + "reference": "e3f49bef7b4165fa4b8a9dc579e7b63fa06aef78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/74dcc32a2895a126d1e5f2cd3bbab499cac66db1", - "reference": "74dcc32a2895a126d1e5f2cd3bbab499cac66db1", + "url": "https://api.github.com/repos/facade/ignition/zipball/e3f49bef7b4165fa4b8a9dc579e7b63fa06aef78", + "reference": "e3f49bef7b4165fa4b8a9dc579e7b63fa06aef78", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", - "facade/flare-client-php": "^1.6", + "facade/flare-client-php": "^1.9.1", "facade/ignition-contracts": "^1.0.2", "illuminate/support": "^7.0|^8.0", "monolog/monolog": "^2.0", @@ -9587,7 +9587,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2021-08-24T09:53:54+00:00" + "time": "2021-09-13T13:01:30+00:00" }, { "name": "facade/ignition-contracts", @@ -10255,33 +10255,33 @@ }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -10316,9 +10316,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", -- 2.39.5