Weather plugin woes

Creating and modifying plugins.
Post Reply
Little Hamster
Regular
Posts: 62
Joined: Thu Oct 07, 2004 3:16 pm

Weather plugin woes

Post by Little Hamster »

I installed a fresh copy of serendipity on my PC to debug the problem I have with the weather plugin. Setup is apache2, php4, mysql on linux. Service_Weather is 1.3.1 from pear.php.net.

Basically, the plugin doesn't show anything on the front page, but messed up the configure plugin page.

After adding a generous amount of echos to the plugin code, I've pinpointed the offending line:

Code: Select all

$status = $metar->setCache('file', array('cache_dir' => '/tmp'));
Using the version of the plugin mgroeninger pm'ed me has the same problem. In his version (I think it's from the CVS), it's like this:

Code: Select all

$status = $metar->setCache('file', array('cache_dir' => $serendipity['serendipityPath'].'/templates_c'));
I created /path/to/s9y/templates_c and made sure it's 777.

Since I'm not fluent in php, I can't really tell what has gone wrong here. The only thing I can think of is $metar. But it should have been instantiated because this is called before the offending line:

Code: Select all

$metar->setUnitsFormat($unitString);
Little Hamster
Regular
Posts: 62
Joined: Thu Oct 07, 2004 3:16 pm

Need PEAR Cache

Post by Little Hamster »

OK, I've figured out what went wrong. You need the PEAR::Cache installed as well, or service->setCache will just die without a sound.

Maybe someone with CVS access can add a require() there? Or maybe the plugin can check if Cache exists before setCache()?
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Ok, I should have fixed this in CVS...
I added two configuation options as well:
  • Caching: You can now turn caching on and off
    Cache Directory: You can now set the cache directory
If caching is on, but PEAR/cache is not installed it should give you a polite warning on the sidebar...

Same as if services/weather isn't installed...

I tested it in both 0.8 and 0.7.1 and it seems to be working...

anonymous CVS should catch up in a few hours... if you don't want to wait, send me a message...

Thanks Little Hamster!!!
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Oh, yeah... if anyone wants to translate the prompts let me know!!
Post Reply