Opened 13 years ago

Closed 13 years ago

#8169 closed bug (fixed)

haiku-files.org -- PHP doesn't detect *hrev* nightly images

Reported by: mmadia Owned by: haiku-web
Priority: normal Milestone:
Component: Website Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

With the switch to git, the nightly images will no longer have r###### in their filename, rather hrev#####. e.g. haiku_unsupported-nightly-hrev43373-x86gcc2-anyboot.tar.xz

The current code for generating the tables does not handle "hrev*"

scanDirectory.php:42-68

		while (($file = readdir($directory)) !== false) {
			if (substr($file, 0, 1) == ".") continue;
			if (filetype($dirName . "/" . $file) == "file") {
				// try to find a revision in there...
				if (preg_match("/r[0-9]{2,8}/", $file, $regs)) {
					$revision = substr($regs[0], 1);
					$format = "";
					foreach($formats as $_format) {
						if (ereg($_format["regexp"], $file, $regs)) {
							$format = $_format["title"];
						}
					}
					if ($format == "")
						continue;
					if (!isset($rows[$revision])) {
						$rows[$revision] = Array();
					}
					$size = format_bytes(filesize($dirName.'/'.$file));
					$date = date("Y-m-j", filemtime($dirName.'/'.$file));
					$extension = substr($file, strrpos($file, ".")+1);
					$rows[$revision][$format][] = Array("date"=>$date,
														"extension"=>$extension,
														"filename"=>$file,
														"size"=>$size);
				}
			}
        }

By the way, www.haiku-files.org is contained within a mercurial repository. hg clone ssh://haiku_files@haiku-files.org The usual hg push ; ssh haiku_files@haiku-files.org ; hg up is needed after committing locally.

Change History (1)

comment:1 by zooey, 13 years ago

Resolution: fixed
Status: newclosed

Fixed by adjusting the regex to accept hrevXXXXX as well as rXXXX.

While at it, I changed the link text from rXXXX to hrevXXXX, too.

When trying to commit those changes directly to the Mercurial repository on haiku-files.org, I noticed a changed style/style.css from July of this year, so I committed that first and then my changes.

Note: See TracTickets for help on using tickets.