cosmetic
This commit is contained in:
parent
e4de299133
commit
497ff049bf
@ -18,17 +18,12 @@ class zcfsUpgrade
|
|||||||
{
|
{
|
||||||
public static function preUpgrade()
|
public static function preUpgrade()
|
||||||
{
|
{
|
||||||
//$current = dcCore::app()->plugins->moduleInfo(basename(dirname('../' . __DIR__)), 'version');
|
|
||||||
$current = dcCore::app()->getVersion(basename(dirname('../' . __DIR__)));
|
$current = dcCore::app()->getVersion(basename(dirname('../' . __DIR__)));
|
||||||
if ($current && version_compare($current, '2022.12.10', '<')) {
|
if ($current && version_compare($current, '2022.12.10', '<')) {
|
||||||
self::preUpgrade20221210();
|
self::preUpgrade20221210();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function postUpgrade()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function preUpgrade20221210()
|
protected static function preUpgrade20221210()
|
||||||
{
|
{
|
||||||
// Rename settings
|
// Rename settings
|
||||||
@ -51,10 +46,10 @@ class zcfsUpgrade
|
|||||||
$cur->update("WHERE setting_id = '" . $old . "' and setting_ns = 'zoneclearFeedServer' ");
|
$cur->update("WHERE setting_id = '" . $old . "' and setting_ns = 'zoneclearFeedServer' ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// use json rather than serialise
|
// use json rather than serialise for settings array
|
||||||
$setting_values = [
|
$setting_values = [
|
||||||
'post_full_tpl' => ['post', 'category', 'tag', 'archive'],
|
'post_full_tpl' => ['post', 'category', 'tag', 'archive'],
|
||||||
'post_title_redir' => ['feed']
|
'post_title_redir' => ['feed'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$record = dcCore::app()->con->select(
|
$record = dcCore::app()->con->select(
|
||||||
@ -62,8 +57,8 @@ class zcfsUpgrade
|
|||||||
"WHERE setting_ns = '" . dcCore::app()->con->escape(basename(dirname('../' . __DIR__))) . "' "
|
"WHERE setting_ns = '" . dcCore::app()->con->escape(basename(dirname('../' . __DIR__))) . "' "
|
||||||
);
|
);
|
||||||
|
|
||||||
while($record->fetch()) {
|
while ($record->fetch()) {
|
||||||
foreach($setting_values as $key => $default) {
|
foreach ($setting_values as $key => $default) {
|
||||||
try {
|
try {
|
||||||
$value = @unserialize($record->__get($key));
|
$value = @unserialize($record->__get($key));
|
||||||
} catch(Exception) {
|
} catch(Exception) {
|
||||||
@ -73,7 +68,7 @@ class zcfsUpgrade
|
|||||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
||||||
$cur->setting_value = json_encode(!is_array($value) ? $default : $value);
|
$cur->setting_value = json_encode(!is_array($value) ? $default : $value);
|
||||||
$cur->update(
|
$cur->update(
|
||||||
"WHERE setting_id = '" . $key . "' and setting_ns = '" . $record->setting_ns . "' " .
|
"WHERE setting_id = '" . $key . "' and setting_ns = '" . dcCore::app()->con->escape($record->setting_ns) . "' " .
|
||||||
'AND blog_id ' . (null === $record->blog_id ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->blog_id) . "' "))
|
'AND blog_id ' . (null === $record->blog_id ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->blog_id) . "' "))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user