GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — okapi/etc/update_changes.php at master · opencaching/okapi Expand file tree/ Copy pathupdate_changes.phpMore file actions 114 lines (97 loc) · 3.83 KB / Copy pathupdate_changes.phpFile metadata and controls114 lines (97 loc) · 3.83 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 <?php # This script MUST be run after each update of changes.xml. # It inserts version numbers and dates. exec('git --git-dir='.__DIR__.'/../.git log --pretty=raw', $gitlog); if (!$gitlog) die("error: could not run git\n"); # parse the git log; build an array of all commits $repo_commits = array(); $time = false; foreach ($gitlog as $line) { $tokens = explode(' ', $line); switch ($tokens[0]) { case 'commit': $commit = substr($tokens[1], 0, 8); break; case 'committer': $time = $tokens[count($tokens) - 2]; $timezone = $tokens[count($tokens) - 1]; break; case '': if ($time) { $repo_commits[$commit] = array( 'time' => $time, 'timezone' => $timezone, 'position' => count($repo_commits) ); $time = false; } break; } } $OKAPI_GIT_VERSION_BASE = 318; # test for well-formed XML # TODO: verify XML scheme simplexml_load_file(__DIR__ . '/changes.xml'); # SimpleXML iterators are read-only, so we process the plain text file. $changes = file(__DIR__ . '/changes.xml'); $changelog_commits = array(); $content_section = false; foreach ($changes as &$line) { if (strpos($line, '<changes>') !== false) { $content_section = true; } elseif ($content_section && preg_match('/^\s*<change /', $line)) { if (preg_match( '/^\s*<change\s+commit="(.+?)"\s+version="(.*?)"\s+time="(.*?)"\s+type="(.+?)"(\s+infotags="(.*?)")?\s*>$/', $line, $matches )) { list(, $commit, $version, $time, $type, , $infotags) = $matches; if (strlen($commit) != 8) die("error: commit ID $commit is not 8 chars long\n"); if (isset($changelog_commits[$commit])) die("error: duplicate commit ID $commit\n"); if (!isset($repo_commits[$commit])) die("error: didn't find commit ID $commit in OKAPI git repo\n"); if (!in_array($type, array('enhancement', 'bugfix', 'docs', 'other'))) die("error: unknown type '$type' for commit $commit\n"); $repo_version = $OKAPI_GIT_VERSION_BASE + count($repo_commits) - $repo_commits[$commit]['position']; $repo_time = date('Y-m-d\TH:m:s', $repo_commits[$commit]['time']) . $repo_commits[$commit]['timezone']; # Note: We will NOT re-calculate existing version numbers, which # would shift if an older commit is merged. The re-calculation # could cause erroneous behaviour of clients, that determine # the availability of new features by changelog version number. # # (Developer refers to current API docs e.g. at OC.PL and tests # for availability of a feature, which will *seem* unavailable # at an out-of-date OKAPI installation, because the shifted version # number mismatches the apisrv/installation version number of the # out-of-date installation.) if ($version == 0) { $version = $repo_version; echo $commit . ' version = ' . $version . "\n"; } if ($time != $repo_time) { $time = $repo_time; echo $commit . ' time = ' . $time . "\n"; } $line = ' <change commit="'.$commit.'" version="'.$version.'" time="'.$time.'" type="'.$type.'"'; if ($infotags) { $line .= ' infotags="'.$infotags.'"'; } $line .= ">\n"; $changelog_commits[$commit] = true; } else { die("error: unexpected <change> line format:\n$line\n"); } } } file_put_contents(__DIR__ . '/changes.xml', $changes); |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |