For those of you who use OpenSEF in your Joomla site, you probably know that OpenSEF could make your site load much slower (and i mean really slow). This is caused by the huge OpenSEF query loads in MySQL.
Several days ago, I came to visit OpenSEF forum to check if the developers have released a new version of OpenSEF but apparently the new version still hasn’t release yet. Many OpenSEF users have been waiting this new release for ages, but still we have know clue when it will going to be release.
But, may be I was lucky at that time. Because I found an interesting thread on the forum in which one of the member has made a patch for OpenSEF that will make your Joomla + OpenSEF site load much quicker. I’ve tested this patch on one of my Joomla site which has more 500 articles and I was shock.
When I used the standard OpenSEF RC5_SP2 packages my site needed more than 10 seconds to load (I checked it with IwebTool Speed Test). Today, after I implemented the patch, I tested it again with IwebTool Speed Test and..wow! The site “only” need around 3 seconds to load. This is trully an amazing breakthrough for OpenSEF users. Many thanks alfim for making this patch, i love it!
Here’s how to do it. First make sure to backup these two files we’re about to edit and you might want to make your Joomla site offline for a while.
Open components/com_sef/sef.php file and find this query:
if ($sefSite->id == null) $sefSite->id = -1; $query = "SELECT * FROM #__opensef_sef WHERE published = '1'" . "\nAND valid = '1'" . "\nAND (direction IS NULL OR direction = '' OR direction = 'o')" . "\nAND (site_id IS NULL " . ($sefSite->id ? ' OR site_id = ' . $sefSite->id : '') . ')' . "\nORDER BY site_id DESC, published DESC, valid DESC, LENGTH(direction) DESC"; $database->setQuery( $query ); if ($database->loadResult()) { $opensef_aliases = $database->loadObjectList();
Open administrator/components/com_sef/sef.class.php, and find the lookupOutgoing() function and replace all of the lookupOutgoing() function with this one:
function lookupOutgoing( $site_id, $url ) { // static method global $opensef_aliases, $database; $returnaliases = array(); /* if ($site_id == null) $site_id = -1; if (count($opensef_aliases) > 0) { foreach($opensef_aliases as $aliases){ if ( $aliases->internal == $url ) { $returnaliases[] = $aliases; } } } */ if (!count($returnaliases)) { $query = "SELECT * FROM #__opensef_sef WHERE published = '1'" . "\nAND valid = '1'" . "\nAND (direction IS NULL OR direction = '' OR direction = 'o')" . "\nAND internal='$url'". "\nORDER BY site_id DESC, published DESC, valid DESC, LENGTH(direction) DESC limit 1"; $database->setQuery( $query ); if ($database->loadResult()) { $aliases = $database->loadObjectList(); foreach($aliases as $k=>$val) { $returnaliases[] = $val; } } } if (is_array( $returnaliases ) && count( $returnaliases )) { $returnaliases = xclCastObjectList( $returnaliases, 'JosOpenSEFAlias' ); return $returnaliases[0]; } $null = null; return $null; }
Please note that this patch only applies for OpenSEF RC5_SP2 with Multisite feature turned off. If you’ve activate Joomla cache then clean it first and logout from Joomla backend then test your site and see if it works.
More info about OpenSEF
Popularity: 3% [?]





Recent Comments