icecoder/ICEcoder

Serialize settings

Closed this issue · 3 comments

Right now the system and user settings are stored in PHP arrays in files and string manipulation and updating is needed on config change in either.

This makes things very fragile and hard to update as settings are added, updated or deleted.

Move to the same system the indexer and git diffs use - unserialize, update and save serliazed again.

In doing this ensure that it's easy for the single user/first multi user (therefore admin) to set settings via the UI, eg allowRegistration, multiUser etc etc.

Old config settings:

"versionNo"		=> "7.0",
"docRoot"		=> $_SERVER[\'DOCUMENT_ROOT\'],	// Set absolute path of another location if needed
"demoMode"		=> false,
"fileDirResOutput"	=> "none",			// Can be none, raw, object, both (all but \'none\' output to console)
"loginRequired"		=> true,
"multiUser"		=> false,
"languageBase"		=> "english.php",
"lineEnding"		=> "\n",
"newDirPerms"		=> 755,
"newFilePerms"		=> 644,
"enableRegistration"	=> true

New:

a:9:{s:13:"loginRequired";b:1;s:18:"enableRegistration";b:1;s:9:"multiUser";b:0;s:8:"demoMode";b:0;s:11:"newDirPerms";i:755;s:12:"newFilePerms";i:644;s:16:"fileDirResOutput";s:4:"none";s:10:"lineEnding";s:2:"\n";s:12:"languageBase";s:11:"english.php";}

versionNo and docRoot have moved to the Settings.php class in the constructor.

Old user config settings:

"versionNo" => "7.0",
"licenseEmail" => "v7free@icecoder.net",
"licenseCode" => "93be18fba1dee0e186031907422a0f8df3462568bfd0161e1504",
"configCreateDate" => 0,
"root" => "",
"checkUpdates" => true,
"openLastFiles" => true,
"updateDiffOnSave" => true,
"languageUser" => "english.php",
"backupsKept" => true,
"backupsDays" => 14,
"deleteToTmp" => true,
"findFilesExclude" => [".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip"],
"codeAssist" => true,
"visibleTabs" => false,
"lockedNav" => true,
"tagWrapperCommand" => "ctrl+alt",
"autoComplete" => "keypress",
"password" => "",
"bannedFiles" => [],
"bannedPaths" => ["/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"],
"allowedIPs" => ["*"],
"autoLogoutMins" => 0,
"theme" => "default",
"fontSize" => "13px",
"lineWrapping" => false,
"lineNumbers" => true,
"showTrailingSpace" => true,
"matchBrackets" => true,
"autoCloseTags" => true,
"autoCloseBrackets" => true,
"indentWithTabs" => false,
"indentAuto" => true,
"indentSize" => 4,
"pluginPanelAligned" => "left",
"scrollbarStyle" => "overlay",
"bugFilePaths" => [],
"bugFileCheckTimer" => 0,
"bugFileMaxLines" => 0,
"plugins" => [],
"ftpSites" => [],
"tutorialOnLogin" => true,
"tipsOnLogin" => true,
"previousFiles" => "",
"last10Files" => "",
"favoritePaths" => []
];

New:
a:46:{s:9:"versionNo";s:3:"7.0";s:12:"licenseEmail";s:19:"v7free@icecoder.net";s:11:"licenseCode";s:52:"93be18fba1dee0e186031907422a0f8df3462568bfd0161e1504";s:16:"configCreateDate";i:0;s:4:"root";s:0:"";s:12:"checkUpdates";b:1;s:13:"openLastFiles";b:1;s:16:"updateDiffOnSave";b:1;s:12:"languageUser";s:11:"english.php";s:11:"backupsKept";b:1;s:11:"backupsDays";i:14;s:11:"deleteToTmp";b:1;s:16:"findFilesExclude";a:9:{i:0;s:4:".doc";i:1;s:4:".gif";i:2;s:4:".jpg";i:3;s:5:".jpeg";i:4;s:4:".pdf";i:5;s:4:".png";i:6;s:4:".swf";i:7;s:4:".xml";i:8;s:4:".zip";}s:10:"codeAssist";b:1;s:11:"visibleTabs";b:0;s:9:"lockedNav";b:1;s:17:"tagWrapperCommand";s:8:"ctrl+alt";s:12:"autoComplete";s:8:"keypress";s:8:"password";s:0:"";s:11:"bannedFiles";a:0:{}s:11:"bannedPaths";a:3:{i:0;s:13:"/var/www/.git";i:1;s:26:"/var/www/sites/all/modules";i:2;s:28:"/var/www/sites/default/files";}s:10:"allowedIPs";a:1:{i:0;s:1:"*";}s:14:"autoLogoutMins";i:0;s:5:"theme";s:7:"default";s:8:"fontSize";s:4:"13px";s:12:"lineWrapping";b:0;s:11:"lineNumbers";b:1;s:17:"showTrailingSpace";b:1;s:13:"matchBrackets";b:1;s:13:"autoCloseTags";b:1;s:17:"autoCloseBrackets";b:1;s:10:"indentType";s:6:"spaces";s:10:"indentAuto";b:1;s:10:"indentSize";i:4;s:18:"pluginPanelAligned";s:4:"left";s:14:"scrollbarStyle";s:7:"overlay";s:12:"bugFilePaths";a:0:{}s:17:"bugFileCheckTimer";i:0;s:15:"bugFileMaxLines";i:0;s:7:"plugins";a:0:{}s:8:"ftpSites";a:0:{}s:15:"tutorialOnLogin";b:1;s:11:"tipsOnLogin";b:1;s:13:"previousFiles";a:0:{}s:11:"last10Files";a:0:{}s:13:"favoritePaths";a:0:{}}

Now using serialized settings, admin/first user to be covered in another issue, so OK to close this.