Files
typecho/var/Utils/Upgrade.php
T
joyqi e89b1bbcf6 Feat/tree pages (#1646)
* add tree trait

* finish category tree trait

* support select fields

* fix select fields

* refactor admin trait

* fix draft status

* Add new contents type "revision"

* minor refactor

* add more tree view abstracts

* add tree trait to pages

* get ready for tree view pages

* improve page edit

* fix revision

* fix slug

* add router params delegate

* fix params delegate

* fix

* fix

* fix all

* fix all

* fix tree

* fix page link

* fix feed

* fix page

* fix permalink

* fix permalink input

* fix offset query
2023-11-27 21:57:18 -08:00

54 lines
1.4 KiB
PHP

<?php
namespace Utils;
use Typecho\Db;
use Widget\Options;
/**
* 升级程序
*
* @category typecho
* @package Upgrade
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
* @license GNU General Public License 2.0
*/
class Upgrade
{
/**
* @param Db $db
* @param Options $options
*/
public static function v1_3_0(Db $db, Options $options)
{
$routingTable = $options->routingTable;
$routingTable['comment_page'] = [
'url' => '[permalink:string]/comment-page-[commentPage:digital]',
'widget' => '\Widget\CommentPage',
'action' => 'action'
];
$routingTable['feed'] = [
'url' => '/feed[feed:string:0]',
'widget' => '\Widget\Feed',
'action' => 'render'
];
unset($routingTable[0]);
$db->query($db->update('table.options')
->rows(['value' => serialize($routingTable)])
->where('name = ?', 'routingTable'));
// fix options->commentsRequireURL
$db->query($db->update('table.options')
->rows(['name' => 'commentsRequireUrl'])
->where('name = ?', 'commentsRequireURL'));
$db->query($db->update('table.contents')
->rows(['type' => 'revision'])
->where('parent <> 0 AND (type = ? OR type = ?)', 'post_draft', 'page_draft'));
}
}