@@ -76,34 +76,27 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
7676 $ repo ->addPackage (clone $ package );
7777 }
7878
79- //ME Code ----
79+ // Devbr install code:
8080 $ appConfig = $ this ->phpDir .'/Config ' ;
8181 $ publicWeb = dirname ($ this ->phpDir );
8282 $ appAssets = $ publicWeb .'/ ' .strtolower ($ this ->packName );
8383
8484 $ packConfig = $ downloadPath .'/Config ' ;
8585 $ packAssets = $ downloadPath .'/Assets ' ;
8686
87- echo "\n\n\tPackConfig: $ packConfig \n\tAppConfig: $ appConfig \n\tPublicPath: $ publicWeb " ;
88-
87+ // Move Configurations...
8988 if (file_exists ($ packConfig ) && is_readable ($ packConfig )){
90- echo "\n\t--- Config exists --- \n" ;
9189 self ::checkAndOrCreateDir ($ appConfig , true );
9290 self ::copyDirectoryContents ($ packConfig , $ appConfig );
93- } else {
94- echo "\n\t--- Config Not Exists!! --- \n" ;
91+ self ::removeDirectory ($ packConfig );
9592 }
9693
97- //Copy ASSETS
94+ // Move Assets...
9895 if (file_exists ($ packAssets ) && is_readable ($ packAssets )){
99- echo "\n\t--- Assets exists --- \n" ;
10096 self ::checkAndOrCreateDir ($ appAssets , true );
10197 self ::copyDirectoryContents ($ packAssets , $ appAssets );
102- } else {
103- echo "\n\t--- Assets Not Exists!! --- \n" ;
98+ self ::removeDirectory ($ packAssets );
10499 }
105-
106-
107100 }
108101
109102
@@ -178,4 +171,30 @@ static private function copyDirectoryContents($dir, $target, $overwrite = true,
178171 }
179172 return $ report ;
180173 }
174+
175+
176+ /**
177+ * Remove Directory
178+ *
179+ * @param string $src pack of directory to remove
180+ *
181+ * @return void void
182+ */
183+ static private function removeDirectory ($ src )
184+ {
185+ $ dir = opendir ($ src );
186+ while (false !== ( $ file = readdir ($ dir )) ) {
187+ if ($ file != '. ' && $ file != '.. ' ) {
188+ $ full = $ src . '/ ' . $ file ;
189+
190+ if ( is_dir ($ full ) ) {
191+ self ::removeDirectory ($ full );
192+ } else {
193+ unlink ($ full );
194+ }
195+ }
196+ }
197+ closedir ($ dir );
198+ rmdir ($ src );
199+ }
181200}
0 commit comments