Bläddra i källkod

[FrameworkBundle] registered FileSystem as a service, switched commands to use it

Bulat Shakirzyanov 14 år sedan
förälder
incheckning
3a6f556189

+ 1 - 2
src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

@@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Output\Output;
-use Symfony\Bundle\FrameworkBundle\Util\Filesystem;
 
 /*
  * This file is part of the Symfony framework.
@@ -50,7 +49,7 @@ class AssetsInstallCommand extends Command
             throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
         }
 
-        $filesystem = new Filesystem();
+        $filesystem = $this->container->get('filesystem');
 
         // Create the bundles directory otherwise symlink will fail.
         $filesystem->mkdirs($input->getArgument('target').'/bundles/', 0777);

+ 1 - 2
src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php

@@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Output\Output;
-use Symfony\Bundle\FrameworkBundle\Util\Filesystem;
 use Symfony\Bundle\FrameworkBundle\Util\Mustache;
 
 /*
@@ -71,7 +70,7 @@ class InitBundleCommand extends Command
             throw new \RuntimeException(sprintf('Bundle "%s" already exists.', $bundle));
         }
 
-        $filesystem = new Filesystem();
+        $filesystem = $this->container->get('filesystem');
         $filesystem->mirror(__DIR__.'/../Resources/skeleton/bundle', $targetDir);
 
         Mustache::renderDir($targetDir, array(

+ 3 - 0
src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

@@ -10,6 +10,7 @@
         <parameter key="response.class">Symfony\Component\HttpFoundation\Response</parameter>
         <parameter key="error_handler.class">Symfony\Component\HttpKernel\Debug\ErrorHandler</parameter>
         <parameter key="error_handler.level">null</parameter>
+        <parameter key="filesystem.class">Symfony\Bundle\FrameworkBundle\Util\FileSystem</parameter>
     </parameters>
 
     <services>
@@ -37,5 +38,7 @@
                 <argument>%kernel.charset%</argument>
             </call>
         </service>
+
+        <service id="filesystem" class="%filesystem.class%"></service>
     </services>
 </container>