2323include_once 'phing/util/SourceFileScanner.php ' ;
2424include_once 'phing/mappers/MergeMapper.php ' ;
2525include_once 'phing/util/StringHelper.php ' ;
26- include_once 'phing/lib/Zip .php ' ;
26+ include_once 'phing/lib/Zip_Archive .php ' ;
2727
2828/**
2929 * Creates a zip archive using PEAR Archive_Zip (which is presently unreleased
3535 * @since 2.1.0
3636 */
3737class ZipTask extends MatchingTask {
38-
38+
3939 private $ zipFile ;
4040 private $ baseDir ;
4141
@@ -73,7 +73,7 @@ public function setBasedir(PhingFile $baseDir) {
7373 * @throws BuildException
7474 */
7575 public function main () {
76-
76+
7777 if ($ this ->zipFile === null ) {
7878 throw new BuildException ("zipfile attribute must be set! " , $ this ->getLocation ());
7979 }
@@ -89,7 +89,7 @@ public function main() {
8989 // shouldn't need to clone, since the entries in filesets
9090 // themselves won't be modified -- only elements will be added
9191 $ savedFileSets = $ this ->filesets ;
92-
92+
9393 try {
9494 if ($ this ->baseDir !== null ) {
9595 if (!$ this ->baseDir ->exists ()) {
@@ -106,8 +106,8 @@ public function main() {
106106 throw new BuildException ("You must supply either a basedir "
107107 . "attribute or some nested filesets. " ,
108108 $ this ->getLocation ());
109- }
110-
109+ }
110+
111111 // check if zip is out of date with respect to each
112112 // fileset
113113 $ upToDate = true ;
@@ -123,21 +123,21 @@ public function main() {
123123 }
124124 }
125125 }
126-
126+
127127 if ($ upToDate ) {
128128 $ this ->log ("Nothing to do: " . $ this ->zipFile ->__toString () . " is up to date. " , PROJECT_MSG_INFO );
129129 return ;
130130 }
131131
132132 $ this ->log ("Building zip: " . $ this ->zipFile ->__toString (), PROJECT_MSG_INFO );
133-
133+
134134 $ zip = new Archive_Zip ($ this ->zipFile ->getAbsolutePath ());
135-
136- foreach ($ this ->filesets as $ fs ) {
135+
136+ foreach ($ this ->filesets as $ fs ) {
137137 $ ds = $ fs ->getDirectoryScanner ($ this ->project );
138138 $ files = $ ds ->getIncludedFiles ();
139139
140- // FIXME
140+ // FIXME
141141 // Current model is only adding directories implicitly. This
142142 // won't add any empty directories. Perhaps modify FileSet::getFiles()
143143 // to also include empty directories. Not high priority, since non-inclusion
@@ -146,21 +146,21 @@ public function main() {
146146 $ filesToZip = array ();
147147 for ($ i =0 , $ fcount =count ($ files ); $ i < $ fcount ; $ i ++) {
148148 $ f = new PhingFile ($ fsBasedir , $ files [$ i ]);
149- $ filesToZip [] = $ f ->getAbsolutePath ();
149+ $ filesToZip [] = $ f ->getAbsolutePath ();
150150 }
151151 $ zip ->add ($ filesToZip , array ('remove_path ' => $ fsBasedir ->getCanonicalPath ()));
152152 }
153-
154-
153+
154+
155155 } catch (IOException $ ioe ) {
156156 $ msg = "Problem creating ZIP: " . $ ioe ->getMessage ();
157157 $ this ->filesets = $ savedFileSets ;
158158 throw new BuildException ($ msg , $ ioe , $ this ->getLocation ());
159159 }
160-
160+
161161 $ this ->filesets = $ savedFileSets ;
162162 }
163-
163+
164164 /**
165165 * @param array $files array of filenames
166166 * @param PhingFile $dir
@@ -172,5 +172,5 @@ protected function archiveIsUpToDate($files, $dir) {
172172 $ mm ->setTo ($ this ->zipFile ->getAbsolutePath ());
173173 return count ($ sfs ->restrict ($ files , $ dir , null , $ mm )) == 0 ;
174174 }
175-
175+
176176}
0 commit comments