3636 *
3737 * @author Daniel Barsotti <daniel.barsotti@liip.ch>
3838 */
39- class PurgeCommand extends Command
39+ class NodeRemoveCommand extends Command
4040{
4141 /**
4242 * {@inheritDoc}
@@ -46,13 +46,22 @@ protected function configure()
4646 parent ::configure ();
4747
4848 $ this
49- ->setName ('phpcr:purge ' )
49+ ->setName ('phpcr:node:remove ' )
5050 ->setDescription ('Remove content from the repository ' )
5151 ->addArgument ('path ' , InputArgument::OPTIONAL , 'Path of the node to purge ' , '/ ' )
5252 ->addOption ('force ' , null , InputOption::VALUE_NONE , 'Use to bypass the confirmation dialog ' )
5353 ->addOption ('only-children ' , null , InputOption::VALUE_NONE , 'Use to only purge children of specified path ' )
5454 ->setHelp (<<<EOF
55- The <info>phpcr:purge</info> command remove all the non-standard nodes from the content repository
55+ The <info>phpcr:node:remove</info> command will remove the given node or the
56+ children of the given node according to the options given.
57+
58+ Remove specified node and its children:
59+
60+ $ php bin/phpcr phpcr:node:remove /cms/content/blog
61+
62+ Remove only the children of the specified node
63+
64+ $ php bin/phpcr phpcr:node:remove /cms/content/blog --only-children
5665EOF
5766 )
5867 ;
@@ -89,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8998 }
9099
91100 if ($ force ) {
92- $ message = '<comment>></comment> <info>Purging: </info> %s ' ;
101+ $ message = '<comment>></comment> <info>Purging: </info>%s ' ;
93102
94103 if ($ onlyChildren ) {
95104 $ baseNode = $ session ->getNode ($ path , 0 );
@@ -102,7 +111,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
102111 $ output ->writeln (sprintf ($ message , $ path ));
103112
104113 if ('/ ' === $ path ) {
105- NodeHelper::purgeWorkspace ($ this ->getHelper ('phpcr ' )->getSession ());
114+ throw new \Exception (
115+ 'Will not purge path entire workspace ("/"), use the ' .
116+ 'workspace:purge method instead. '
117+ );
106118 } else {
107119 $ session ->removeItem ($ path );
108120 }
0 commit comments