Page 2 of 2

Re: Speed up your CMSMS site

Posted: Tue Apr 24, 2007 5:24 am
by Gregor
@jatinder: I use content type News, and the new index.php is not working correctly:
- not showing the news details when clicking Next (in my case 'meer'), and only showing the latest news item
- when entering the home page url, showing the latest news item

Hope this helps,
Gregor

Re: Speed up your CMSMS site

Posted: Tue Apr 24, 2007 8:04 pm
by Vin
Try setting the News not to be cachable (it can't be done with the content type News, though).

Re: Speed up your CMSMS site

Posted: Sat Apr 28, 2007 5:58 pm
by Vin
Another update...

Well, I underestimated the 'mact' variable; there may be issues with RSS in News and with probably other modules. So I put it back, but now it works even with pretty urls enabled.

And I realized that some still may need the 'timer' - although it may be annoying that the content doesn't upload immediately, it may suffice and it is faster.

Note: the following code is a hacked index.php from v1.06 now. It should work for older versions, though - problems may happen when reinstalling CMSMS - so for older versions, just replace the line 47-50 from

Code: Select all

    if (FALSE == is_file($dirname.'/install/index.php')) {
        die ('There is no config.php file or install/index.php please correct one these errors!');
    } else {
        redirect('install/');
to

Code: Select all

    if (FALSE == is_file($dirname.'/install/install.php')) {
        die ('There is no config.php file or install/install.php please correct one these errors!');
    } else {
        redirect('install/install.php');
Here you are:
[edit] now it should be correct.



[gelöscht durch Administrator]

Re: Speed up your CMSMS site

Posted: Wed Feb 06, 2008 3:01 pm
by Vin
Looks like the files were deleted...

Here are the snippets:

Changes for index.php (look up the beginnings and ends of the code):

Code: Select all

...

$pageinfo = PageInfoOperations::LoadPageInfoByContentAlias($page);

//Cache mod by Jatinder starts. Part 1
//mod by Vin - removed 'timer', mod for pretty urls, $page -> $pageinfo->content_id
//28 Apr 2007, 12:58
if($pageinfo->cachable) {
	$mcv = './tmp/cache/thind_' . md5($pageinfo->content_id) . '.inc.php';
	if (file_exists($mcv) && !isset($_REQUEST['mact'])) {
   	readfile($mcv);
  	$endtime = microtime();
  	$db =& $gCms->GetDb();
  	echo "<!-- Generated in ".microtime_diff($starttime,$endtime)." seconds by CMS Made Simple (cached) using ".(isset($db->query_count)?$db->query_count:'')." SQL queries -->\n";
  	exit();
  }
}
//Mod by Jatinder ends

if (isset($pageinfo) && $pageinfo !== FALSE)

...

Code: Select all

...

//Cache mod by Jatinder starts. Part 2
//mod by Vin - removed 'timer', mod for pretty urls, $page -> $pageinfo->content_id
//28 Apr 2007, 12:58
if($pageinfo->cachable) {
		if (!isset($_REQUEST['mact'])) {
  	$file = fopen($mcv,'w');
		fwrite($file, $html);
		fclose($file);
  }
}
//Mod by Jatinder ends

Events::SendEvent('Core', 'ContentPostRender', array('content' => &$html));

...
Without timer, sorry.

and for admin/editcontent.php:

Code: Select all

...

audit($contentobj->Id(), $contentobj->Name(), 'Edited Content');
			//Mod by Thind starts
			//13 Apr 2007
			
   	@unlink('../tmp/cache/thind_' . md5($contentobj->mId) . '.inc.php');//Mod by Vin
    clearstatcache();//Mod by Vin 14 Apr 2007
			//Mod by Thind ends
			if ($submit)

...
New: When editing template, changes don't take effect, as you have to clear cache to delete the cached pages to see the changed layout, same for HTML blobs (global content blocks) in the template. Hence you need a User Defined Tag like this appended to the [EDIT - Just realized this needs to be pre] [EDIT2 Really sorry, it should be:] EditTemplatePreCompile and GlobalContentPreCompile event
(All right, I little misunderstood the meaning of these events, I hope I wouldn't do a mistake again)
... to these events: EditGlobalContentPost, EditTemplatePost:

Code: Select all

global $gCms;
$contentops =& $gCms->GetContentOperations();
$contentops->ClearCache();
EDIT: Looks like changes to stylesheet don't take effect when using {static_stylesheet} tag, solution:
append the UDT above to EditStylesheetPost event.

Re: Speed up your CMSMS site

Posted: Tue Feb 12, 2008 5:03 pm
by nivekiam
oops, didn't see the sticky.  Removed post and posted to the sticky here.

Thanks Vin (see next post)

Re: Speed up your CMSMS site

Posted: Tue Feb 12, 2008 7:38 pm
by Vin
Didn't you write into the wrong thread? This one is for one specific hack, if I were you, I would add this post to sticky Speeding up CMSMS

This hack is specifically for static pages, it will even cache (turn into HTML) global content block. But I admit, it works only for pages with the caching activated; included plain HTML files may come in handy then...