CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#6394] Add/Edit Content doesn't clear cache

avatar
Created By: Richard Johnson (WebAddict)
Date Submitted: Wed Apr 13 18:54:49 -0400 2011

Assigned To:
Version: 1.9.4.1
CMSMS Version: None
Severity: Minor
Resolution: Invalid
State: Closed
Summary:
Add/Edit Content doesn't clear cache
Detailed Description:
Annoying Bug: When we add a page to cmsms, it doesn't show up in the admin's
content list, and the page doesn't work until the cache is cleared, which we
were using the move page up/down to get new pages to work.

I tracked it down, here's the fix.

### File #1: in /admin/addcontent.php find block:
			$contentobj->Save();
			global $gCms;
			$contentops =& $gCms->GetContentOperations();
			$contentops->SetAllHierarchyPositions();
			if ($submit)
			{
				audit($contentobj->Id(), $contentobj->Name(), 'Added Content');
				redirect('listcontent.php'.$urlext.'&message=contentadded');
			}

after $contentops->SetAllHierarchyPositions(); add:
			$contentops->ClearCache();

completed block should look like:
			$contentobj->Save();
			global $gCms;
			$contentops =& $gCms->GetContentOperations();
			$contentops->SetAllHierarchyPositions();
			$contentops->ClearCache();
			if ($submit)
			{
				audit($contentobj->Id(), $contentobj->Name(), 'Added Content');
				redirect('listcontent.php'.$urlext.'&message=contentadded');
			}



#### File #2: in /admin/addcontent.php find block:
	      $contentobj->SetLastModifiedBy(get_userid());
	      $contentobj->Save();
	      $contentops =& $gCms->GetContentOperations();
	      $contentops->SetAllHierarchyPositions();
	      audit($contentobj->Id(), $contentobj->Name(), 'Edited Content');

after $contentops->SetAllHierarchyPositions(); add:
	      $contentops->ClearCache();

completed block should look like:
	      $contentobj->SetLastModifiedBy(get_userid());
	      $contentobj->Save();
	      $contentops =& $gCms->GetContentOperations();
	      $contentops->SetAllHierarchyPositions();
	      $contentops->ClearCache();
	      audit($contentobj->Id(), $contentobj->Name(), 'Edited Content');



I'm guessing that there could be other places to fix this. It's probably all
instances of $contentops->SetAllHierarchyPositions(); needs to clear the cache
after.


History

Comments
avatar
Date: 2011-04-13 19:40
Posted By: Robert Campbell (calguy1000)

Fix your timezone settings.
      
avatar
Date: 2011-04-13 20:02
Posted By: Richard Johnson (WebAddict)

Fixing my timezone fixed original problem.

Wierd that timezone settings has something to do with the cache. Reviewing the
settings, my timezone was set for America/Los_Angeles when it should be
America/Chicago. Site was hosted by Dreamhost in California, but is now hosted
by Host Gator in Texas. I've had this problem ever since the move.

Thanks
      
avatar
Date: 2011-04-19 15:37
Posted By: Ronny Krijt (ronnyk)

TZ setting is required with php5.3
      
Updates

Updated: 2011-04-19 15:37
state: Open => Closed

Updated: 2011-04-13 19:40
resolution_id: => 9