Fork me on GitHub

Relative vs. direct urls and a question on protocols  Bottom

  • I have been using UpDownload for a while, and I noticed today (in the midst of switching servers) that it stores the direct URLs of the files in the database. Fortunately I only had a couple of pages of downloads to change this on, but in the future, that could get to be quite a pain if I need to change hundreds of downloads because I move my postnuke directory! Is there a reason or standard on using direct urls rather than relative? (I'm guessing if there is, UpDownload wasn't necessarily following it, since it's not really API compliant, as far as I can tell.)

    Also, I've been thinking about going in and changing some of the code to make it more compliant so I can hook into it from other modules. Or at least borrow the API, since hooks still elude me. I realize that in doing this, I would be making the module non-upgradable, but mostly it does the only things I need, so that doesn't bother me. The thing I wonder about is, how kosher is it to make such changes? Is it frowned upon in the programming world at large? Should I make those changes available to the designer in case s/he wants to incorporate them or make them available? If I go this route, does anyone have advice in modding a mod?
  • jediping

    I have been using UpDownload for a while, and I noticed today (in the midst of switching servers) that it stores the direct URLs of the files in the database. Fortunately I only had a couple of pages of downloads to change this on, but in the future, that could get to be quite a pain if I need to change hundreds of downloads because I move my postnuke directory! Is there a reason or standard on using direct urls rather than relative? (I'm guessing if there is, UpDownload wasn't necessarily following it, since it's not really API compliant, as far as I can tell.)


    In regard to URL's, you've hit the nail on the head. Absolute URL's cause problems when you move the site...not only to a new server, but even to a different directory...as you've noticed. Thus, they are not recommended...at all.

    Quote

    Also, I've been thinking about going in and changing some of the code to make it more compliant so I can hook into it from other modules. Or at least borrow the API, since hooks still elude me. I realize that in doing this, I would be making the module non-upgradable, but mostly it does the only things I need, so that doesn't bother me. The thing I wonder about is, how kosher is it to make such changes? Is it frowned upon in the programming world at large? Should I make those changes available to the designer in case s/he wants to incorporate them or make them available? If I go this route, does anyone have advice in modding a mod?


    You should always first check with the module license. Most module devs you come across aren't going to care one way or the other...though some will not supported hacked versions. In any case, you should always approach code-tweaking with the mindset that "..if I break the module...or even the entire site...I've no one to blame but myself..."

    That said, you should always make backups of anything you tweak beforehand. Tweaking code is not frowned upon by any means in the Open Source world...and whether you make those changes available to the original developer is entirely up to you. You're also completely free to make the changes available on your own site as a hack, tutorial, etc (assuming GPL) and this can be an effective way to get some traffic to your site. However, no one is going to penalize you for keeping your changes to yourself, if that's what you prefer to do. In fact, this can actually make your site stand out a bit from the rest, in some cases.

    As far as advice on mod-tweaking:
    1) Always backup files/modules before you tweak them.
    2) Unless you're very well-versed in site recovery from a completely FUBAR state, don't tweak on your "live" site...use a test site/area to ensure it works first. Even if you are good at recovery, it's still recommended to do it in a test area.
    3) Document what you've tweaked. If you make a bunch of edits and then FUBAR the site on the 20th one, you're screwed if you can't remember what you did last, you might end up losing a bunch of "good" edits because you have to replace the entire file or module.

    Those 3 things are in my top-list of successful module tweaking, but I'm sure there's other things as well.
  • Not to be a stick in the mud but any form of URL can get lost if you start moving things around and changing the names of directories. wink

    Imagine your giving directions to someone. You could say go two blocks North or go to Elm Street and mean the same thing. If you change North to South (analogous to moving things around) or Elm Street to Oak Street (analogous to changing the names of the directory), your directions no longer point to the same place and one will be wrong.

    Slugger
  • Of course, changing directory names within the relative structure will cause problems...as well as changing locations of files/directories within the structure. But...as far as moving the entire relative structure (ie, an entire PN install) to a different location, if everything is relative, one shouldnt' have any troubles within the structure, so long as the entire structure is moved as a whole. Um...did I say that right?
  • That's more what I was getting at, Alar. I would expect problems if changing directory structure internally. It's the whole-site move. I was moving it up a couple of directory levels, and it vexed me to have to change them all manually.

    Vex is such a good word. :)

    I'll have to see if I can't get to work on some updating of the module, then, keeping in mind the points you make. Now that I have more room, I think I will do a test installation of Postnuke. Until recently, I've just been doing it all on the main site, because I don't have a test server here. But now I've got the space for another installation. Woot! :)
  • Yea, I like "vex" too...

    For dev'ing/testing purposes, I just use a sub-domain... dev.alarconcepts.com ... and I've got a few installs here and there in sub-dir's as well... It's rather crazy...but it works...

    Good luck on the code updates!
  • No word from the UpDownload developer, so I've just started tearing it apart. No wonder people don't want to update their modules! It's a lot of work! *wipes sweat from forehead* Especially when you're not the one who wrote the code in the first place. :)
  • That last sentence sure rings extra true...
  • Excuse me, I found today this post in this international forum.
    I don't know witch developer you ask but I think it's not me, although I am the last dev who works on this module.
    The problem with direct URL's is known for a long time and will be fixed in one of the next two versions, normally the next one (V2.3). There is a first way to solve this problem in the german support forum on post-nuke.net and this looks like a good way. If you are interested to helping me with this old module you are always welcome.
    So it would be nice that you contact me and show me your changes.

    Regards from Germany
    Petzi

    --
    Petzi-Juist :: ... welcome to my digital world ...
  • Petzi,

    I thought it was you I was contacting, but I guess not! I haven't made much in the way of changes yet, just trying to break down the module to understand it and figure out how best to create the different API and pnRender files and functions. I thought I'd added you to my ICQ list, but now I can't find you. Feel free to IM me if you catch me online, or submit the request again. :)

This list is based on users active over the last 60 minutes.