Closed Bug 323590 Opened 20 years ago Closed 20 years ago

Make it possible to have multiple WEB_BASE_URI -> WEB_BASE_PATH mappings

Categories

(Webtools Graveyard :: Doctor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: justdave, Assigned: LpSolit)

References

Details

Attachments

(1 file, 2 obsolete files)

Right now we have a multiple websites in the cvs-www repository, and a few of them would be nice to have doctor support for. At the moment, doing this requires a separate doctor installation for each. But since they're all in the same repository, it would make sense to let the same instance of doctor manage them all. This could probably be done by allowing mappings of WEB_BASE_URI to WEB_BASE_PATH. This trick could probably also make alternate domains that point at subsites work if someone enters a URL from that site into the select a page box. (like http://www.bugzilla.org/ -> mozilla-org/html/projects/bugzilla/)
QA Contact: asa → doctor
This is also wanted by the savannah.gnu.org folks, so that one Doctor can be used by multiple people for multiple sites.
Attached patch patch, v1 (obsolete) — — Splinter Review
I had to make some "cleanup" in order to make it work correctly and nicely. Among others, Doctor::File->new($URI_to_file) now throws an error if the URI is either invalid or ambigous. I also moved Throw*Error() in the new Doctor/Error.pm in order to use these functions from Doctor::File->new(). So this bug will also fix bug 335947.
Assignee: myk → LpSolit
Status: NEW → ASSIGNED
Attachment #220259 - Flags: review?(myk)
Blocks: 335947
Attached patch patch, v2 (obsolete) — — Splinter Review
Include sample.conf in the patch as I renamed 3 parameters.
Attachment #220259 - Attachment is obsolete: true
Attachment #220260 - Flags: review?(myk)
Attachment #220259 - Flags: review?(myk)
reed suggested to use arrays instead of my WEB_BASE_URI_n "hack". I had the same idea, i.e. using an array of hashes, but AppConfig doesn't let us use so complex structures. So maybe should we use this "hack" for now and replace AppConfig in another bug as this would affect all parameters.
Attachment #220260 - Attachment is obsolete: true
Attachment #220336 - Flags: review?(myk)
Attachment #220260 - Flags: review?(myk)
Comment on attachment 220336 [details] [diff] [review] unbitrotten patch, v2.1 > # Create the global template object that processes templates and specify > # configuration parameters that apply to templates processed in this script. Shouldn't this "Create the global template object" section, which isn't being modified in your patch, actually be removed, since you're adding an identical section below? >+# Several separate installations can be added by incrementing _n >+# in WEB_BASE_URI_n, WEB_BASE_URI_PATTERN_n and WEB_BASE_PATH_n. >+WEB_BASE_URI_1 = http://www.mozilla.org/ Nit: it'd be nice to make the "_n" suffix optional for installations managing a single site. >+ # If the given URI doesn't match anything and there are more than >+ # one website managed by this installation, we cannot go further >+ # as we have no idea which website the user is talking about. >+ if (!$match_found && $i > 2) { >+ $self->{_error} = "Invalid URI: " . $self->{_spec}; >+ return; > } Shouldn't this be $i > 1? Once $i = 2 there are already two sites being managed by Doctor, no? Nit: while throwing "invalid URI" is OK, it would be better to show the user a page that gives them an opportunity to either correct the path (if they entered the path incorrectly) or choose the site on which to create the file (if they're trying to create a file). Otherwise this looks fine. r=myk with the code issues I've identified fixed (if they actually are issues, which you can determine at your discretion).
Attachment #220336 - Flags: review?(myk) → review+
Checking in Doctor.pm; /cvsroot/mozilla/webtools/doctor/Doctor.pm,v <-- Doctor.pm new revision: 1.6; previous revision: 1.5 done Checking in doctor.cgi; /cvsroot/mozilla/webtools/doctor/doctor.cgi,v <-- doctor.cgi new revision: 1.22; previous revision: 1.21 done Checking in sample.conf; /cvsroot/mozilla/webtools/doctor/sample.conf,v <-- sample.conf new revision: 1.5; previous revision: 1.4 done RCS file: /cvsroot/mozilla/webtools/doctor/Doctor/Error.pm,v done Checking in Doctor/Error.pm; /cvsroot/mozilla/webtools/doctor/Doctor/Error.pm,v <-- Error.pm initial revision: 1.1 done Checking in Doctor/File.pm; /cvsroot/mozilla/webtools/doctor/Doctor/File.pm,v <-- File.pm new revision: 1.7; previous revision: 1.6 done Checking in templates/edit.tmpl; /cvsroot/mozilla/webtools/doctor/templates/edit.tmpl,v <-- edit.tmpl new revision: 1.16; previous revision: 1.15 done (In reply to comment #6) > Shouldn't this "Create the global template object" section, which isn't being > modified in your patch, actually be removed, since you're adding an identical > section below? Right! I forgot to remove it (unused code). I did it on checkin. > Nit: it'd be nice to make the "_n" suffix optional for installations managing a > single site. Hum... ok. I will open another bug for this. > Shouldn't this be $i > 1? Once $i = 2 there are already two sites being > managed by Doctor, no? Niet! In the case there is only one site being managed, and as I use ++$i in the while loop, it first increments $i to 2, then realizes that there is no WEB_BASE_URI_2 and goes outside the loop. So with only one site, we have $i = 2. So when you are outside the loop, $i = "number of managed sites + 1". That's why I wrote $i > 2 instead of $i > 1. > Nit: while throwing "invalid URI" is OK, it would be better to show the user a > page that gives them an opportunity to either correct the path (if they entered > the path incorrectly) or choose the site on which to create the file (if > they're trying to create a file). OK, let's open a separate bug for this as it's a new way to "throw" error. :)
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
> > Nit: it'd be nice to make the "_n" suffix optional for installations > > managing a single site. > > Hum... ok. I will open another bug for this. Now that I think more about this, it's pretty important, since otherwise admins are going to hork their installations upon update due to this breaking config change. Please file the bug soon and prioritize it highly. > > Shouldn't this be $i > 1? Once $i = 2 there are already two sites being > > managed by Doctor, no? > > Niet! In the case there is only one site being managed, and as I use ++$i in > the while loop, it first increments $i to 2, then realizes that there is no > WEB_BASE_URI_2 and goes outside the loop. So with only one site, we have $i = > 2. So when you are outside the loop, $i = "number of managed sites + 1". > That's why I wrote $i > 2 instead of $i > 1. Ah, ok, now I understand. It might make sense to add a comment to that effect. > > Nit: while throwing "invalid URI" is OK, it would be better to show the > > user a page that gives them an opportunity to either correct the path > > (if they entered the path incorrectly) or choose the site on which to > > create the file (if they're trying to create a file). > > OK, let's open a separate bug for this as it's a new way to "throw" error. :) Sounds good. Thanks for this important fix!
Blocks: 336283
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: