1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 22:57:14 +02:00

Prevent core pref corruption by old plugins that are using save_prefs();

This commit is contained in:
Cameron
2017-01-18 19:56:27 -08:00
parent 7ff00cec98
commit 7e6dbefd1a
2 changed files with 25 additions and 1 deletions

View File

@@ -1717,10 +1717,31 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
e107::getMessage()->addDebug('Deprecated save_prefs() backtrace:<pre>'."\n".print_r($backtrace, true).'</pre>');
}
switch($table)
{
case 'core':
//brute load, force update
if(count($pref) < 100) // precaution for old plugins
{
$backtrace = debug_backtrace(false);
e107::getAdminLog()->add(
'Core pref corruption avoided',
"Call to deprecated function save_prefs() (class2.php) with too few prefs. Backtrace:\n".print_r($backtrace, true),
E_LOG_INFORMATIVE,
'DEPRECATED'
);
e107::getMessage()->addDebug('Core-pref corruption avoided. Too few prefs sent to save_prefs(). Backtrace:<pre>'."\n".print_r($backtrace, true).'</pre>');
return false;
}
return e107::getConfig()->loadData($pref, false)->save(false, true);
break;