PHRAS-3519_filesystem-atomic-move

WIP
extend filesystem (no change yet)
This commit is contained in:
jygaulier
2021-10-06 18:23:52 +02:00
parent 0d07c8fb84
commit d7d731a496
30 changed files with 106 additions and 38 deletions

View File

@@ -9,8 +9,10 @@
*/ */
namespace Alchemy\Phrasea\Application\Helper; namespace Alchemy\Phrasea\Application\Helper;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Neutron\TemporaryFilesystem\Manager; use Neutron\TemporaryFilesystem\Manager;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
trait FilesystemAware trait FilesystemAware
{ {

View File

@@ -12,9 +12,11 @@
namespace Alchemy\Phrasea\Command\Developer; namespace Alchemy\Phrasea\Command\Developer;
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class Behat extends Command class Behat extends Command
{ {

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager; use Alchemy\Phrasea\Border\Manager;
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\ControllerProvider\Api\V2; use Alchemy\Phrasea\ControllerProvider\Api\V2;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Media\SubdefSubstituer; use Alchemy\Phrasea\Media\SubdefSubstituer;
use Alchemy\Phrasea\Model\Entities\AggregateToken; use Alchemy\Phrasea\Model\Entities\AggregateToken;
use Alchemy\Phrasea\Model\Entities\ApiApplication; use Alchemy\Phrasea\Model\Entities\ApiApplication;
@@ -48,7 +49,9 @@ use Doctrine\ORM\Tools\SchemaTool;
use Gedmo\Timestampable\TimestampableListener; use Gedmo\Timestampable\TimestampableListener;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class RegenerateSqliteDb extends Command class RegenerateSqliteDb extends Command
{ {

View File

@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Controller\Admin; namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Model\Entities\Feed; use Alchemy\Phrasea\Model\Entities\Feed;
use Alchemy\Phrasea\Model\Entities\FeedPublisher; use Alchemy\Phrasea\Model\Entities\FeedPublisher;
use Alchemy\Phrasea\Model\Repositories\FeedPublisherRepository; use Alchemy\Phrasea\Model\Repositories\FeedPublisherRepository;
@@ -20,12 +21,12 @@ use Doctrine\Common\Persistence\ObjectManager;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Image; use MediaAlchemyst\Specification\Image;
use MediaVorus\Media\MediaInterface; use MediaVorus\Media\MediaInterface;
use MediaVorus\MediaVorus;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
// use Symfony\Component\Filesystem\Filesystem;
class FeedController extends Controller class FeedController extends Controller
{ {
public function listFeedsAction() public function listFeedsAction()

View File

@@ -12,11 +12,13 @@
namespace Alchemy\Phrasea\ControllerProvider; namespace Alchemy\Phrasea\ControllerProvider;
use Alchemy\Phrasea\Controller\MinifierController; use Alchemy\Phrasea\Controller\MinifierController;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Silex\Application;
use Silex\ControllerCollection; use Silex\ControllerCollection;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class Minifier implements ControllerProviderInterface, ServiceProviderInterface class Minifier implements ControllerProviderInterface, ServiceProviderInterface
{ {

View File

@@ -3,14 +3,16 @@
namespace Alchemy\Phrasea\Core\Thumbnail; namespace Alchemy\Phrasea\Core\Thumbnail;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Image as ImageSpecification; use MediaAlchemyst\Specification\Image as ImageSpecification;
use MediaVorus\Media\Image; use MediaVorus\Media\Image;
use MediaVorus\Media\MediaInterface; use MediaVorus\Media\MediaInterface;
use MediaVorus\Media\Video; use MediaVorus\Media\Video;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
//use Symfony\Component\Filesystem\Filesystem;
abstract class AbstractThumbnailManager abstract class AbstractThumbnailManager
{ {
/** /**

View File

@@ -17,11 +17,11 @@ use MediaAlchemyst\Specification\SpecificationInterface;
class FilesystemService class FilesystemService
{ {
/** /**
* @var \Symfony\Component\Filesystem\Filesystem * @var PhraseanetFilesystem
*/ */
private $filesystem; private $filesystem;
public function __construct(\Symfony\Component\Filesystem\Filesystem $filesystem) public function __construct(PhraseanetFilesystem $filesystem)
{ {
$this->filesystem = $filesystem; $this->filesystem = $filesystem;
} }

View File

@@ -10,11 +10,13 @@
namespace Alchemy\Phrasea\Filesystem; namespace Alchemy\Phrasea\Filesystem;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Neutron\TemporaryFilesystem\Manager; use Neutron\TemporaryFilesystem\Manager;
use Neutron\TemporaryFilesystem\TemporaryFilesystem; use Neutron\TemporaryFilesystem\TemporaryFilesystem;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Filesystem\Filesystem;
//use Symfony\Component\Filesystem\Filesystem;
class FilesystemServiceProvider implements ServiceProviderInterface class FilesystemServiceProvider implements ServiceProviderInterface
{ {

View File

@@ -11,11 +11,13 @@
namespace Alchemy\Phrasea\Filesystem; namespace Alchemy\Phrasea\Filesystem;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Exception\ExceptionInterface; use MediaAlchemyst\Exception\ExceptionInterface;
use MediaAlchemyst\Specification\Image as ImageSpecification; use MediaAlchemyst\Specification\Image as ImageSpecification;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem; // use Symfony\Component\Filesystem\Filesystem;
class LazaretFilesystemService class LazaretFilesystemService
{ {

View File

@@ -10,8 +10,11 @@
namespace Alchemy\Phrasea\Filesystem; namespace Alchemy\Phrasea\Filesystem;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class LazaretPathBooker class LazaretPathBooker
{ {

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Filesystem;
class PhraseanetFilesystem extends \Symfony\Component\Filesystem\Filesystem
{
}

View File

@@ -11,8 +11,9 @@
namespace Alchemy\Phrasea\Http\StaticFile\Symlink; namespace Alchemy\Phrasea\Http\StaticFile\Symlink;
use Silex\Application; use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
/** /**
* Create & retrieve symlinks * Create & retrieve symlinks

View File

@@ -13,6 +13,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border; use Alchemy\Phrasea\Border;
use Alchemy\Phrasea\Border\Attribute\AttributeInterface; use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
use Alchemy\Phrasea\Border\Attribute\MetaField; use Alchemy\Phrasea\Border\Attribute\MetaField;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\WorkerManager\Event\RecordsWriteMetaEvent; use Alchemy\Phrasea\WorkerManager\Event\RecordsWriteMetaEvent;
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents; use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
@@ -20,7 +21,8 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use PHPExiftool\Driver\Metadata\Metadata; use PHPExiftool\Driver\Metadata\Metadata;
use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class LazaretManipulator class LazaretManipulator

View File

@@ -11,10 +11,12 @@
namespace Alchemy\Phrasea\Plugin\Importer; namespace Alchemy\Phrasea\Plugin\Importer;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Plugin\Exception\ImportFailureException; use Alchemy\Phrasea\Plugin\Exception\ImportFailureException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\ExceptionInterface as FsException; use Symfony\Component\Filesystem\Exception\ExceptionInterface as FsException;
// use Symfony\Component\Filesystem\Filesystem;
class FolderImporter implements ImporterInterface class FolderImporter implements ImporterInterface
{ {
private $fs; private $fs;

View File

@@ -12,10 +12,12 @@
namespace Alchemy\Phrasea\Plugin\Management; namespace Alchemy\Phrasea\Plugin\Management;
use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Plugin\Schema\Manifest; use Alchemy\Phrasea\Plugin\Schema\Manifest;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\IOException;
// use Symfony\Component\Filesystem\Filesystem;
/** /**
* Manages plugins assets * Manages plugins assets
*/ */

View File

@@ -9,9 +9,10 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Field;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\MetadataHelper; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\MetadataHelper;
// use Alchemy\Phrasea\Utilities\Stopwatch;
use databox; use databox;
// use Alchemy\Phrasea\Utilities\Stopwatch;
class SearchEngineStructure class SearchEngineStructure
{ {
@@ -27,6 +28,19 @@ class SearchEngineStructure
$this->cache = $cache; $this->cache = $cache;
} }
/**
* @param databox[] $databoxes
*/
public function getGlobalStructureConflictsFromDataboxes(array $databoxes)
{
$fieldsByName = [];
foreach ($databoxes as $databox) {
foreach ($databox->get_meta_structure() as $fieldStructure) {
$name = $fieldStructure->get_name();
}
}
}
/** /**
* @param databox[] $databoxes * @param databox[] $databoxes
* *

View File

@@ -11,7 +11,9 @@
namespace Alchemy\Phrasea\Status; namespace Alchemy\Phrasea\Status;
use Symfony\Component\Filesystem\Filesystem; // use Symfony\Component\Filesystem\Filesystem;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
/** /**
* Provides status structure definition from XML * Provides status structure definition from XML

View File

@@ -17,14 +17,16 @@ use Alchemy\Phrasea\Core\LazyLocator;
use Alchemy\Phrasea\Core\Version\AppboxVersionRepository; use Alchemy\Phrasea\Core\Version\AppboxVersionRepository;
use Alchemy\Phrasea\Databox\DataboxConnectionProvider; use Alchemy\Phrasea\Databox\DataboxConnectionProvider;
use Alchemy\Phrasea\Databox\DataboxRepository; use Alchemy\Phrasea\Databox\DataboxRepository;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\SchemaTool;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use vierbergenlars\SemVer\version; use vierbergenlars\SemVer\version;
// use Symfony\Component\Filesystem\Filesystem;
class appbox extends base class appbox extends base
{ {
/** /**

View File

@@ -10,10 +10,9 @@
*/ */
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
class module_console_systemClearCache extends Command class module_console_systemClearCache extends Command
{ {

View File

@@ -10,8 +10,11 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class patch_384alpha2a implements patchInterface class patch_384alpha2a implements patchInterface
{ {

View File

@@ -10,8 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_386alpha3a implements patchInterface class patch_386alpha3a implements patchInterface
{ {

View File

@@ -10,8 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_386alpha4a implements patchInterface class patch_386alpha4a implements patchInterface
{ {

View File

@@ -9,6 +9,7 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Model\Entities\Token; use Alchemy\Phrasea\Model\Entities\Token;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Repositories\BasketRepository; use Alchemy\Phrasea\Model\Repositories\BasketRepository;
@@ -17,7 +18,8 @@ use Alchemy\Phrasea\Model\Serializer\CaptionSerializer;
use Alchemy\Phrasea\Out\Module\PDFCgu; use Alchemy\Phrasea\Out\Module\PDFCgu;
use Assert\Assertion; use Assert\Assertion;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class set_export extends set_abstract class set_export extends set_abstract

View File

@@ -45,7 +45,7 @@ class PluginCommandTestCase extends \PhraseanetTestCase
protected function createFilesystemMock() protected function createFilesystemMock()
{ {
return $this->getMockBuilder('Symfony\Component\Filesystem\Filesystem') return $this->getMockBuilder('Alchemy\Phrasea\Filesystem\PhraseanetFilesystem')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
} }

View File

@@ -20,7 +20,7 @@ class PluginResetTest extends \PhraseanetTestCase
$capturedSource = null; $capturedSource = null;
self::$DI['cli']['filesystem'] = $this->getMockBuilder('Symfony\Component\Filesystem\Filesystem') self::$DI['cli']['filesystem'] = $this->getMockBuilder('Alchemy\Phrasea\Filesystem\PhraseanetFilesystem')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
self::$DI['cli']['filesystem']->expects($this->once()) self::$DI['cli']['filesystem']->expects($this->once())

View File

@@ -11,8 +11,11 @@
namespace Alchemy\Tests\Phrasea\Filesystem; namespace Alchemy\Tests\Phrasea\Filesystem;
use Alchemy\Phrasea\Filesystem\FilesystemService; use Alchemy\Phrasea\Filesystem\FilesystemService;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Model\RecordInterface; use Alchemy\Phrasea\Model\RecordInterface;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class FilesystemServiceTest extends \PHPUnit_Framework_TestCase class FilesystemServiceTest extends \PHPUnit_Framework_TestCase
{ {

View File

@@ -11,9 +11,12 @@
namespace Alchemy\Tests\Phrasea\Filesystem; namespace Alchemy\Tests\Phrasea\Filesystem;
use Alchemy\Phrasea\Filesystem\LazaretPathBooker; use Alchemy\Phrasea\Filesystem\LazaretPathBooker;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory; use org\bovigo\vfs\vfsStreamDirectory;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
class LazaretPathBookerTest extends \PHPUnit_Framework_TestCase class LazaretPathBookerTest extends \PHPUnit_Framework_TestCase
{ {

View File

@@ -95,7 +95,7 @@ class AssetsManagerTest extends \PhraseanetTestCase
private function getFilesystemMock() private function getFilesystemMock()
{ {
return $this->getMockBuilder('Symfony\Component\Filesystem\Filesystem') return $this->getMockBuilder('Alchemy\Phrasea\Filesystem\PhraseanetFilesystem')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
} }

View File

@@ -2,11 +2,14 @@
namespace Alchemy\Tests\Phrasea\Plugin\Management; namespace Alchemy\Tests\Phrasea\Plugin\Management;
use Alchemy\Phrasea\Filesystem\PhraseanetFilesystem as Filesystem;
use Alchemy\Phrasea\Plugin\Management\ComposerInstaller; use Alchemy\Phrasea\Plugin\Management\ComposerInstaller;
use Alchemy\Phrasea\Utilities\ComposerSetup; use Alchemy\Phrasea\Utilities\ComposerSetup;
use Guzzle\Http\Client as Guzzle; use Guzzle\Http\Client as Guzzle;
use Symfony\Component\Process\ExecutableFinder; use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Filesystem\Filesystem;
// use Symfony\Component\Filesystem\Filesystem;
/** /**
* @group functional * @group functional

View File

@@ -22,7 +22,7 @@ class PluginTestCase extends \PhraseanetTestCase
protected function createFilesystemMock() protected function createFilesystemMock()
{ {
return $this->getMock('Symfony\Component\Filesystem\Filesystem'); return $this->getMock('Alchemy\Phrasea\Filesystem\PhraseanetFilesystem');
} }
protected function getSchema() protected function getSchema()