Skip to content

Commit

Permalink
Merge pull request #3241 from bolt/refactor/webmozart/path-util
Browse files Browse the repository at this point in the history
Replace deprecated `webmozart/path-util` for `symfony/filesystem`
  • Loading branch information
bobdenotter authored Jun 17, 2022
2 parents 4d5b64e + 4cc577a commit 6b90d56
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 22 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"twig/twig": "^3.3",
"ua-parser/uap-php": "^3.9",
"webimpress/safe-writer": "^2.1",
"webmozart/path-util": "^2.3",
"webonyx/graphql-php": "^14.9",
"xemlock/htmlpurifier-html5": "^0.1.11"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionsConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Webmozart\PathUtil\Path;
use Symfony\Component\Filesystem\Path;

class ExtensionsConfigureCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ServerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Process\Process;
use Webmozart\PathUtil\Path;

class ServerCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/PathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Bolt\Configuration;

use Bolt\Exception\ConfigurationException;
use Symfony\Component\Filesystem\Path;
use Tightenco\Collect\Support\Collection;
use Webmozart\PathUtil\Path;

/**
* A class to resolve and manage paths. Paths defined here are allowed to have variables within them.
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Backend/Async/FileListingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use Bolt\Configuration\Config;
use Bolt\Utils\FilesIndex;
use Bolt\Utils\PathCanonicalize;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Webmozart\PathUtil\Path;

class FileListingController implements AsyncZoneInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Backend/Async/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Sirius\Upload\Result\ResultInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\FileBag;
Expand All @@ -27,7 +28,6 @@
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
use Throwable;
use Webmozart\PathUtil\Path;

/**
* @Security("is_granted('upload')")
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Backend/FileEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Bolt\Utils\PathCanonicalize;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -20,7 +21,6 @@
use Symfony\Component\Yaml\Yaml;
use Webimpress\SafeWriter\Exception\ExceptionInterface;
use Webimpress\SafeWriter\FileWriter;
use Webmozart\PathUtil\Path;

class FileEditController extends TwigAwareController implements BackendZoneInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Backend/FilemanagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
use Pagerfanta\Pagerfanta;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
use Webmozart\PathUtil\Path;

class FilemanagerController extends TwigAwareController implements BackendZoneInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Backend/MediaEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Bolt\Factory\MediaFactory;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Webmozart\PathUtil\Path;

/**
* @Security("is_granted('media_edit')")
Expand Down Expand Up @@ -100,7 +100,7 @@ public function new(): RedirectResponse
$filename = $basepath . $file;

$relPath = Path::getDirectory('/' . $file);
$relName = Path::getFilename($file);
$relName = basename($file);

$file = new SplFileInfo($filename, $relPath, $relName);

Expand Down
2 changes: 1 addition & 1 deletion src/DataFixtures/BaseFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace Bolt\DataFixtures;

use Doctrine\Bundle\FixturesBundle\Fixture;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Finder\Finder;
use Tightenco\Collect\Support\Collection;
use Webmozart\PathUtil\Path;

abstract class BaseFixture extends Fixture
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Bolt\Entity;

use Doctrine\ORM\Mapping as ORM;
use Webmozart\PathUtil\Path;
use Symfony\Component\Filesystem\Path;

/**
* @ORM\Entity(repositoryClass="Bolt\Repository\MediaRepository")
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/ExtensionCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use ComposerPackages\Types;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Yaml\Yaml;
use Webmozart\PathUtil\Path;

class ExtensionCompilerPass implements CompilerPassInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/MediaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Carbon\Carbon;
use PHPExif\Exif;
use PHPExif\Reader\Reader;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Tightenco\Collect\Support\Collection;
use Webmozart\PathUtil\Path;

class MediaFactory
{
Expand Down
2 changes: 1 addition & 1 deletion src/Log/RequestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Bolt\Log;

use Bolt\Entity\User;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Security\Core\Security;
use Webmozart\PathUtil\Path;

class RequestProcessor
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/MediaRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Bolt\Entity\Media;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Webmozart\PathUtil\Path;
use Symfony\Component\Filesystem\Path;

/**
* @method Media|null find($id, $lockMode = null, $lockVersion = null)
Expand Down Expand Up @@ -56,7 +56,7 @@ public function findOneByFullFilename(string $fullFileName, string $location = '
$criteria = [
'location' => $location,
'path' => Path::getDirectory($fullFileName),
'filename' => Path::getFilename($fullFileName),
'filename' => basename($fullFileName),
];

return $this->findOneBy($criteria);
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/FilesIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Bolt\Utils;

use Bolt\Configuration\Config;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Finder\Finder;
use Tightenco\Collect\Support\Collection;
use Webmozart\PathUtil\Path;

class FilesIndex
{
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/PathCanonicalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bolt\Utils;

use Webmozart\PathUtil\Path;
use Symfony\Component\Filesystem\Path;

class PathCanonicalize
{
Expand Down
3 changes: 0 additions & 3 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,6 @@
"webmozart/assert": {
"version": "1.7.0"
},
"webmozart/path-util": {
"version": "2.3.0"
},
"webonyx/graphql-php": {
"version": "v0.13.8"
},
Expand Down

0 comments on commit 6b90d56

Please sign in to comment.