Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for deleting packages. #296

Merged
merged 2 commits into from

3 participants

@HenrikWM

Added support for deleting packages via CLI / PHP with ezpm.php.

@andrerom
Owner

Cool, would almost think you had worked on this part before :)

ezpm.php
@@ -1028,6 +1041,17 @@ function resetCommandItem()
$alreadyCreated = true;
$createdPackages[$commandItem['name']] =& $package;
}
+ else if ( $command == 'delete' )
+ {
+ $package = eZPackage::fetch( $commandItem['name'] );
+ if ( $package )
+ {
+ $package->remove();
+ $cli->error( "Package " . $commandItem['name'] . " deleted." );
@andrerom Owner

Shouldn't this use $cli->output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@andrerom
Owner

Thanks, have you signed a cla btw? Could not find one from you or your company.
ref: http://share.ez.no/community-project/contributor-licensing-agreement-cla

@HenrikWM

I will mostly contribute small bugfixes and minor improvements when I can, and according to the CLA-page as long as I just contribute minor fixes we don't need to sign it. Correct?

I've sent a signed CLA anyways though :)

@andrerom
Owner

according to the CLA-page as long as I just contribute minor fixes we don't need to sign it. Correct?

Yes, but the line between what size is small enough to avoid having to do a CLA has always been a bit blurry to me :)
@nfrp Do you happen to know any rule of thumb on this?

I've sent a signed CLA anyways though :)

Thanks :)

@nfrp

Thanks @HenrikWM, CLA properly received. I will send it back to you, signed-back.
General rule : CLAs preferred, for any contribution.

Thanks again for your contribution, and the future ones : keep them coming ! :)

@andrerom andrerom merged commit c4cdf9a into ezsystems:master
@andrerom
Owner

Merged, thanks Henrik!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2012
  1. Added support for deleting packages.

    HenrikWM authored
Commits on Feb 29, 2012
  1. Use $cli->output instead of $cli->notice

    Henrik W. M. authored
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 1 deletion.
  1. +25 −1 ezpm.php
View
26 ezpm.php
@@ -174,7 +174,7 @@ function helpHelp()
" export\n" .
" add\n" .
" set\n" .
-// " delete (del, remove, rm)\n" .
+ " delete (del, remove, rm)\n" .
" list\n" .
" info\n"
);
@@ -572,6 +572,11 @@ function resetCommandItem()
$commandItem['export-directory'] = $argv[$i];
}
}
+ else if ( $commandItem['command'] == 'delete' )
+ {
+ if ( $commandItem['name'] === false )
+ $commandItem['name'] = $arg;
+ }
}
}
}
@@ -656,6 +661,14 @@ function resetCommandItem()
helpHelp();
exit( 1 );
}
+ else if ( $commandItem['command'] == 'delete' )
+ {
+ if ( !$commandItem['name'] )
+ {
+ helpDelete();
+ exit( 1 );
+ }
+ }
else
{
help();
@@ -1028,6 +1041,17 @@ function resetCommandItem()
$alreadyCreated = true;
$createdPackages[$commandItem['name']] =& $package;
}
+ else if ( $command == 'delete' )
+ {
+ $package = eZPackage::fetch( $commandItem['name'] );
+ if ( $package )
+ {
+ $package->remove();
+ $cli->output( "Package " . $commandItem['name'] . " deleted." );
+ }
+ else
+ $cli->error( "Could not open package " . $commandItem['name'] );
+ }
}
$cli->output();
Something went wrong with that request. Please try again.