Is there a PHPOpenTracker-Plugin for s9y already? If not..

Creating and modifying plugins.
Post Reply
User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Is there a PHPOpenTracker-Plugin for s9y already? If not..

Post by ReneSchmidt » Sat Jan 22, 2005 7:38 pm

This is a plugin that enables s9y to log accesses via PHPOpenTracker. Go to http://www.log.reneschmidt.de/categories/16-s9y_phpopentracker and download.

Any constructive feedback appreciated.

Install
1. You need PHPOpenTracker properly installed for this (See http://www.phpopentracker.de for download and installation instructions). Configure a client_id in 'conf/phpopentracker.php' of your working PHPOpenTracker installation (somewhere at the bottom of the file).

2. Once installed, extract serendipity_event_phpopentracker.tar.bz2 to the plugins dir of s9y. Change constant 'PHPOPENTRACKER_PATH' (it's in the first line) in file 'serendipity_event_phpopentracker.php' to the absolute path of your PHPOpenTracker installation.

3. Go to the s9y admin interface and enable the plugin. Enter the client_id that you have entered in the PHPOpenTracker config file. Save and you are done.
Last edited by ReneSchmidt on Fri Jan 28, 2005 9:20 pm, edited 1 time in total.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Is there a PHPOpenTracker-Plugin for s9y already? If not

Post by garvinhicking » Sun Jan 23, 2005 2:21 pm

That's a nice plugin, would you like to add it to our CVS additional_plugins repository?

One thing though - you should make the PHPOPENTRACKER_PATH setting configurable in the plugin configuration; that shouldn't be too hard but will make it much easier to use the plugin without needing to edit it.

Thanks for your effort in improving Serendipity! :)

Regards
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Re: Is there a PHPOpenTracker-Plugin for s9y already? If not

Post by ReneSchmidt » Sun Jan 23, 2005 10:04 pm

garvinhicking wrote:That's a nice plugin, would you like to add it to our CVS additional_plugins repository?


That would be nice.

garvinhicking wrote:One thing though - you should make the PHPOPENTRACKER_PATH setting configurable in the plugin configuration; that shouldn't be too hard but will make it much easier to use the plugin without needing to edit it.


Yes I have thought about that and I even tried to implement that, but when I ran into some problems with including files with variable paths I dumped that idea. It should be possible (did not try conditional inclusion yet) but I also think it is somewhat more safe (especially in a shared hosting environment) to hard-code the path because you have to have file write access in order to tamper with the s9y installation successfully. But I'm not sure about that. What do you (and others) think?
Last edited by ReneSchmidt on Fri Jan 28, 2005 9:20 pm, edited 1 time in total.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Is there a PHPOpenTracker-Plugin for s9y already? If not

Post by garvinhicking » Mon Jan 24, 2005 9:46 am

Yes I have thought about that and I even tried to implement that, but when I ran into some problems with including files with variable paths I dumped that idea. It should be possible (did not try conditional inclusion yet) but I also think it is somewhat more safe (especially in a shared hosting environment) to hard-code the path because you have to have file write access in order to tamper with the s9y installation successfully. But I'm not sure about that. What do you (and others) think?


Hm, I really think it shouldn't be done with hardcoded paths. The constant can still be defined with the configuration variable:

$path = $this->get_config('opentracker_path');
@define('PHPOPENTRACKER_PATH', $path);

So that should actually lead to the same results as seems to be working right now?

And why does one need to have file write access, I'm afraid I don't understand that?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Post by ReneSchmidt » Mon Jan 24, 2005 10:40 pm

Well, check out the new version please and tell me your experiences.

Be aware that this plugin is mostly untested. I am using it now for some hours and it seems to work as it should.

http://log.reneschmidt.de

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Tue Jan 25, 2005 10:37 am

Okay, thanks a lot, this look very good to me. I just committed it to our additional_plugins CVS module. If you want CVS karma for modifying your plugin there, please give me your SourceForge username.

BTW, I added a second check if $_ENV is empty to use $_SERVER['REQUEST_URI'] to the plugin...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Post by ReneSchmidt » Tue Jan 25, 2005 10:39 pm

Ah that's great... Ahm I am wondering if it is possible to get admin interface plugin settings verified via RegExps or so.

I mean if I could verify the client ID being an INT prior to saving and NOT every time a page is being accessed logging could be sped up a bit. Significantly I guess. The same goes for POT path and file name, these do not have to be checked every access to a page.

Two 'preg_match'es and one file_exists could be omitted.
Last edited by ReneSchmidt on Fri Jan 28, 2005 9:20 pm, edited 1 time in total.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Wed Jan 26, 2005 11:22 am

Hi Rene!

We do have a 'cleanup' method for plugins, where they can do exactly that: Check the input parameters, and if they're invalid, reset the value to working defaults. The event_contentrewrite plugin makes use of that method, if you want to look at an example...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Post by ReneSchmidt » Fri Jan 28, 2005 9:16 pm

garvinhicking wrote:Hi Rene!

We do have a 'cleanup' method for plugins, where they can do exactly that: Check the input parameters, and if they're invalid, reset the value to working defaults. The event_contentrewrite plugin makes use of that method, if you want to look at an example...


Ah OK... I've got two problems:

1. Admin enters garbage in the s9y_pot config form and clicks "save"
2. Plugin checks validity and resets config values to working defaults if necessary

That does work so far.

But now what... Admin does not know something went wrong since there is no error message and the wrong input is still shown.

I see there are other plugins that do not care about wrong input, spam protection plugin for example. That will definitely cause some confusion especially among non-geeks that bloggers and (ha...) Mac users (mostly same folks I guess...) usually are... Just kidding.

If there is no error message system available for plugins probably SmartyValidation could be implemented as form input validation and error messaging system.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sat Jan 29, 2005 12:43 pm

The problem is that we do not (yet) use Smarty in our Backend. But I agree, form validation is a thing which should be introduced.

But for now I then the cleanup() method could just echo output errors, formatted with Serendipity's CSS error class?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Post by ReneSchmidt » Sat Jan 29, 2005 12:59 pm

garvinhicking wrote:The problem is that we do not (yet) use Smarty in our Backend. But I agree, form validation is a thing which should be introduced.


I would volunteer but that's not trivial to do and I have some exams
to do... But I could implement SmartyValidate once Smarty has been integrated. I have used recently in a project of mine and it is elegant and a HUGE time saver.

garvinhicking wrote:But for now I then the cleanup() method could just echo output errors, formatted with Serendipity's CSS error class?


That's what the plugin already does. :)

Another issue: obviously my plugin already is available via Spartacaus, but it is named "Sample!" there. Is this a hidden hint for me to use a more unique name for that plugin... ? I do not object but please tell me if that's the message. :)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sat Jan 29, 2005 1:50 pm

Hi Rene!

Great to have a volunteer for that, but I'm afraid that a Smarty backend won't be coming for a long time. To migrate the backend there is about 2-3 weeks of fulltime work, and it's not really necessary IMHO...

About spartacus: This one currently uses auto-generated infofiles - I could not find a "Sample!" name there for your plugin, for me it all looks right? Maybe in an older XML classfile it was wrong, could you delete the package_event.xml file frm the spartacus directory, so that it recreates the cache?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Post by ReneSchmidt » Sun Jan 30, 2005 11:38 pm

garvinhicking wrote:Hi Rene!

Great to have a volunteer for that, but I'm afraid that a Smarty backend won't be coming for a long time. To migrate the backend there is about 2-3 weeks of fulltime work, and it's not really necessary IMHO...


Too bad... But I see it would be a lot of work.

garvinhicking wrote:About spartacus: This one currently uses auto-generated infofiles - I could not find a "Sample!" name there for your plugin, for me it all looks right? Maybe in an older XML classfile it was wrong, could you delete the package_event.xml file frm the spartacus directory, so that it recreates the cache?


Did not help...

BTW, there is a new version of my plugin available. I would like to commit it to your CVS myself but actually I'm too lazy to deal with another versioning system... Is it much different from svn? (I already use svn on my soho server)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Mon Jan 31, 2005 10:21 am

Hi Rene!

CVS shouldn't be too different frmo SVN; but I don't use SVN. CVS's basic usage is:

Code: Select all

cvs -d:ext:reneschmidt@cvs.sf.net:/cvsroot/php-blog checkout additional_plugins
cd additional_plugins
cp ~/phpopentracker/serendipity_event_phpopentracker.php serendipity_event_phpopentracker/serendipity_event_phpopentracker.php
cvs commit serendipity_event_phpopentracker


Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply