Virtual Categories are broken!

Remember that wonderful new scheme for parsing URLs? Well, it broke virtual categories. That’s only because I forgot about them. Not because the schema is broken. It will still work, for any item in the tree. But virtual categories are not in the tree. I’ll change the new code to do some extra checks before returning a 404.

Diane Bruce reported this issue…

I just wanted to point out that as a result of this bugfix, I improved the way ports, categories, and non-ports are handled by the missing.php script. I also found a bug with URL such as this: http://www.freshports.org/lang/p5-Error/Makefile. No commits were being shown. It seems I forgot to upgrade a data type like this:

BEGIN;
  DROP TYPE element_type CASCADE;
CREATE TYPE element_type AS (
        id               integer,
        name             text,
        type             text,
        status           text,
        iscategory       boolean,
        isport           boolean,
        element_pathname text
);

CREATE OR REPLACE FUNCTION elementGet (text) RETURNS SETOF element_type AS '
   SELECT id,
          name::text,
          directory_file_flag::text,
          status::text,
          case when IsCategory(Pathname_ID($1)) IS NULL THEN FALSE ELSE TRUE END,
          case when IsPort(    Pathname_ID($1)) IS NULL THEN FALSE ELSE TRUE END,
          element_pathname(id)
     FROM element
    WHERE id = PathName_ID($1);
' LANGUAGE SQL STABLE;


commit;

Make sense? I added element_pathname to the element_type data set. I needed that for some of the URL parsing.

Next step: add proper pagination to category listings. It’s there now, but it’s not using Pear/Pager.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

1 thought on “Virtual Categories are broken!”

Leave a Comment

Scroll to Top