archiver.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @file
  4. * Shared classes and interfaces for the archiver system.
  5. */
  6. /**
  7. * Defines the common interface for all Archiver classes.
  8. */
  9. interface ArchiverInterface {
  10. /**
  11. * Constructs a new archiver instance.
  12. *
  13. * @param $file_path
  14. * The full system path of the archive to manipulate. Only local files
  15. * are supported. If the file does not yet exist, it will be created if
  16. * appropriate.
  17. */
  18. public function __construct($file_path);
  19. /**
  20. * Adds the specified file or directory to the archive.
  21. *
  22. * @param $file_path
  23. * The full system path of the file or directory to add. Only local files
  24. * and directories are supported.
  25. *
  26. * @return ArchiverInterface
  27. * The called object.
  28. */
  29. public function add($file_path);
  30. /**
  31. * Removes the specified file from the archive.
  32. *
  33. * @param $path
  34. * The file name relative to the root of the archive to remove.
  35. *
  36. * @return ArchiverInterface
  37. * The called object.
  38. */
  39. public function remove($path);
  40. /**
  41. * Extracts multiple files in the archive to the specified path.
  42. *
  43. * @param $path
  44. * A full system path of the directory to which to extract files.
  45. * @param $files
  46. * Optionally specify a list of files to be extracted. Files are
  47. * relative to the root of the archive. If not specified, all files
  48. * in the archive will be extracted.
  49. *
  50. * @return ArchiverInterface
  51. * The called object.
  52. */
  53. public function extract($path, array $files = array());
  54. /**
  55. * Lists all files in the archive.
  56. *
  57. * @return
  58. * An array of file names relative to the root of the archive.
  59. */
  60. public function listContents();
  61. }