mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-08-01 04:18:09 +08:00
去除league/commonmark包
This commit is contained in:
parent
56e04fc3a3
commit
45dfa0d269
@ -1,162 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2022 深圳市酷瓜软件有限公司
|
||||
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
namespace App\Console\Migrations;
|
||||
|
||||
use App\Models\Answer as AnswerModel;
|
||||
use App\Models\Article as ArticleModel;
|
||||
use App\Models\Course as CourseModel;
|
||||
use App\Models\Help as HelpModel;
|
||||
use App\Models\Page as PageModel;
|
||||
use App\Models\PointGift as PointGiftModel;
|
||||
use App\Models\Question as QuestionModel;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
use Phalcon\Mvc\Model\Resultset;
|
||||
|
||||
class V202207291145 extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* @var GithubFlavoredMarkdownConverter
|
||||
*/
|
||||
protected $markdownConverter;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->initMarkdownConverter();
|
||||
$this->courseMarkdownToHtml();
|
||||
$this->articleMarkdownToHtml();
|
||||
$this->questionMarkdownToHtml();
|
||||
$this->answerMarkdownToHtml();
|
||||
$this->pageMarkdownToHtml();
|
||||
$this->helpMarkdownToHtml();
|
||||
$this->pointGiftMarkdownToHtml();
|
||||
}
|
||||
|
||||
protected function initMarkdownConverter()
|
||||
{
|
||||
$this->markdownConverter = new GithubFlavoredMarkdownConverter([
|
||||
'html_input' => 'escape',
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function articleMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $articles Resultset|ArticleModel[]
|
||||
*/
|
||||
$articles = ArticleModel::query()->execute();
|
||||
|
||||
if ($articles->count() == 0) return;
|
||||
|
||||
foreach ($articles as $article) {
|
||||
$content = $this->markdownConverter->convertToHtml($article->content);
|
||||
$article->content = $content;
|
||||
$article->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function courseMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $courses Resultset|CourseModel[]
|
||||
*/
|
||||
$courses = CourseModel::query()->execute();
|
||||
|
||||
if ($courses->count() == 0) return;
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$details = $this->markdownConverter->convertToHtml($course->details);
|
||||
$course->details = $details;
|
||||
$course->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function questionMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $questions Resultset|QuestionModel[]
|
||||
*/
|
||||
$questions = QuestionModel::query()->execute();
|
||||
|
||||
if ($questions->count() == 0) return;
|
||||
|
||||
foreach ($questions as $question) {
|
||||
$content = $this->markdownConverter->convertToHtml($question->content);
|
||||
$question->content = $content;
|
||||
$question->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function answerMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $answers Resultset|AnswerModel[]
|
||||
*/
|
||||
$answers = AnswerModel::query()->execute();
|
||||
|
||||
if ($answers->count() == 0) return;
|
||||
|
||||
foreach ($answers as $answer) {
|
||||
$content = $this->markdownConverter->convertToHtml($answer->content);
|
||||
$answer->content = $content;
|
||||
$answer->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function pageMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $pages Resultset|PageModel[]
|
||||
*/
|
||||
$pages = PageModel::query()->execute();
|
||||
|
||||
if ($pages->count() == 0) return;
|
||||
|
||||
foreach ($pages as $page) {
|
||||
$content = $this->markdownConverter->convertToHtml($page->content);
|
||||
$page->content = $content;
|
||||
$page->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function helpMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $helps Resultset|HelpModel[]
|
||||
*/
|
||||
$helps = HelpModel::query()->execute();
|
||||
|
||||
if ($helps->count() == 0) return;
|
||||
|
||||
foreach ($helps as $help) {
|
||||
$content = $this->markdownConverter->convertToHtml($help->content);
|
||||
$help->content = $content;
|
||||
$help->update();
|
||||
}
|
||||
}
|
||||
|
||||
protected function pointGiftMarkdownToHtml()
|
||||
{
|
||||
/**
|
||||
* @var $gifts Resultset|PointGiftModel[]
|
||||
*/
|
||||
$gifts = PointGiftModel::query()
|
||||
->where('type = :type:', ['type' => PointGiftModel::TYPE_GOODS])
|
||||
->execute();
|
||||
|
||||
if ($gifts->count() == 0) return;
|
||||
|
||||
foreach ($gifts as $gift) {
|
||||
$details = $this->markdownConverter->convertToHtml($gift->details);
|
||||
$gift->details = $details;
|
||||
$gift->update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,6 @@
|
||||
"robmorgan/phinx": "^0.12",
|
||||
"overtrue/wechat": "^4.2",
|
||||
"endroid/qr-code": "^3.9",
|
||||
"league/commonmark": "^1.5",
|
||||
"ezyang/htmlpurifier": "^4.14",
|
||||
"zoujingli/ip2region": "^2.0"
|
||||
},
|
||||
|
290
composer.lock
generated
290
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a5d21272eaa0df8bfcd5a3cea6d61fad",
|
||||
"content-hash": "bfecc23cb2b7b3ba13d4d6aec67c80af",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@ -1390,105 +1390,6 @@
|
||||
},
|
||||
"time": "2022-06-29T09:25:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "1.6.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/commonmark.git",
|
||||
"reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b",
|
||||
"reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"scrutinizer/ocular": "1.7.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"cebe/markdown": "~1.0",
|
||||
"commonmark/commonmark.js": "0.29.2",
|
||||
"erusev/parsedown": "~1.0",
|
||||
"ext-json": "*",
|
||||
"github/gfm": "0.29.0",
|
||||
"michelf/php-markdown": "~1.4",
|
||||
"mikehaertl/php-shellcommand": "^1.4",
|
||||
"phpstan/phpstan": "^0.12.90",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.2",
|
||||
"scrutinizer/ocular": "^1.5",
|
||||
"symfony/finder": "^4.2"
|
||||
},
|
||||
"bin": [
|
||||
"bin/commonmark"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"League\\CommonMark\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Colin O'Dell",
|
||||
"email": "colinodell@gmail.com",
|
||||
"homepage": "https://www.colinodell.com",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)",
|
||||
"homepage": "https://commonmark.thephpleague.com",
|
||||
"keywords": [
|
||||
"commonmark",
|
||||
"flavored",
|
||||
"gfm",
|
||||
"github",
|
||||
"github-flavored",
|
||||
"markdown",
|
||||
"md",
|
||||
"parser"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://commonmark.thephpleague.com/",
|
||||
"issues": "https://github.com/thephpleague/commonmark/issues",
|
||||
"rss": "https://github.com/thephpleague/commonmark/releases.atom",
|
||||
"source": "https://github.com/thephpleague/commonmark"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.colinodell.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.paypal.me/colinpodell/10.00",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/colinodell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/league/commonmark",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-01-13T17:18:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "2.8.0",
|
||||
@ -2365,34 +2266,34 @@
|
||||
"time": "2017-10-23T01:57:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "qcloud/cos-sdk-v5",
|
||||
"version": "v2.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
|
||||
"reference": "92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed",
|
||||
"reference": "92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "qcloud/cos-sdk-v5",
|
||||
"version": "v2.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
|
||||
"reference": "92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed",
|
||||
"reference": "92a1ee62b85ed4e7bf6836a684df5d7e3158d0ed",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"guzzlehttp/guzzle": "^6.2.1 || ^7.0",
|
||||
"guzzlehttp/guzzle-services": "^1.1",
|
||||
"guzzlehttp/psr7": "^1.3.1 || ^2.0",
|
||||
"php": ">=5.6"
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"guzzlehttp/guzzle": "^6.2.1 || ^7.0",
|
||||
"guzzlehttp/guzzle-services": "^1.1",
|
||||
"guzzlehttp/psr7": "^1.3.1 || ^2.0",
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -2434,9 +2335,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/tencentyun/cos-php-sdk-v5/issues",
|
||||
"source": "https://github.com/tencentyun/cos-php-sdk-v5/tree/v2.6.2"
|
||||
"source": "https://github.com/tencentyun/cos-php-sdk-v5/tree/v2.6.2"
|
||||
},
|
||||
"time": "2023-04-07T07:38:24+00:00"
|
||||
"time": "2023-04-07T07:38:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ralouphie/getallheaders",
|
||||
@ -4909,43 +4810,43 @@
|
||||
],
|
||||
"time": "2022-05-27T12:56:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tencentcloud/tencentcloud-sdk-php",
|
||||
"version": "3.0.889",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git",
|
||||
"reference": "a08031e5111f17131fceb429eebb8223c105d8b3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/a08031e5111f17131fceb429eebb8223c105d8b3",
|
||||
"reference": "a08031e5111f17131fceb429eebb8223c105d8b3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.3 || ^7.0",
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TencentCloud\\": "./src/TencentCloud"
|
||||
},
|
||||
"classmap": [
|
||||
"src/QcloudApi/QcloudApi.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
{
|
||||
"name": "tencentcloud/tencentcloud-sdk-php",
|
||||
"version": "3.0.889",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git",
|
||||
"reference": "a08031e5111f17131fceb429eebb8223c105d8b3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/a08031e5111f17131fceb429eebb8223c105d8b3",
|
||||
"reference": "a08031e5111f17131fceb429eebb8223c105d8b3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.3 || ^7.0",
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TencentCloud\\": "./src/TencentCloud"
|
||||
},
|
||||
"classmap": [
|
||||
"src/QcloudApi/QcloudApi.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
@ -4961,9 +4862,9 @@
|
||||
"homepage": "https://github.com/TencentCloud/tencentcloud-sdk-php",
|
||||
"support": {
|
||||
"issues": "https://github.com/TencentCloud/tencentcloud-sdk-php/issues",
|
||||
"source": "https://github.com/TencentCloud/tencentcloud-sdk-php/tree/3.0.889"
|
||||
"source": "https://github.com/TencentCloud/tencentcloud-sdk-php/tree/3.0.889"
|
||||
},
|
||||
"time": "2023-05-22T00:02:52+00:00"
|
||||
"time": "2023-05-22T00:02:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
@ -5099,29 +5000,29 @@
|
||||
},
|
||||
"time": "2022-04-19T20:14:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "workerman/gateway-worker",
|
||||
"version": "v3.0.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/walkor/GatewayWorker.git",
|
||||
"reference": "a7dffc53403133131a51b9fd3c6c6d70869cb6d3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/a7dffc53403133131a51b9fd3c6c6d70869cb6d3",
|
||||
"reference": "a7dffc53403133131a51b9fd3c6c6d70869cb6d3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "workerman/gateway-worker",
|
||||
"version": "v3.0.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/walkor/GatewayWorker.git",
|
||||
"reference": "a7dffc53403133131a51b9fd3c6c6d70869cb6d3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/a7dffc53403133131a51b9fd3c6c6d70869cb6d3",
|
||||
"reference": "a7dffc53403133131a51b9fd3c6c6d70869cb6d3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"workerman/workerman": "^4.0.30"
|
||||
"php": ">=7.0",
|
||||
"workerman/workerman": "^4.0.30"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@ -5140,7 +5041,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/walkor/GatewayWorker/issues",
|
||||
"source": "https://github.com/walkor/GatewayWorker/tree/v3.0.28"
|
||||
"source": "https://github.com/walkor/GatewayWorker/tree/v3.0.28"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -5152,7 +5053,7 @@
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-24T03:56:27+00:00"
|
||||
"time": "2023-03-24T03:56:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "workerman/gatewayclient",
|
||||
@ -5643,8 +5544,9 @@
|
||||
"ext-redis": "~5.0",
|
||||
"ext-pdo": "*",
|
||||
"ext-json": "*",
|
||||
"ext-fileinfo": "*"
|
||||
"ext-fileinfo": "*",
|
||||
"ext-gd": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user