private function parseFileName($fileName, $repositoryPath) { $result = array('do' => 'publish', 'allowComment' => $this->options->defaultAllowComment, 'allowPing' => $this->options->defaultAllowPing, 'allowFeed' => $this->options->defaultAllowFeed); $basePath = Helper::options()->plugin('GoogleCodeSVN')->basePath; $basePath = '/' . trim($basePath, '/') . '/'; if (0 !== strpos($fileName, $basePath)) { return false; } $path = substr($fileName, strlen($basePath)); $part = explode('/', $path); if (2 != count($part)) { return false; } list($categoryName, $baseName) = $part; list($slug) = explode('.', $baseName); $result['slug'] = $slug; $post = $this->db->fetchRow($this->db->select()->from('table.contents')->where('slug = ?', $slug)->limit(1)); if (!empty($post)) { if ('post' != $post['type']) { return false; } else { $result['cid'] = $post['cid']; } } /** 将目录作为分类缩略名处理 */ $categorySlug = Typecho_Common::slugName($categoryName); $category = $this->db->fetchRow($this->db->select()->from('table.metas')->where('slug = ? OR name = ?', $categorySlug, $categoryName)->where('type = ?', 'category')->limit(1)); /** 如果分类不存在则直接重建分类 */ if (empty($category)) { $input['name'] = $categoryName; $input['slug'] = $categorySlug; $input['type'] = 'category'; $input['description'] = $categoryName; $input['do'] = 'insert'; $this->widget('Widget_Metas_Category_Edit', NULL, $input, false)->action(); $result['category'] = array($this->widget('Widget_Notice')->getHighlightId()); } else { $result['category'] = array($category['mid']); } $url = rtrim($repositoryPath, '/') . $fileName; $client = Typecho_Http_Client::get('Curl', 'Socket'); if (false == $client) { return false; } $client->send($url); $result['text'] = ''; $result['title'] = ''; if (200 == $client->getResponseStatus() || 304 == $client->getResponseStatus()) { $response = trim($client->getResponseBody()); list($title, $text) = explode("\n", $response, 2); $result['title'] = $title; $result['text'] = $text; } return $result; }
/** * 为内容应用缩略名 * * @access public * @param string $slug 缩略名 * @param mixed $cid 内容id * @return string */ public function applySlug($slug, $cid) { if ($cid instanceof Typecho_Db_Query) { $cid = $this->db->fetchObject($cid->select('cid')->from('table.contents')->limit(1))->cid; } /** 生成一个非空的缩略名 */ $slug = Typecho_Common::slugName($slug, $cid); $result = $slug; /** 对草稿的slug做特殊处理 */ $draft = $this->db->fetchObject($this->db->select('type', 'parent')->from('table.contents')->where('cid = ?', $cid)); if ('_draft' == substr($draft->type, -6) && $draft->parent) { $result = '@' . $result; } /** 判断是否在数据库中已经存在 */ $count = 1; while ($this->db->fetchObject($this->db->select(array('COUNT(cid)' => 'num'))->from('table.contents')->where('slug = ? AND cid <> ?', $result, $cid))->num > 0) { $result = $slug . '-' . $count; $count++; } $this->db->query($this->db->update('table.contents')->rows(array('slug' => $result))->where('cid = ?', $cid)); return $result; }
/** * 根据tag获取ID * * @access public * @param mixed $inputTags 标签名 * @return array */ public function scanTags($inputTags) { $tags = is_array($inputTags) ? $inputTags : array($inputTags); $result = array(); foreach ($tags as $tag) { if (empty($tag)) { continue; } $row = $this->db->fetchRow($this->select()->where('type = ?', 'tag')->where('name = ?', $tag)->limit(1)); if ($row) { $result[] = $row['mid']; } else { $slug = Typecho_Common::slugName($tag); if ($slug) { $result[] = $this->insert(array('name' => $tag, 'slug' => $slug, 'type' => 'tag', 'count' => 0, 'order' => 0)); } } } return is_array($inputTags) ? $result : current($result); }
/** * 添加一个新的分类 * * @param int $blogId * @param string $userName * @param string $password * @param struct $category * @access public * @return void */ public function wpNewCategory($blogId, $userName, $password, $category) { if (!$this->checkAccess($userName, $password)) { return $this->error; } /** 开始接受数据 */ $input['name'] = $category['name']; $input['slug'] = Typecho_Common::slugName(empty($category['slug']) ? $category['name'] : $category['slug']); $input['type'] = 'category'; $input['description'] = isset($category['description']) ? $category['description'] : $category['name']; $input['do'] = 'insert'; /** 调用已有组件 */ try { /** 插入 */ $this->singletonWidget('Widget_Metas_Category_Edit', NULL, $input, false)->action(); return $this->singletonWidget('Widget_Notice')->getHighlightId() ? true : false; } catch (Typecho_Widget_Exception $e) { return new IXR_Error($e->getCode(), $e->getMessage()); } return true; }
/** * 更新分类 * * @access public * @return void */ public function updateCategory() { if ($this->form('update')->validate()) { $this->response->goBack(); } /** 取出数据 */ $category = $this->request->from('name', 'slug', 'description'); $category['slug'] = Typecho_Common::slugName(empty($category['slug']) ? $category['name'] : $category['slug']); $category['type'] = 'category'; /** 更新数据 */ $this->update($category, $this->db->sql()->where('mid = ?', $this->request->filter('int')->mid)); $category['mid'] = $this->request->mid; $this->push($category); /** 设置高亮 */ $this->widget('Widget_Notice')->highlight($this->theId); /** 提示信息 */ $this->widget('Widget_Notice')->set(_t('分类 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->name), 'success'); /** 转向原页 */ $this->response->redirect(Typecho_Common::url('manage-metas.php', $this->options->adminUrl)); }
/** * 更新文件 * * @access public * @return void */ public function updateAttachment() { if ($this->form('update')->validate()) { $this->response->goBack(); } /** 取出数据 */ $input = $this->request->from('name', 'slug', 'description'); $input['slug'] = Typecho_Common::slugName(empty($input['slug']) ? $input['name'] : $input['slug']); $attachment['title'] = $input['name']; $attachment['slug'] = $input['slug']; $content = unserialize($this->attachment->__toString()); $content['description'] = $input['description']; $attachment['text'] = serialize($content); $cid = $this->request->filter('int')->cid; /** 更新数据 */ $updateRows = $this->update($attachment, $this->db->sql()->where('cid = ?', $cid)); if ($updateRows > 0) { $this->db->fetchRow($this->select()->where('table.contents.type = ?', 'attachment')->where('table.contents.cid = ?', $cid)->limit(1), array($this, 'push')); /** 设置高亮 */ $this->widget('Widget_Notice')->highlight($this->theId); /** 提示信息 */ $this->widget('Widget_Notice')->set('publish' == $this->status ? _t('文件 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->title) : _t('未归档文件 %s 已经被更新', $this->title), 'success'); } /** 转向原页 */ $this->response->redirect(Typecho_Common::url('manage-medias.php?' . $this->getPageOffsetQuery($cid, $this->status), $this->options->adminUrl)); }
/** * 更新分类 * * @access public * @return void */ public function updateCategory() { if ($this->form('update')->validate()) { $this->response->goBack(); } /** 取出数据 */ $category = $this->request->from('name', 'slug', 'keywords', 'template', 'description', 'parent'); $category['mid'] = $this->request->mid; $category['slug'] = Typecho_Common::slugName(empty($category['slug']) ? $category['name'] : $category['slug']); $category['type'] = 'category'; $current = $this->db->fetchRow($this->select()->where('mid = ?', $category['mid'])); if ($current['parent'] != $category['parent']) { $parent = $this->db->fetchRow($this->select()->where('mid = ?', $category['parent'])); if ($parent['mid'] == $category['mid']) { $category['order'] = $parent['order']; $this->update(array('parent' => $current['parent'], 'order' => $current['order']), $this->db->sql()->where('mid = ?', $parent['mid'])); } else { $category['order'] = $this->getMaxOrder('category', $category['parent']) + 1; } } /** 更新数据 */ $this->update($category, $this->db->sql()->where('mid = ?', $this->request->filter('int')->mid)); $this->push($category); /** 设置高亮 */ $this->widget('Widget_Notice')->highlight($this->theId); /** 提示信息 */ $this->widget('Widget_Notice')->set(_t('分类 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->name), 'success'); /** 转向原页 */ $this->response->redirect(Typecho_Common::url('manage-categories.php' . ($category['parent'] ? '?parent=' . $category['parent'] : ''), $this->options->adminUrl)); }
public function doImport() { $options = $this->widget('Widget_Options'); $dbConfig = $options->plugin('WordpressToTypecho'); /** 初始化一个db */ if (Typecho_Db_Adapter_Mysql::isAvailable()) { $db = new Typecho_Db('Mysql', $dbConfig->prefix); } else { $db = new Typecho_Db('Pdo_Mysql', $dbConfig->prefix); } /** 只读即可 */ $db->addServer(array('host' => $dbConfig->host, 'user' => $dbConfig->user, 'password' => $dbConfig->password, 'charset' => 'utf8', 'port' => $dbConfig->port, 'database' => $dbConfig->database), Typecho_Db::READ); /** 删除当前内容 */ $masterDb = Typecho_Db::get(); $this->widget('Widget_Abstract_Contents')->to($contents)->delete($masterDb->sql()->where('1 = 1')); $this->widget('Widget_Abstract_Comments')->to($comments)->delete($masterDb->sql()->where('1 = 1')); $this->widget('Widget_Abstract_Metas')->to($metas)->delete($masterDb->sql()->where('1 = 1')); $this->widget('Widget_Contents_Post_Edit')->to($edit); $masterDb->query($masterDb->delete('table.relationships')->where('1 = 1')); $userId = $this->widget('Widget_User')->uid; /** 获取时区偏移 */ $gmtOffset = idate('Z'); /** 转换全局变量 */ /** $rows = $db->fetchAll($db->select()->from('table.statics')); $static = array(); foreach ($rows as $row) { $static[$row['static_name']] = $row['static_value']; }*/ /** 转换文件 */ /**$files = $db->fetchAll($db->select()->from('table.files')); if (!is_dir(__TYPECHO_ROOT_DIR__ . '/usr/uploads/')) { mkdir(__TYPECHO_ROOT_DIR__ . '/usr/uploads/', 0766); } $pattern = array(); $replace = array(); foreach ($files as $file) { $path = __TYPECHO_ROOT_DIR__ . '/data/upload/' . substr($file['file_guid'], 0, 2) . '/' . substr($file['file_guid'], 2, 2) . '/' . $file['file_guid']; if (is_file($path)) { $file['file_time'] = empty($file['file_time']) ? $options->gmtTime : $file['file_time']; $year = idate('Y', $file['file_time']); $month = idate('m', $file['file_time']); $day = idate('d', $file['file_time']); if (!is_dir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}")) { mkdir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}", 0766); } if (!is_dir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}/{$month}")) { mkdir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}/{$month}", 0766); } if (!is_dir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}/{$month}/{$day}")) { mkdir(__TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}/{$month}/{$day}", 0766); } $parts = explode('.', $file['file_name']); $ext = array_pop($parts); copy($path, __TYPECHO_ROOT_DIR__ . "/usr/uploads/{$year}/{$month}/{$day}/{$file['file_id']}.{$ext}"); $new = Typecho_Common::url("/usr/uploads/{$year}/{$month}/{$day}/{$file['file_id']}.{$ext}", $options->siteUrl); $old = Typecho_Common::url("/res/{$file['file_id']}/{$file['file_name']}", $static['siteurl'] . '/index.php'); $pattern[] = '/' . str_replace('\/index\.php', '(\/index\.php)?', preg_quote($old, '/')) . '/is'; $replace[] = $new; } } */ /** 转换评论 */ $i = 1; while (true) { $result = $db->query($db->select()->from('table.comments')->order('comment_ID', Typecho_Db::SORT_ASC)->page($i, 100)); $j = 0; while ($row = $db->fetchRow($result)) { $status = $row['comment_approved']; if ('spam' == $row['comment_approved']) { $status = 'spam'; } else { if ('0' == $row['comment_approved']) { $status = 'waiting'; } else { $status = 'approved'; } } $row['comment_content'] = preg_replace(array("/\\s*<p>/is", "/\\s*<\\/p>\\s*/is", "/\\s*<br\\s*\\/>\\s*/is", "/\\s*<(div|blockquote|pre|table|ol|ul)>/is", "/<\\/(div|blockquote|pre|table|ol|ul)>\\s*/is"), array('', "\n\n", "\n", "\n\n<\\1>", "</\\1>\n\n"), $row['comment_content']); $comments->insert(array('coid' => $row['comment_ID'], 'cid' => $row['comment_post_ID'], 'created' => strtotime($row['comment_date_gmt']) + $gmtOffset, 'author' => $row['comment_author'], 'authorId' => $row['user_id'], 'ownerId' => 1, 'mail' => $row['comment_author_email'], 'url' => $row['comment_author_url'], 'ip' => $row['comment_author_IP'], 'agent' => $row['comment_agent'], 'text' => $row['comment_content'], 'type' => empty($row['comment_type']) ? 'comment' : $row['comment_type'], 'status' => $status, 'parent' => $row['comment_parent'])); $j++; unset($row); } if ($j < 100) { break; } $i++; unset($result); } /** 转换Wordpress的term_taxonomy表 */ $terms = $db->fetchAll($db->select()->from('table.term_taxonomy')->join('table.terms', 'table.term_taxonomy.term_id = table.terms.term_id')->where('taxonomy = ? OR taxonomy = ?', 'category', 'post_tag')); foreach ($terms as $term) { $metas->insert(array('mid' => $term['term_taxonomy_id'], 'name' => $term['name'], 'slug' => 'post_tag' == $term['taxonomy'] ? Typecho_Common::slugName($term['name']) : $term['slug'], 'type' => 'post_tag' == $term['taxonomy'] ? 'tag' : 'category', 'description' => $term['description'], 'count' => $term['count'])); /** 转换关系表 */ $relationships = $db->fetchAll($db->select()->from('table.term_relationships')->where('term_taxonomy_id = ?', $term['term_taxonomy_id'])); foreach ($relationships as $relationship) { $masterDb->query($masterDb->insert('table.relationships')->rows(array('cid' => $relationship['object_id'], 'mid' => $relationship['term_taxonomy_id']))); } } /** 转换内容 */ $i = 1; while (true) { $result = $db->query($db->select()->from('table.posts')->where('post_type = ? OR post_type = ?', 'post', 'page')->order('ID', Typecho_Db::SORT_ASC)->page($i, 100)); $j = 0; while ($row = $db->fetchRow($result)) { $contents->insert(array('cid' => $row['ID'], 'title' => $row['post_title'], 'slug' => Typecho_Common::slugName(urldecode($row['post_name']), $row['ID'], 128), 'created' => strtotime($row['post_date_gmt']) + $gmtOffset, 'modified' => strtotime($row['post_modified_gmt']) + $gmtOffset, 'text' => $row['post_content'], 'order' => $row['menu_order'], 'authorId' => $row['post_author'], 'template' => NULL, 'type' => 'page' == $row['post_type'] ? 'page' : 'post', 'status' => 'publish' == $row['post_status'] ? 'publish' : 'draft', 'password' => $row['post_password'], 'commentsNum' => $row['comment_count'], 'allowComment' => 'open' == $row['comment_status'] ? '1' : '0', 'allowFeed' => '1', 'allowPing' => 'open' == $row['ping_status'] ? '1' : '0')); $j++; unset($row); } if ($j < 100) { break; } $i++; unset($result); } $this->widget('Widget_Notice')->set(_t("数据已经转换完成"), NULL, 'success'); $this->response->goBack(); }
/** * 添加一个新的分类 * * @param int $blogId * @param string $userName * @param string $password * @param struct $category * @access public * @return void */ public function wpNewCategory($blogId, $userName, $password, $category) { if (!$this->checkAccess($userName, $password)) { return $this->error; } /** 开始接受数据 */ $input['name'] = $category['name']; $input['slug'] = Typecho_Common::slugName(empty($category['slug']) ? $category['name'] : $category['slug']); $input['parent'] = isset($category['parent_id']) ? $category['parent_id'] : (isset($category['parent']) ? $category['parent'] : 0); $input['description'] = isset($category['description']) ? $category['description'] : $category['name']; $input['do'] = 'insert'; /** 调用已有组件 */ try { /** 插入 */ $categoryWidget = $this->singletonWidget('Widget_Metas_Category_Edit', NULL, $input, false); $categoryWidget->action(); return $categoryWidget->mid; } catch (Typecho_Widget_Exception $e) { return new IXR_Error($e->getCode(), $e->getMessage()); } return new IXR_Error(403, _t('无法添加分类')); }
/** * 更新标签 * * @access public * @return void */ public function updateTag() { if ($this->form('update')->validate()) { $this->response->goBack(); } /** 取出数据 */ $tag = $this->request->from('name', 'slug', 'mid'); $tag['type'] = 'tag'; $tag['slug'] = Typecho_Common::slugName(empty($tag['slug']) ? $tag['name'] : $tag['slug']); /** 更新数据 */ $this->update($tag, $this->db->sql()->where('mid = ?', $this->request->filter('int')->mid)); $this->push($tag); /** 设置高亮 */ $this->widget('Widget_Notice')->highlight($this->theId); /** 提示信息 */ $this->widget('Widget_Notice')->set(_t('标签 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->name), NULL, 'success'); /** 转向原页 */ $this->response->redirect(Typecho_Common::url('manage-metas.php?type=tag', $this->options->adminUrl)); }
/** * 生成缩略名 * * @access private * @param string $slug 投稿缩略名 * @return void */ private function _applySlug($slug, $cid = NULL) { $slug = Typecho_Common::slugName($slug, $cid); $result = $slug; $count = 1; while ($this->_db->fetchObject($this->_db->select(array('COUNT(cid)' => 'num'))->from('table.contents')->where('slug = ?', $result))->num > 0) { $result = $slug . '-' . $count; $count++; } return $result; }
public function doImport() { /* 获取配置 */ $options = $this->widget('Widget_Options'); $dbConfig = $options->plugin('EmlogToTypecho'); /* 初始化一个db */ if (Typecho_Db_Adapter_Mysql::isAvailable()) { $db = new Typecho_Db('Mysql', $dbConfig->prefix); } else { $db = new Typecho_Db('Pdo_Mysql', $dbConfig->prefix); } /* 只读即可 */ $db->addServer(array('host' => $dbConfig->host, 'user' => $dbConfig->user, 'password' => $dbConfig->password, 'charset' => 'utf8', 'port' => $dbConfig->port, 'database' => $dbConfig->database), Typecho_Db::READ); /* 删除当前内容 */ $masterDb = Typecho_Db::get(); $this->widget('Widget_Abstract_Contents')->to($contents)->delete($masterDb->sql()->where('1 = 1')); $this->widget('Widget_Abstract_Comments')->to($comments)->delete($masterDb->sql()->where('1 = 1')); $this->widget('Widget_Contents_Post_Edit')->to($edit); $masterDb->query($masterDb->delete('table.relationships')->where('1 = 1')); /* 获取 emlog 管理员信息 */ $emUser = $db->fetchRow($db->query($db->select()->from('table.user'))); $emUsername = $emUser['username']; $emNickname = $emUser['nickname']; /* 转换评论表 */ $i = 1; while (true) { $result = $db->query($db->select()->from('table.comment')->order('cid', Typecho_Db::SORT_ASC)->page($i, 100)); $j = 0; while ($row = $db->fetchRow($result)) { $status = ''; if ('y' == $row['hide']) { $status = 'waiting'; } else { $status = 'approved'; } if ($emUsername == $row['poster'] || $emNickname == $row['poster']) { $authorId = 1; } else { $authorId = 0; } $row['comment'] = preg_replace(array("/\\s*<p>/is", "/\\s*<\\/p>\\s*/is", "/\\s*<br\\s*\\/>\\s*/is", "/\\s*<(div|blockquote|pre|table|ol|ul)>/is", "/<\\/(div|blockquote|pre|table|ol|ul)>\\s*/is"), array('', "\n\n", "\n", "\n\n<\\1>", "</\\1>\n\n"), $row['comment']); $comments->insert(array('coid' => $row['cid'], 'cid' => $row['gid'], 'created' => $row['date'], 'author' => $row['poster'], 'authorId' => $authorId, 'ownerId' => 1, 'mail' => $row['mail'], 'url' => $row['url'], 'ip' => $row['ip'], 'agent' => NULL, 'text' => $row['comment'], 'type' => 'comment', 'status' => $status, 'parent' => $row['pid'])); $j++; unset($row); } if ($j < 100) { break; } $i++; unset($result); } /* 转换文章表 */ $i = 1; while (true) { $result = $db->query($db->select()->from('table.blog')->order('gid', Typecho_Db::SORT_ASC)->page($i, 100)); $j = 0; while ($row = $db->fetchRow($result)) { $type = ''; if ('page' == $row['type']) { $type = 'page'; } else { if ('y' == $row['hide']) { $type = 'post_draft'; } else { $type = 'post'; } } $contents->insert(array('cid' => $row['gid'], 'title' => $row['title'], 'slug' => Typecho_Common::slugName(urldecode($row['alias']), $row['gid']), 'created' => $row['date'], 'modified' => $row['date'], 'text' => $row['content'], 'order' => 0, 'authorId' => $row['author'], 'template' => NULL, 'type' => $type, 'status' => 'publish', 'password' => $row['password'], 'commentsNum' => $row['comnum'], 'allowComment' => 'n' == $row['allow_remark'] ? '0' : '1', 'allowPing' => 0, 'allowFeed' => '1')); $j++; unset($row); } if ($j < 100) { break; } $i++; unset($result); } /* 转换 metas 表 */ $sorts = $db->fetchAll($db->select()->from('table.sort')); foreach ($sorts as $sort) { $blogs = $db->fetchAll($db->select()->from('table.blog')->where('sortid = ?', $sort['sid'])); $masterDb->query($masterDb->insert('table.metas')->rows(array('mid' => $sort['sid'] + 1, 'name' => $sort['sortname'], 'slug' => $sort['alias'], 'type' => 'category', 'description' => $sort['description'], 'count' => count($blogs), 'parent' => 0 != $sort['pid'] ? $sort['pid'] + 1 : 0))); } unset($sorts); $emtags = $db->fetchAll($db->select()->from('table.tag')); foreach ($emtags as $emtag) { $gid = trim($emtag['gid'], ','); $gids = explode(',', $gid); $masterDb->query($masterDb->insert('table.metas')->rows(array('name' => $emtag['tagname'], 'slug' => Typecho_Common::slugName($emtag['tagname']), 'type' => 'tag', 'description' => NULL, 'count' => count($gids)))); } /* 转换关系表 */ $emblogs = $db->fetchAll($db->select()->from('table.blog')); foreach ($emblogs as $emblog) { $masterDb->query($masterDb->insert('table.relationships')->rows(array('cid' => $emblog['gid'], 'mid' => -1 == $emblog['sortid'] ? 1 : $emblog['sortid'] + 1))); } unset($emblogs); $tags = $masterDb->fetchAll($masterDb->select()->from('table.metas')->where('type = ?', 'tag')); foreach ($tags as $tag) { foreach ($emtags as $emtag) { if ($tag['name'] == $emtag['tagname']) { $gid = trim($emtag['gid'], ','); $gids = explode(',', $gid); foreach ($gids as $cid) { $masterDb->query($masterDb->insert('table.relationships')->rows(array('cid' => $cid, 'mid' => $tag['mid']))); } } } } unset($emtags); /* 更新附件地址 */ $emOptions = $db->fetchAll($db->select()->from('table.options')); $static = array(); foreach ($emOptions as $emOption) { $static[$emOption['option_name']] = $emOption['option_value']; } unset($emOptions); $static['blogurl']; $oldUrl = rtrim($static['blogurl'], '/') . '/content/uploadfile'; $path = defined('__TYPECHO_UPLOAD_DIR__') ? __TYPECHO_UPLOAD_DIR__ : '/usr/uploads'; $newUrl = rtrim($options->siteUrl, '/') . $path . '/emlog'; $sql = "UPDATE `" . $masterDb->getPrefix() . "contents` SET `text` = REPLACE(`text`,'" . $oldUrl . "','" . $newUrl . "');"; $masterDb->query($sql); $this->widget('Widget_Notice')->set(_t('数据已经转换完成'), NULL, 'success'); $this->response->goBack(); }