//protected static $_forceServer = 'alphaville';
- protected static $_region = 'UE';
+ protected static $_region = Region::EUROPE;
protected static $_farmServers = [
- ['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 12, 'region' => 'UE'],
- ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6, 'region' => 'UE'],
- ['name' => 'clockwork', 'host' => 'clockwork.cubedesigners.com', 'weight' => 2, 'region' => 'UE'],
- ['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 6, 'region' => 'UE'],
- ['name' => 'dobermann', 'host' => 'dobermann.cubedesigners.com', 'weight' => 6, 'region' => 'UE'],
- ['name' => 'elephantman', 'host' => 'paris.cubedesigners.com', 'weight' => 2, 'region' => 'UE'],
- ['name' => 'fastandfurious', 'host' => 'fastandfurious.cubedesigners.com', 'weight' => 2, 'region' => 'UE'],
- ['name' => 'godzilla', 'host' => 'godzilla.cubedesigners.com', 'weight' => 3, 'region' => 'UE'],
- ['name' => 'her', 'host' => 'her2.cubedesigners.com', 'weight' => 4, 'region' => 'UE'],
- ['name' => 'isleofdogs', 'host' => 'paris.cubedesigners.com', 'port' => 9458, 'weight' => 2, 'region' => 'UE'],
- ['name' => 'jumanji', 'host' => 'paris.cubedesigners.com', 'port' => 9459, 'weight' => 2, 'region' => 'UE'],
- ['name' => 'kingkong', 'host' => 'kingkong.cubedesigners.com', 'weight' => 6, 'region' => 'US'],
- //['name' => 'nakedgun', 'host' => 'nakedgun.cubedesigners.com', 'weight' => 4, 'region' => 'UE'],
+ ['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 12, 'region' => Region::EUROPE],
+ ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6, 'region' => Region::EUROPE],
+ ['name' => 'clockwork', 'host' => 'clockwork.cubedesigners.com', 'weight' => 2, 'region' => Region::EUROPE],
+ ['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 6, 'region' => Region::EUROPE],
+ ['name' => 'dobermann', 'host' => 'dobermann.cubedesigners.com', 'weight' => 6, 'region' => Region::EUROPE],
+ ['name' => 'elephantman', 'host' => 'paris.cubedesigners.com', 'weight' => 2, 'region' => Region::EUROPE],
+ ['name' => 'fastandfurious', 'host' => 'fastandfurious.cubedesigners.com', 'weight' => 2, 'region' => Region::EUROPE],
+ ['name' => 'godzilla', 'host' => 'godzilla.cubedesigners.com', 'weight' => 3, 'region' => Region::EUROPE],
+ ['name' => 'her', 'host' => 'her2.cubedesigners.com', 'weight' => 4, 'region' => Region::EUROPE],
+ ['name' => 'isleofdogs', 'host' => 'paris.cubedesigners.com', 'port' => 9458, 'weight' => 2, 'region' => Region::EUROPE],
+ ['name' => 'jumanji', 'host' => 'paris.cubedesigners.com', 'port' => 9459, 'weight' => 2, 'region' => Region::EUROPE],
+ ['name' => 'kingkong', 'host' => 'kingkong.cubedesigners.com', 'weight' => 6, 'region' => Region::USA],
+ //['name' => 'nakedgun', 'host' => 'nakedgun.cubedesigners.com', 'weight' => 4, 'region' => Region::EUROPE],
];
/**
use App\Fluidbook\Farm;
use App\Fluidbook\Link\Link;
use App\Fluidbook\Link\LinksData;
+use App\Fluidbook\Region;
use App\Http\Controllers\Admin\Operations\ChangeownerOperation;
use App\Http\Controllers\Admin\Operations\ChangestatusOperation;
use App\Http\Controllers\Admin\Operations\FluidbookPublication\AuditOperation;
use Cubist\Backpack\Magic\Fields\ReadOnlyValue;
use Cubist\Excel\ExcelToArray;
use Cubist\Util\ArrayUtil;
+use Cubist\Util\CommandLine\Rsync;
use Cubist\Util\Files\Files;
use Cubist\Util\Graphics\Image;
use Cubist\Util\Json;
$this->addOwnerField();
- $this->addField('region', ReadOnlyValue::class, __('Région d\'hébergement des données'), ['non_default_tracking' => false, 'options' => ['UE' => __('Union européenne'), 'US' => 'USA'], 'default' => 'UE', 'allows_null' => false, 'databaseDefault' => 'UE']);
+ $this->addField('region', ReadOnlyValue::class, __('Région d\'hébergement des données'), ['non_default_tracking' => false, 'options' => Region::getAllRegions(), 'default' => Region::EUROPE, 'allows_null' => false, 'databaseDefault' => Region::EUROPE]);
$this->addField('status', FluidbookStatus::class, __('Status'), [
'column' => true,
'filter' => true,
return (float)$this->getDocumentSize($page)[1];
}
- public function protected_path($path)
+ public function protected_path($path, $forceRegion = null)
{
- if ($this->region === 'UE') {
+ $r = $forceRegion ?? $this->region;
+ if ($r === Region::EUROPE) {
return protected_path($path);
} else {
return us_protected_path($path);
}
+ public function moveRegion($newRegion)
+ {
+ foreach (FluidbookDocument::withoutGlobalScopes()->whereIn('id', $this->getDocumentsId())->get() as $doc) {
+ $doc->moveRegion($newRegion);
+ }
+
+ $regions = Region::getAllRegionsCodes();
+
+ $dirs = ['final', 'pdf', 'index', 'working'];
+ foreach ($dirs as $dir) {
+ foreach ($regions as $region) {
+ if ($region === $newRegion) {
+ continue;
+ }
+ $from = $this->protected_path('fluidbookpublication/' . $dir . '/' . $this->id, $region);
+ $to = $this->protected_path('fluidbookpublication/' . $dir . '/' . $this->id, $newRegion);
+ $rsync = new Rsync($from, $to, false);
+ $rsync->setMove(true);
+ $rsync->execute();
+ }
+ }
+ $this->region = $newRegion;
+ $this->save();
+ }
+
protected function _replicateMedia($newId)
{
static::copyAssets($this->id, $newId, 'link');
public static function copyAssets($fromId, $toId, $mode = 'link')
{
- $from = Files::mkdir(protected_path('fluidbookpublication/working/' . $fromId));
- $to = Files::mkdir(protected_path('fluidbookpublication/working/' . $toId));
+ $from = Files::mkdir(self::getProtectedPath($fromId, 'fluidbookpublication/working/' . $fromId));
+ $to = Files::mkdir(self::getProtectedPath($toId, 'fluidbookpublication/working/' . $toId));
if ($mode === 'link') {
$cmd = "cp -Rnps $from* $to";
} else if ($mode === 'link_overwrite') {
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_util.git",
- "reference": "cae7516c3a082886d62a5ffbc8b54bba2bb84298"
+ "reference": "6bf2e76444fcf1e4071f927cbcba7ae289f5420e"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-edcce4.tar",
- "reference": "cae7516c3a082886d62a5ffbc8b54bba2bb84298",
- "shasum": "3670d5cd17c3b87e9860f69db06d3d8baa7ea7df"
+ "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-15d837.tar",
+ "reference": "6bf2e76444fcf1e4071f927cbcba7ae289f5420e",
+ "shasum": "b9d1e26f3942c7428943d69e761243f03169d2cd"
},
"require": {
"cubist/net": "dev-master",
}
],
"description": "Utilities class",
- "time": "2023-10-04T14:55:43+00:00"
+ "time": "2023-11-22T12:16:47+00:00"
},
{
"name": "cviebrock/eloquent-sluggable",
},
{
"name": "doctrine/dbal",
- "version": "3.7.1",
+ "version": "3.7.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
- "reference": "5b7bd66c9ff58c04c5474ab85edce442f8081cb2"
+ "reference": "0ac3c270590e54910715e9a1a044cc368df282b2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/dbal/zipball/5b7bd66c9ff58c04c5474ab85edce442f8081cb2",
- "reference": "5b7bd66c9ff58c04c5474ab85edce442f8081cb2",
+ "url": "https://api.github.com/repos/doctrine/dbal/zipball/0ac3c270590e54910715e9a1a044cc368df282b2",
+ "reference": "0ac3c270590e54910715e9a1a044cc368df282b2",
"shasum": ""
},
"require": {
"doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.1",
- "phpstan/phpstan": "1.10.35",
+ "phpstan/phpstan": "1.10.42",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "9.6.13",
"psalm/plugin-phpunit": "0.18.4",
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
- "source": "https://github.com/doctrine/dbal/tree/3.7.1"
+ "source": "https://github.com/doctrine/dbal/tree/3.7.2"
},
"funding": [
{
"type": "tidelift"
}
],
- "time": "2023-10-06T05:06:20+00:00"
+ "time": "2023-11-19T08:06:58+00:00"
},
{
"name": "doctrine/deprecations",
},
{
"name": "ezyang/htmlpurifier",
- "version": "v4.16.0",
+ "version": "v4.17.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
- "reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8"
+ "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8",
- "reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c",
+ "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"shasum": ""
},
"require": {
- "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
+ "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
- "source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0"
+ "source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0"
},
- "time": "2022-09-18T07:06:19+00:00"
+ "time": "2023-11-17T15:01:25+00:00"
},
{
"name": "fluidbook/tools",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/fluidbook_tools.git",
- "reference": "ac6a50b6a6440814a5f23e490d2e35eff4216a90"
+ "reference": "dd9b5b32ddc1a14afce0aed09a39be2723dc8502"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-1245dd.tar",
- "reference": "ac6a50b6a6440814a5f23e490d2e35eff4216a90",
- "shasum": "34f51f7771a2642bd02f19dc9772f48448a7f108"
+ "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-cf70ef.tar",
+ "reference": "dd9b5b32ddc1a14afce0aed09a39be2723dc8502",
+ "shasum": "1a3c8493f78e9d5bcad767e5cfb7c6877fec005e"
},
"require": {
"barryvdh/laravel-debugbar": "*",
}
],
"description": "Fluidbook Tools",
- "time": "2023-11-17T07:25:02+00:00"
+ "time": "2023-11-17T09:43:44+00:00"
},
{
"name": "fruitcake/php-cors",
},
{
"name": "jane-php/json-schema-runtime",
- "version": "v7.5.4",
+ "version": "v7.5.5",
"source": {
"type": "git",
"url": "https://github.com/janephp/json-schema-runtime.git",
],
"description": "Jane runtime Library",
"support": {
- "source": "https://github.com/janephp/json-schema-runtime/tree/v7.5.4"
+ "source": "https://github.com/janephp/json-schema-runtime/tree/v7.5.5"
},
"time": "2023-09-08T13:25:01+00:00"
},
{
"name": "jane-php/open-api-runtime",
- "version": "v7.5.4",
+ "version": "v7.5.5",
"source": {
"type": "git",
"url": "https://github.com/janephp/open-api-runtime.git",
],
"description": "Jane OpenAPI Runtime Library, dependencies and utility class for a library generated by jane/openapi",
"support": {
- "source": "https://github.com/janephp/open-api-runtime/tree/v7.5.4"
+ "source": "https://github.com/janephp/open-api-runtime/tree/v7.5.5"
},
"time": "2021-12-16T13:26:58+00:00"
},
},
{
"name": "laravel/framework",
- "version": "v10.32.1",
+ "version": "v10.33.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
- "reference": "b30e44f20d244f7ba125283e14a8bbac167f4e5b"
+ "reference": "4536872e3e5b6be51b1f655dafd12c9a4fa0cfe8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/framework/zipball/b30e44f20d244f7ba125283e14a8bbac167f4e5b",
- "reference": "b30e44f20d244f7ba125283e14a8bbac167f4e5b",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/4536872e3e5b6be51b1f655dafd12c9a4fa0cfe8",
+ "reference": "4536872e3e5b6be51b1f655dafd12c9a4fa0cfe8",
"shasum": ""
},
"require": {
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2023-11-14T22:57:08+00:00"
+ "time": "2023-11-21T14:49:31+00:00"
},
{
"name": "laravel/prompts",
},
{
"name": "league/flysystem",
- "version": "3.19.0",
+ "version": "3.21.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
- "reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83"
+ "reference": "a326d8a2d007e4ca327a57470846e34363789258"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1b2aa10f2326e0351399b8ce68e287d8e9209a83",
- "reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83",
+ "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a326d8a2d007e4ca327a57470846e34363789258",
+ "reference": "a326d8a2d007e4ca327a57470846e34363789258",
"shasum": ""
},
"require": {
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
- "source": "https://github.com/thephpleague/flysystem/tree/3.19.0"
+ "source": "https://github.com/thephpleague/flysystem/tree/3.21.0"
},
"funding": [
{
"type": "github"
}
],
- "time": "2023-11-07T09:04:28+00:00"
+ "time": "2023-11-18T13:59:15+00:00"
},
{
"name": "league/flysystem-local",
- "version": "3.19.0",
+ "version": "3.21.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-local.git",
- "reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076"
+ "reference": "470eb1c09eaabd49ebd908ae06f23983ba3ecfe7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/8d868217f9eeb4e9a7320db5ccad825e9a7a4076",
- "reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076",
+ "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/470eb1c09eaabd49ebd908ae06f23983ba3ecfe7",
+ "reference": "470eb1c09eaabd49ebd908ae06f23983ba3ecfe7",
"shasum": ""
},
"require": {
],
"support": {
"issues": "https://github.com/thephpleague/flysystem-local/issues",
- "source": "https://github.com/thephpleague/flysystem-local/tree/3.19.0"
+ "source": "https://github.com/thephpleague/flysystem-local/tree/3.21.0"
},
"funding": [
{
"type": "github"
}
],
- "time": "2023-11-06T20:35:28+00:00"
+ "time": "2023-11-18T13:41:42+00:00"
},
{
"name": "league/glide",
},
{
"name": "spatie/laravel-backup",
- "version": "8.4.0",
+ "version": "8.4.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-backup.git",
- "reference": "64f4b816c61f802e9f4c831a589c9d2e21573ddd"
+ "reference": "b79f790cc856e67cce012abf34bf1c9035085dc1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/64f4b816c61f802e9f4c831a589c9d2e21573ddd",
- "reference": "64f4b816c61f802e9f4c831a589c9d2e21573ddd",
+ "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/b79f790cc856e67cce012abf34bf1c9035085dc1",
+ "reference": "b79f790cc856e67cce012abf34bf1c9035085dc1",
"shasum": ""
},
"require": {
],
"support": {
"issues": "https://github.com/spatie/laravel-backup/issues",
- "source": "https://github.com/spatie/laravel-backup/tree/8.4.0"
+ "source": "https://github.com/spatie/laravel-backup/tree/8.4.1"
},
"funding": [
{
"type": "other"
}
],
- "time": "2023-10-17T15:51:49+00:00"
+ "time": "2023-11-20T08:21:45+00:00"
},
{
"name": "spatie/laravel-googletagmanager",
},
{
"name": "phpstan/phpdoc-parser",
- "version": "1.24.2",
+ "version": "1.24.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
- "reference": "bcad8d995980440892759db0c32acae7c8e79442"
+ "reference": "12f01d214f1c73b9c91fdb3b1c415e4c70652083"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442",
- "reference": "bcad8d995980440892759db0c32acae7c8e79442",
+ "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/12f01d214f1c73b9c91fdb3b1c415e4c70652083",
+ "reference": "12f01d214f1c73b9c91fdb3b1c415e4c70652083",
"shasum": ""
},
"require": {
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
- "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2"
+ "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.3"
},
- "time": "2023-09-26T12:28:12+00:00"
+ "time": "2023-11-18T20:15:32+00:00"
},
{
"name": "phpunit/php-code-coverage",
},
{
"name": "theseer/tokenizer",
- "version": "1.2.1",
+ "version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
- "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e"
+ "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
- "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
+ "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
+ "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
"shasum": ""
},
"require": {
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
- "source": "https://github.com/theseer/tokenizer/tree/1.2.1"
+ "source": "https://github.com/theseer/tokenizer/tree/1.2.2"
},
"funding": [
{
"type": "github"
}
],
- "time": "2021-07-28T10:34:58+00:00"
+ "time": "2023-11-20T00:12:19+00:00"
}
],
"aliases": [],
"ext-zlib": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.1.0"
+ "plugin-api-version": "2.6.0"
}