Section Schemas
Reflect your section structures into page XML
New#4: Unable to create new section schemas
Heya, I get the EXACT error. This happens when I select a section within the 'Section Schemas' control area and click the 'Save Changes' button. Any ideas?
I'm also getting this error, and I was able to tame it with the following solution.
First, a little context:
Section Schemas works by creating actual .php files on your server containing the datasource information. When using Section Schemas (SS), you are given a multiple select list of all the sections on your site. You select the sections you want SS to build a datasource for, or deselect the sections you want SS to remove the datasource for. When you click "Save", SS iterates through every section in the list and attempts to do the follow: delete the data.sectionschema(sectionname).php datasource file if the section isn't selected; or, create the data.sectionschema(sectionname).php if the section is selected.
The "if(!@unlink($file)){" chunk you are seeing in the error report is the code Symphony is using to try and delete data.sectionschema(section_name).php. While this is supposed to die quietly when the file doesn't exist, for some reason it's failing to check for the file before attempting to delete it.
I was able to fix this by wrapping that "if(!@unlink($file)){...}" statement in /symphony/lib/toolkit/class.general.php with another 'if' statement that explicitly checks for the existence of the file.
public static function deleteFile($file, $slient=true){ **if (file_exists($file)) {** if(!@unlink($file)){ if($slient == false){ throw new Exception(__('Unable to remove file - %s', array($file))); } return false; } **}** return true; }
Of course, the real issue here is PHP failing to run the '!@unlink($file)' statement correctly, so this only fixes the symptom, not the disease.
Yikes, I derped and botched the formatting in that post, so to clarify:
- open symphony/lib/toolkit/class.general.php and find the deleteFile function on line 810
change the function to the following code:
public static function deleteFile($file, $slient=true){ if (file_exists($file)) { if(!@unlink($file)){ if($slient == false){ throw new Exception(__('Unable to remove file - %s', array($file))); } return false; } } return true; }
Apologies for the derp double-post— had my wrists slapped when I tried to edit the first. Remember, this doesn't solve the real problem (PHP is at fault, not Symphony methinks), just works around it.
Please login to comment.
When trying to create a new schema, I get the following error: