Changeset 12798
- Timestamp:
- 10/13/11 12:57:54 (2 years ago)
- Files:
-
- modules/branches/2.10/package.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10/package.php
r12795 r12798 99 99 $ver = 100 100 $x = ''; 101 $file_scan_exclude_list = array(); 101 102 102 103 echo 'Packaging ' . $mod . '...' . PHP_EOL; … … 114 115 continue; 115 116 } 117 // Run xml script through the exact method that FreePBX currently uses. There have 118 // been cases where XML is valid but this method still fails so it won't be caught 119 // with the proper XML checer, better here then breaking the online repository 120 // 121 include_once('xml2Array.class.php'); 122 $parser = new xml2ModuleArray($xml); 123 $xmlarray = $parser->parseAdvanced($xml); 116 124 117 125 //include module specifc hook, if present … … 150 158 //check php files for syntax errors 151 159 $bail = false; 152 $files = scandirr($mod, true );160 $files = scandirr($mod, true, $file_scan_exclude_list); 153 161 foreach ($files as $f) { 154 162 if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { … … 188 196 189 197 //update md5 sum 190 list($md5) = preg_split('/\s+/', run_cmd($vars['md5'] . ' ' . $filename)); 191 run_cmd('sed -i "s|<md5sum>.*</md5sum>|<md5sum>' . $md5 . '</md5sum>|" ' 192 . $mod . '/module.xml'); 198 $module_xml = file_get_contents($mod . '/' . 'module.xml'); 199 if(file_exists($filename)) { 200 $md5 = md5_file($filename); 201 $module_xml = preg_replace('/<md5sum>(.*)<\/md5sum>/i','<md5sum>'.$md5.'</md5sum>',$module_xml); 202 } else { 203 echo "No Tarball Package found (in debug mode?)" . PHP_EOL; 204 } 193 205 194 206 //update location 195 run_cmd('sed -i "s|<location>.*</location>|<location>release/' . $vars['rver'] . '/' . $filename . '</location>|" ' 196 . $mod . '/module.xml'); 207 if(file_exists($filename)) { 208 $module_xml = preg_replace('/<location>(.*)<\/location>/i','<location>' . $vars['rver'] . '/' . $filename . '</location>',$module_xml); 209 } 210 211 file_put_contents($mod . '/' . 'module.xml', $module_xml); 212 197 213 198 214 //move tarbal to relase dir … … 229 245 * 230 246 * @pram string - directory to scan 231 * @pram strin - retirn absolute paths 247 * @pram string - return absolute paths 248 * @pram array - list of excluded files/directories to ignore 232 249 * @returns array 233 250 * 234 251 * @author Moshe Brevda mbrevda => gmail ~ com 235 252 */ 236 function scandirr($dir, $absolute = false ) {253 function scandirr($dir, $absolute = false, $exclude_list=array()) { 237 254 $list = array(); 238 255 if ($absolute) { … … 242 259 243 260 //get directory contents 261 if (!empty($exclude_list) && in_array(basename($dir), $exclude_list)) { 262 return $list; 263 } 244 264 foreach (scandir($dir) as $d) { 245 265 246 266 //ignore any of the files in the array 247 if (in_array($d, array('.', '..' ))) {267 if (in_array($d, array('.', '..', '.svn')) || (!empty($exclude_list) && in_array($d, $exclude_list))) { 248 268 continue; 249 269 } … … 252 272 if (is_dir($dir . '/' . $d)) { 253 273 if ($absolute) { 254 scandirr($dir . '/' . $d, $absolute );274 scandirr($dir . '/' . $d, $absolute, $exclude_list); 255 275 } else { 256 $list[$d] = scandirr($dir . '/' . $d, $absolute );276 $list[$d] = scandirr($dir . '/' . $d, $absolute, $exclude_list); 257 277 } 258 278 … … 265 285 $list[] = $d; 266 286 } 267 268 287 } 269 288 }
