Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/wwwroot/zhuchunshu.com/wp-includes/wp-db.php on line 2056
typecho设置外观备份和恢复 - VPS测评推荐网站 - 朱纯树博客
Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/wwwroot/zhuchunshu.com/wp-includes/wp-db.php on line 2056
Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/wwwroot/zhuchunshu.com/wp-includes/wp-db.php on line 2056
class="post-template-default single single-post postid-6547 single-format-standard m-excerpt-cat comment-open site-layout-2 text-justify-on m-sidebar">
朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

typecho设置外观备份和恢复

我一直在用的一个主题“设置外观”的数据备份和恢复,我喜欢经常更换主题(同时也很喜欢改),所以看到有些没有设置备份的都可以加这段代码,到目前为止没有发现任何问题,不需要修改任何数据,直接复制粘贴到你的主题设置外观的代码前面即可(不告诉我不知道插哪,只要会改主题的人都明白)。

这是代码:

//外观设置备份
$str1 = explode('/themes/', Helper::options()->themeUrl);
$str2 = explode('/', $str1[1]);
$name=$str2[0];
$db = Typecho_Db::get();
$sjdq=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name));
$ysj = $sjdq['value'];
if(isset($_POST['type']))
{ 
if($_POST["type"]=="备份模板设置数据"){
if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
$update = $db->update('table.options')->rows(array('value'=>$ysj))->where('name = ?', 'theme:'.$name.'bf');
$updateRows= $db->query($update);
echo '<div class="tongzhi col-mb-12 home">备份已更新,请等待自动刷新!如果等不到请点击';
?>    
<a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
<script language="JavaScript">window.setTimeout("location='<?php Helper::options()->adminUrl('options-theme.php'); ?>'", 2500);</script>
<?php
}else{
if($ysj){
     $insert = $db->insert('table.options')
    ->rows(array('name' => 'theme:'.$name.'bf','user' => '0','value' => $ysj));
     $insertId = $db->query($insert);
echo '<div class="tongzhi col-mb-12 home">备份完成,请等待自动刷新!如果等不到请点击';
?>    
<a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
<script language="JavaScript">window.setTimeout("location='<?php Helper::options()->adminUrl('options-theme.php'); ?>'", 2500);</script>
<?php
}
}
        }
if($_POST["type"]=="还原模板设置数据"){
if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
$sjdub=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'));
$bsj = $sjdub['value'];
$update = $db->update('table.options')->rows(array('value'=>$bsj))->where('name = ?', 'theme:'.$name);
$updateRows= $db->query($update);
echo '<div class="tongzhi col-mb-12 home">检测到模板备份数据,恢复完成,请等待自动刷新!如果等不到请点击';
?>    
<a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
<script language="JavaScript">window.setTimeout("location='<?php Helper::options()->adminUrl('options-theme.php'); ?>'", 2000);</script>
<?php
}else{
echo '<div class="tongzhi col-mb-12 home">没有模板备份数据,恢复不了哦!</div>';
}
}
if($_POST["type"]=="删除备份数据"){
if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
$delete = $db->delete('table.options')->where ('name = ?', 'theme:'.$name.'bf');
$deletedRows = $db->query($delete);
echo '<div class="tongzhi col-mb-12 home">删除成功,请等待自动刷新,如果等不到请点击';
?>    
<a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
<script language="JavaScript">window.setTimeout("location='<?php Helper::options()->adminUrl('options-theme.php'); ?>'", 2500);</script>
<?php
}else{
echo '<div class="tongzhi col-mb-12 home">不用删了!备份不存在!!!</div>';
}
}
    }
echo '<form class="protected home col-mb-12" action="?'.$name.'bf" method="post">
<input type="submit" name="type" class="btn btn-s" value="备份模板设置数据" />&nbsp;&nbsp;<input type="submit" name="type" class="btn btn-s" value="还原模板设置数据" />&nbsp;&nbsp;<input type="submit" name="type" class="btn btn-s" value="删除备份数据" /></form>';
赞(2) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » typecho设置外观备份和恢复

相关推荐

  • 暂无文章

评论 7

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #0

    Enjoyed the read

    Bukakke8个月前 (04-27)回复
  2. #0

    Good post as usual

    boceta8个月前 (04-25)回复
  3. #0

    Any similar content?

    Free Porn8个月前 (04-24)回复
  4. #0

    Loved every word

    Bukakke8个月前 (04-24)回复
  5. #0

    Another good post

    Gambling8个月前 (04-23)回复
  6. #0

    Awesome

    cnut8个月前 (04-23)回复
  7. #0

    Awesome

    cnut8个月前 (04-22)回复