Archive for June, 2008

hat trick

I’ve been going through and doing some cleanup on my old php projects. Some of them had some pretty crappy coding practices, since they were written back when I was still learning PHP and SQL. For example, they had all functions lumped together in one function library – made it easier to write, but it meant that every single operation loaded all the code for every single function into php’s memory. Why load 10 functions into memory when you’re only using one of them? Also, SQL functions were mainly used for fetching records, and most of the sorting/association was done by PHP. I did it at the time because I knew PHP a lot better than I did SQL, and it meant I could avoid some of the more complicated SQL stuff such as JOINs and subqueries. However in practice it’s better to have as much of that done by the SQL server as possible, since it’s much faster and more efficient than PHP at managing data. So I managed to do major cleanup of all three of my PHP projects. Unfortunately I didn’t really get around to adding new features, which is why the three projects were only bumped minor versions, and not major versions.

The changelogs are as follows:
Codex:

  • Move config to its own directory
  • Smarty and ADOdb prefixes are now configurable
  • Break up function library into a file for each function that’s loaded on demand
  • Remove usage of obsolete HTTP_GET_VARS and HTTP_POST_VARS
  • Rewrite matchup_data to use SQL and be more efficient
  • SQL file is now included in tarball
  • Use a more sane versioning scheme (e.g. 0.3.3 instead of v03c)

Codex actually still has some speed issues – part of it is due to some more shitty code that needs to get cleaned up, part of it is due to the sheer amount of data it fetches and cross-references at any given time.

MDB:

  • Prevent SQL injections in searches
  • Move config to its own directory
  • Break up function library into a file for each function that’s loaded on demand
  • Made ADOdb prefix configurable
  • Rewrite SQL/PHP in functions unmapped, taglist, prunetags, userhistory, titlelist
  • Fixed file download function which broke in some browsers
  • Use a transaction during database update to avoid users seeing corrupt data during update

GitPHP:

  • Move config to its own dir
  • Break up function library into a file for each function that’s loaded on demand
  • Use a more sane versioning scheme (e.g. 0.0.4 instead of v01d)
  • Fix broken snapshot URL on some pages
  • Fix missing header that broke formatting on tag page
  • Fix duplicated “…” that appeared on truncated shortlogs
  • Fix sorting functions on main project list page
  • Project lists searching a directory (rather than using a predefined list in the config) now search recursively
  • Add “TXT” plaintext project list link on front page
  • Fix ref icons next to commits with tags/heads
  • Some adjustments to links on pages to match more closely with current gitweb
  • Links to files on commitdiff pages now work
  • Diff binary path is now configurable
  • Now works on Windows with msysgit! Thanks to testing and bugfixes from Slash

Slash was a big help with much of the Windows testing/bugfixes on this release, as I don’t have any windows boxes. GitPHP can now work drop-in on Windows as long as you read the config and set the paths to your binaries correctly.

Tarballs of all new releases are available on their respective project pages. Since the directory structure of these releases have changed significantly, I recommend deleting files from the previous version before extracting this version.

I have also added a bugtracker on this site for people to report bugs with the software, at http://mantis.xiphux.com. Given how many people actually use anything I write (countable on one hand), I don’t forsee it being used much, but at least it’s there if I or anyone else ever needs it.

gitphp on xiphux.com

I didn’t even realize it, but it turns out that dreamhost actually put a copy of the git revision control system on my webserver, which is awesome. I put a copy of my gitphp web interface on this site, with the repositories for a couple of my projects. The address is http://gitphp.xiphux.com. Right now I’ve only put up the four projects I have on the website under programming (that are not hosted elsewhere) – pysoulforge, gitphp, codex, and mdb. I have a number of other “private” projects that I have not yet made a page for on the website; I still have to decide how exactly I want to go about making each of those available before I put their git repositories up for browsing.

I’ve been working on GitPHP a little, and have done some maintenance and bug fixes that I really should have done before but never got around to:

  • Split the function library into separate files to avoid loading the whole thing into memory for every operation
  • Snapshot URL was broken on some pages
  • Tag page was missing a header causing formatting to be screwed up
  • Sorting functions on main project list page didn’t work
  • When crawling for projects in the project root (rather than defining them manually in the config), should have been recursive search
  • Fix read_info_ref so items now have head and tag icons near them where appropriate
  • The “…” link to see the rest of the shortlog was duplicated sometimes
  • Adjusted options by various commits/tags/heads to more closely match current gitweb

It’s a little closer to matching current gitweb but there are still certain things missing (such as search). These changes haven’t been tagged and released as a new version yet, but the changes are up and can be browsed by gitphp.

Just a note that this is not the same git-php project that is posted at http://code.google.com/p/git-php/. Mine actually predates that project by several months, it’s just that I never posted it anywhere but this website. Not only that, but it takes the exact same approach as the gitweb cgi script, by integrating everything into one source file – the exact thing that I wanted to avoid when I made a split-out template version.

Return top