summaryrefslogtreecommitdiffstats
path: root/lib/private/archive
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/archive')
-rw-r--r--lib/private/archive/tar.php41
-rw-r--r--lib/private/archive/zip.php44
2 files changed, 48 insertions, 37 deletions
diff --git a/lib/private/archive/tar.php b/lib/private/archive/tar.php
index a1c0535b1c3..cbdb565ba35 100644
--- a/lib/private/archive/tar.php
+++ b/lib/private/archive/tar.php
@@ -22,6 +22,9 @@ class OC_Archive_TAR extends OC_Archive{
private $tar=null;
private $path;
+ /**
+ * @param string $source
+ */
function __construct($source) {
$types=array(null, 'gz', 'bz');
$this->path=$source;
@@ -30,8 +33,8 @@ class OC_Archive_TAR extends OC_Archive{
/**
* try to detect the type of tar compression
- * @param string file
- * @return str
+ * @param string $file
+ * @return integer
*/
static public function getTarType($file) {
if(strpos($file, '.')) {
@@ -53,7 +56,7 @@ class OC_Archive_TAR extends OC_Archive{
/**
* add an empty folder to the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function addFolder($path) {
@@ -80,8 +83,8 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* add a file to the archive
- * @param string path
- * @param string source either a local file or string data
+ * @param string $path
+ * @param string $source either a local file or string data
* @return bool
*/
function addFile($path, $source='') {
@@ -103,8 +106,8 @@ class OC_Archive_TAR extends OC_Archive{
/**
* rename a file or folder in the archive
- * @param string source
- * @param string dest
+ * @param string $source
+ * @param string $dest
* @return bool
*/
function rename($source, $dest) {
@@ -122,6 +125,9 @@ class OC_Archive_TAR extends OC_Archive{
return true;
}
+ /**
+ * @param string $file
+ */
private function getHeader($file) {
if ( ! $this->cachedHeaders ) {
$this->cachedHeaders = $this->tar->listContent();
@@ -139,7 +145,7 @@ class OC_Archive_TAR extends OC_Archive{
/**
* get the uncompressed size of a file in the archive
- * @param string path
+ * @param string $path
* @return int
*/
function filesize($path) {
@@ -158,7 +164,7 @@ class OC_Archive_TAR extends OC_Archive{
/**
* get the files in a folder
- * @param path
+ * @param string $path
* @return array
*/
function getFolder($path) {
@@ -201,7 +207,7 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* get the content of a file
- * @param string path
+ * @param string $path
* @return string
*/
function getFile($path) {
@@ -209,8 +215,8 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* extract a single file from the archive
- * @param string path
- * @param string dest
+ * @param string $path
+ * @param string $dest
* @return bool
*/
function extractFile($path, $dest) {
@@ -231,8 +237,7 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* extract the archive
- * @param string path
- * @param string dest
+ * @param string $dest
* @return bool
*/
function extract($dest) {
@@ -240,7 +245,7 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* check if a file or folder exists in the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function fileExists($path) {
@@ -268,7 +273,7 @@ class OC_Archive_TAR extends OC_Archive{
/**
* remove a file or folder from the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function remove($path) {
@@ -289,8 +294,8 @@ class OC_Archive_TAR extends OC_Archive{
}
/**
* get a file handler
- * @param string path
- * @param string mode
+ * @param string $path
+ * @param string $mode
* @return resource
*/
function getStream($path, $mode) {
diff --git a/lib/private/archive/zip.php b/lib/private/archive/zip.php
index 8a866716a79..fa5630d7665 100644
--- a/lib/private/archive/zip.php
+++ b/lib/private/archive/zip.php
@@ -13,6 +13,9 @@ class OC_Archive_ZIP extends OC_Archive{
private $zip=null;
private $path;
+ /**
+ * @param string $source
+ */
function __construct($source) {
$this->path=$source;
$this->zip=new ZipArchive();
@@ -23,7 +26,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* add an empty folder to the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function addFolder($path) {
@@ -31,8 +34,8 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* add a file to the archive
- * @param string path
- * @param string source either a local file or string data
+ * @param string $path
+ * @param string $source either a local file or string data
* @return bool
*/
function addFile($path, $source='') {
@@ -49,9 +52,9 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* rename a file or folder in the archive
- * @param string source
- * @param string dest
- * @return bool
+ * @param string $source
+ * @param string $dest
+ * @return boolean|null
*/
function rename($source, $dest) {
$source=$this->stripPath($source);
@@ -60,7 +63,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* get the uncompressed size of a file in the archive
- * @param string path
+ * @param string $path
* @return int
*/
function filesize($path) {
@@ -69,7 +72,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* get the last modified time of a file in the archive
- * @param string path
+ * @param string $path
* @return int
*/
function mtime($path) {
@@ -77,7 +80,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* get the files in a folder
- * @param path
+ * @param string $path
* @return array
*/
function getFolder($path) {
@@ -107,7 +110,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* get the content of a file
- * @param string path
+ * @param string $path
* @return string
*/
function getFile($path) {
@@ -115,9 +118,9 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* extract a single file from the archive
- * @param string path
- * @param string dest
- * @return bool
+ * @param string $path
+ * @param string $dest
+ * @return boolean|null
*/
function extractFile($path, $dest) {
$fp = $this->zip->getStream($path);
@@ -125,8 +128,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* extract the archive
- * @param string path
- * @param string dest
+ * @param string $dest
* @return bool
*/
function extract($dest) {
@@ -134,7 +136,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* check if a file or folder exists in the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function fileExists($path) {
@@ -142,7 +144,7 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* remove a file or folder from the archive
- * @param string path
+ * @param string $path
* @return bool
*/
function remove($path) {
@@ -154,8 +156,8 @@ class OC_Archive_ZIP extends OC_Archive{
}
/**
* get a file handler
- * @param string path
- * @param string mode
+ * @param string $path
+ * @param string $mode
* @return resource
*/
function getStream($path, $mode) {
@@ -191,6 +193,10 @@ class OC_Archive_ZIP extends OC_Archive{
}
}
+ /**
+ * @param string $path
+ * @return string
+ */
private function stripPath($path) {
if(!$path || $path[0]=='/') {
return substr($path, 1);