MSPSS: is there life after the helpdesk?

sharing solutions to uncommon IT problems

Archive for the ‘Joomla’ Category

Joomla: country content filter – custom plugin

leave a comment »


Hello,

one of our customers kept complaining that users connecting from China get an ugly 404 error in the iframe where we displayed our Vimeo videos.

We contacted Vimeo and their obvious answer was: “we have no control on this, we can’t help you”.

We went looking for a plugin that would allow us to display content based on the user provenance but we were unable to find anything that would fit our requirements so we developed it ourselves (the credit goes mostly to Tom Meredith who re-engineered my initial prototype from scratch).

This simple plugin allows editors to easily decide what content should be displayed for selected countries based on the visitor’s IP, for example:

{countryaccess country=CN,MM}
I am not in China or Myanmar
Here you put the code you want to display if the user is not from China or Myanmar
||
I am in China or Myanmar
Here you put the code you want to display if the user is from the countries listed in the opening tag (country=). For example, with our customer we decided to display a nice image that would redirect the user to the Vimeo channel (he would still get a 404 then but not on our homepage).
{/countryaccess}

The cool thing is that the plugin can be reused for all sort of things: localised Ads, localised content etc.

The plugin can be downloaded from: https://sourceforge.net/projects/countryaccess/?source=dlp

HTH,
Roberto.

Written by zantoro

July 9, 2013 at 3:15 pm

Posted in Joomla

Tagged with

Joomla 2.5.10+: Unable to upload file

leave a comment »


Hello,

if you just upgraded your Joomla to any version higher than 2.5.10 (included) you might notice that some files cannot be uploaded via Media Manager anymore.

They seem to have fixed 🙂 the “Check Mime Types” option in the Options window of Media Manager:

So now you have 2 choices:
1- Disable this option
2- Add the relevant file extensions here (this is the recommended one).

HTH,

Roberto.

P.S.: for you reference, in the php error you might find the following errors:
[28-Jun-2013 14:55:25 UTC] PHP Warning: strtolower() expects parameter 1 to be string, array given in \administrator\components\com_media\controllers\file.json.php on line 75
[28-Jun-2013 14:55:25 UTC] PHP Warning: strrpos() expects parameter 1 to be string, array given in \libraries\joomla\filesystem\file.php on line 34
[28-Jun-2013 14:55:25 UTC] PHP Warning: substr() expects parameter 1 to be string, array given in \libraries\joomla\filesystem\file.php on line 36
[28-Jun-2013 14:55:25 UTC] PHP Warning: fopen() expects parameter 1 to be string, array given in \libraries\joomla\filesystem\file.php on line 322
[28-Jun-2013 14:55:25 UTC] PHP Warning: Missing argument 3 for plgContentFinder::onContentBeforeSave() in \plugins\content\finder\finder.php on line 48
[28-Jun-2013 14:55:25 UTC] PHP Notice: Undefined variable: isNew in \plugins\content\finder\finder.php on line 54
[28-Jun-2013 14:55:25 UTC] PHP Warning: move_uploaded_file() expects parameter 1 to be string, array given in \libraries\joomla\filesystem\file.php on line 490

Written by zantoro

June 28, 2013 at 4:13 pm

Posted in Joomla

Tagged with

Joomla on IIS7.5 – configuration and performances

leave a comment »


Hello,

first of all I would like to spend some nice words on IIS7.5 which is probably the best web server I ever got to work with.

Every time I talk to contractors I employ to develop or update one of our websites, they frown as I mention that we have a full windows environment and start saying that IIS does not support redirections, rewrites, that performance will be impaired, that I DONT HAVE SSH…

What I always tell these people is that I currently have 5 websites PHP/MySQL running under IIS7.5 and they all perform splendidly:

  • IIS7.5 supports PHP out of the box (and the admin configuration window is slightly more user friendly than the good old php.ini)
  • IIS7.5 supports redirections, rewrites and it’s even easier to configure than your htaccess, especially thanks to a handy UI which allows you to test your regular expressions. Moreover you can automatically import rules out of your htaccess file
  • IIS7.5 has 2 levels of caching (kernel and user): you don’t have that on Apache, do you?
  • IIS7.5 allows you to have multiple worker processes serving the same website (called webgarden)… see below my benchmark so see the advantages
  • IIS7.5 allows virtual hosts for FTP sites: quite handy if, like me, you have a busy web server (what do you need SSH for now???)

… and so much more.

Now to the performances… As I said earlier I currently host 5 Joomla PHP/MySQL websites, all of them on IIS7.5 webservers.

I tune around and try different options to get the most out of both Joomla and my web server but with these CMS you better be careful as some modules do not particularly like to be cached indiscriminately.

For Joomla 2.5 in particular I did a benchmark testing of a pretty big, important website:

  • 1000 pages
  • 10000 users per day
  • 9/10 Page rank

I tested it with 100 users, clicking 5 times each on 3 different URLs (chosen randomly).

The stress tool I used is Webserver Stress tool 7 by Paessler.

The different options I used are:

  • IIS7.5 Webgarden: the possibility to have multiple processes serving the same worker process
  • Joomla System (Page) Cache
  • Joomla View Cache (conservative or progressive): by the way, this type of cache doesn’t work well with some modules

I wouldn’t use the IIS7.5 built-in caching options as they mess up Joomla modules pretty badly.

View Cache No No Yes Yes Yes No No
Type of view cache N/A N/A Progressive Progressive Conservative N/A N/A
Page Cache Yes Yes No No No No No
Worker Process (Web Garden) 1 5 5 1 5 5 1
Errors 0 0 0 0 0 0 0
Avg time per page (seconds) 1.6 0.8 11 18 16 28 36
Pros SuperFast even under heavy load – no impact on events module (see view cache) SuperFast even under heavy load – no impact on events module (see view cache) Fast and component based. Fast and component based. Fast and component based. Always up to date due to no outdated cache Always up to date due to no outdated cache
Cons The admin area is not cachedThe hit counters are not incremented (we don’t use them) The admin area is not cachedThe hit counters are not incremented (we don’t use them) It causes an issue on the events page which we could probably solve It causes an issue on the events page which we could probably solve It causes an issue on the events page which we could probably solve Fast enough if server is unused but much slower under heavy load Fast enough if server is unused but much slower under heavy load

To conclude, I see no reasons for using anything more than page cache. View cache also seems interesting but you have to test each module and disable the ones that do not support it.

The webgarden is also a nice surprise, I never use it on ASP, ASP.NET websites as web gardens mess up a little Application variables but for Joomla, I haven’t experienced any problem yet.

Written by zantoro

December 23, 2012 at 11:15 pm

Posted in IIS, Joomla

Tagged with ,