tag localization, blog localization, richtext edit seo, posts tags category sql scripts
This commit is contained in:
parent
4df1f2c5b3
commit
a5a59350d7
|
|
@ -6,6 +6,8 @@ columns:
|
|||
|
||||
name:
|
||||
label: Tag
|
||||
locale:
|
||||
label: Tag Language
|
||||
|
||||
posts:
|
||||
label: Posts
|
||||
|
|
@ -15,6 +17,9 @@ columns:
|
|||
from bedard_blogtags_post_tag
|
||||
where bedard_blogtags_post_tag.tag_id = bedard_blogtags_tags.id
|
||||
)
|
||||
featured:
|
||||
label: Featured
|
||||
type: switch
|
||||
|
||||
created_at:
|
||||
label: rainlab.blog::lang.post.created
|
||||
|
|
|
|||
|
|
@ -5,9 +5,26 @@
|
|||
fields:
|
||||
name:
|
||||
label: Tag
|
||||
|
||||
posts:
|
||||
label: Posts
|
||||
type: relation
|
||||
nameFrom: title
|
||||
emptyOption: No posts available.
|
||||
#
|
||||
# posts:
|
||||
# label: Posts
|
||||
# type: relation
|
||||
# nameFrom: title
|
||||
# emptyOption: No posts available.
|
||||
featured:
|
||||
label: Feature
|
||||
type: radio
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
default: 0
|
||||
span: left
|
||||
locale:
|
||||
tab: rainlab.blog::lang.post.tab_categories
|
||||
label: Language of Post
|
||||
span: right
|
||||
type: radio
|
||||
default: ru
|
||||
options:
|
||||
ru: Russian
|
||||
en: English
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
<?php namespace Bedard\BlogTags\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
use Bedard\BlogTags\Models\Tag;
|
||||
use System\Classes\PluginManager;
|
||||
|
||||
class AddLocalization extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if(!PluginManager::instance()->hasPlugin('RainLab.Blog'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('bedard_blogtags_tags', function($table)
|
||||
{
|
||||
$table->integer('id_ru')->unsigned()->nullable();
|
||||
$table->integer('id_en')->unsigned()->nullable();
|
||||
$table->string('locale')->nullable();
|
||||
$table->boolean('featured')->default(0);
|
||||
});
|
||||
|
||||
$this->fillSlugs();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if(!PluginManager::instance()->hasPlugin('RainLab.Blog'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('bedard_blogtags_tags', function($table)
|
||||
{
|
||||
$table->dropColumn('id_ru');
|
||||
$table->dropColumn('id_en');
|
||||
$table->dropColumn('locale');
|
||||
$table->dropColumn('featured');
|
||||
});
|
||||
}
|
||||
|
||||
private function fillSlugs()
|
||||
{
|
||||
$tags = Tag::all();
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
$tag->slug = str_slug($tag->name);
|
||||
$tag->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,3 +35,6 @@
|
|||
- !!! A slug is now created for each tag.
|
||||
1.4.1:
|
||||
- Turkish translation added (kutups)
|
||||
1.4.2:
|
||||
- Add localization identity(id_ru, id_en)
|
||||
- add_localization_columns.php
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ class Post extends Model
|
|||
public $rules = [
|
||||
'title' => 'required',
|
||||
'slug' => ['required', 'regex:/^[a-z0-9\/\:_\-\*\[\]\+\?\|]*$/i', 'unique:rainlab_blog_posts'],
|
||||
'content' => 'required',
|
||||
'content_html' => 'required',
|
||||
'powerseo_title' => 'required',
|
||||
'powerseo_description' => 'required',
|
||||
'powerseo_keywords' => 'required',
|
||||
'excerpt' => ''
|
||||
];
|
||||
|
||||
|
|
@ -145,7 +148,7 @@ class Post extends Model
|
|||
$this->user = $user->id;
|
||||
}
|
||||
}
|
||||
$this->content_html = self::formatHtml($this->content);
|
||||
// $this->content_html = self::formatHtml($this->content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -245,7 +248,7 @@ class Post extends Model
|
|||
'exceptPost' => null
|
||||
], $options));
|
||||
|
||||
$searchableFields = ['title', 'slug', 'excerpt', 'content'];
|
||||
$searchableFields = ['title', 'slug', 'excerpt'];
|
||||
|
||||
if ($published) {
|
||||
$query->isPublished();
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ fields:
|
|||
|
||||
title:
|
||||
label: rainlab.blog::lang.post.title
|
||||
span: left
|
||||
placeholder: rainlab.blog::lang.post.title_placeholder
|
||||
|
||||
slug:
|
||||
label: rainlab.blog::lang.post.slug
|
||||
span: right
|
||||
# span: right
|
||||
placeholder: rainlab.blog::lang.post.slug_placeholder
|
||||
preset:
|
||||
field: title
|
||||
|
|
@ -25,32 +24,31 @@ fields:
|
|||
secondaryTabs:
|
||||
stretch: true
|
||||
fields:
|
||||
content:
|
||||
content_html:
|
||||
tab: rainlab.blog::lang.post.tab_edit
|
||||
type: RainLab\Blog\FormWidgets\BlogMarkdown
|
||||
# type: RainLab\Blog\FormWidgets\BlogMarkdown
|
||||
type: richeditor
|
||||
cssClass: field-slim blog-post-preview
|
||||
stretch: true
|
||||
mode: split
|
||||
|
||||
locale:
|
||||
tab: rainlab.blog::lang.post.tab_categories
|
||||
label: Language of Post
|
||||
span: storm
|
||||
cssClass: col-md-12
|
||||
type: dropdown
|
||||
default: ru
|
||||
options:
|
||||
ru: Russian
|
||||
en: English
|
||||
|
||||
categories:
|
||||
tab: rainlab.blog::lang.post.tab_categories
|
||||
type: relation
|
||||
commentAbove: rainlab.blog::lang.post.categories_comment
|
||||
placeholder: rainlab.blog::lang.post.categories_placeholder
|
||||
|
||||
published:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
label: rainlab.blog::lang.post.published
|
||||
span: left
|
||||
type: checkbox
|
||||
|
||||
user:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
label: rainlab.blog::lang.post.published_by
|
||||
span: right
|
||||
type: relation
|
||||
nameFrom: login
|
||||
emptyOption: rainlab.blog::lang.post.current_user
|
||||
|
||||
published_at:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
|
|
@ -63,6 +61,19 @@ secondaryTabs:
|
|||
action: enable
|
||||
field: published
|
||||
condition: checked
|
||||
published:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
label: rainlab.blog::lang.post.published
|
||||
span: right
|
||||
type: checkbox
|
||||
|
||||
user:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
label: rainlab.blog::lang.post.published_by
|
||||
span: left
|
||||
type: relation
|
||||
nameFrom: login
|
||||
emptyOption: rainlab.blog::lang.post.current_user
|
||||
|
||||
excerpt:
|
||||
tab: rainlab.blog::lang.post.tab_manage
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ class CreatePostsTable extends Migration
|
|||
|
||||
public function down()
|
||||
{
|
||||
\DB::statement('SET FOREIGN_KEY_CHECKS = 0');
|
||||
Schema::dropIfExists('rainlab_blog_posts');
|
||||
\DB::statement('SET FOREIGN_KEY_CHECKS = 1');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Schema;
|
|||
use October\Rain\Database\Updates\Migration;
|
||||
use RainLab\Blog\Models\Category as CategoryModel;
|
||||
|
||||
class PostsAddMetadata extends Migration
|
||||
class PostsAddImage extends Migration
|
||||
{
|
||||
|
||||
public function up()
|
||||
|
|
@ -16,16 +16,21 @@ class PostsAddMetadata extends Migration
|
|||
Schema::table('rainlab_blog_posts', function($table)
|
||||
{
|
||||
$table->string('featured_image')->nullable();
|
||||
$table->string('locale')->nullable();
|
||||
$table->integer('id_ru')->unsigned()->nullable();
|
||||
$table->integer('id_en')->unsigned()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if (Schema::hasColumn('rainlab_blog_posts', 'metadata')) {
|
||||
if (Schema::hasColumn('rainlab_blog_posts', 'featured_image')) {
|
||||
Schema::table('rainlab_blog_posts', function ($table) {
|
||||
$table->dropColumn('featured_image');
|
||||
$table->dropColumn('locale');
|
||||
$table->dropColumn('id_ru');
|
||||
$table->dropColumn('id_en');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,20 +12,20 @@ class BlogpostsFix extends Migration
|
|||
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
|
||||
Schema::table('rainlab_blog_posts', function ($table) {
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_title')) {
|
||||
$table->string('powerseo_title')->nullable();
|
||||
$table->text('powerseo_title')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_description')) {
|
||||
$table->string('powerseo_description')->nullable();
|
||||
$table->text('powerseo_description')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_keywords')) {
|
||||
$table->string('powerseo_keywords')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_canonical_url')) {
|
||||
$table->string('powerseo_canonical_url')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_redirect_url')) {
|
||||
$table->string('powerseo_redirect_url')->nullable();
|
||||
$table->text('powerseo_keywords')->nullable();
|
||||
}
|
||||
// if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_canonical_url')) {
|
||||
// $table->text('powerseo_canonical_url')->nullable();
|
||||
// }
|
||||
// if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_redirect_url')) {
|
||||
// $table->text('powerseo_redirect_url')->nullable();
|
||||
// }
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_robot_index')) {
|
||||
$table->string('powerseo_robot_index')->nullable();
|
||||
}
|
||||
|
|
@ -43,8 +43,8 @@ class BlogpostsFix extends Migration
|
|||
$table->dropColumn('powerseo_title');
|
||||
$table->dropColumn('powerseo_description');
|
||||
$table->dropColumn('powerseo_keywords');
|
||||
$table->dropColumn('powerseo_canonical_url');
|
||||
$table->dropColumn('powerseo_redirect_url');
|
||||
// $table->dropColumn('powerseo_canonical_url');
|
||||
// $table->dropColumn('powerseo_redirect_url');
|
||||
$table->dropColumn('powerseo_robot_index');
|
||||
$table->dropColumn('powerseo_robot_follow');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ class CreateBlogPostsTable extends Migration
|
|||
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
|
||||
Schema::table('rainlab_blog_posts', function ($table) {
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_title')) {
|
||||
$table->string('powerseo_title')->nullable();
|
||||
$table->text('powerseo_title')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_description')) {
|
||||
$table->string('powerseo_description')->nullable();
|
||||
$table->text('powerseo_description')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_keywords')) {
|
||||
$table->string('powerseo_keywords')->nullable();
|
||||
$table->text('powerseo_keywords')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_canonical_url')) {
|
||||
$table->string('powerseo_canonical_url')->nullable();
|
||||
$table->text('powerseo_canonical_url')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_redirect_url')) {
|
||||
$table->string('powerseo_redirect_url')->nullable();
|
||||
$table->text('powerseo_redirect_url')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('rainlab_blog_posts', 'powerseo_robot_index')) {
|
||||
$table->string('powerseo_robot_index')->nullable();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
//////////////filter categories prom taxonomy//////////////
|
||||
(SELECT ta.term_id, tm.name, tm.slug
|
||||
FROM `iatm_orient_2_term_taxonomy` ta
|
||||
LEFT JOIN iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id
|
||||
WHERE ta.taxonomy = 'category')
|
||||
|
||||
UNION
|
||||
|
||||
(SELECT ta.term_id, tm.name, tm.slug
|
||||
FROM `iatm_orient_term_taxonomy` ta
|
||||
LEFT JOIN iatm_orient_terms tm ON ta.`term_id` = tm.term_id
|
||||
WHERE ta.taxonomy = 'category')
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
ALTER TABLE `rainlab_blog_posts` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, CHANGE `slug` `slug` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
|
||||
|
||||
INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content_html,published_at,published,created_at,updated_at,locale,id_en)
|
||||
SELECT post_author,post_title,post_name,post_excerpt,post_content,post_date,1,post_date,post_modified,'en',id from orient_wordpress.arient_2_posts;
|
||||
|
||||
UPDATE rainlab_blog_posts SET powerseo_title = title, powerseo_description = excerpt, powerseo_robot_index = 'index', powerseo_robot_follow = 'nofollow';
|
||||
|
||||
//////// angliski postlarda 2019dan ashakdaky materiallar pozulan
|
||||
Delete FROM arient_2_posts_temp WHERE post_date <'2019-01-01'
|
||||
|
||||
////////////////////////////////insert featured images
|
||||
UPDATE rainlab_blog_posts rb
|
||||
inner join iatm_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='-thumbnail_id'
|
||||
inner join arient_2_posts_temp wp on wp.ID = ip.meta_value
|
||||
set rb.featerd_image = wp.guid
|
||||
|
||||
////////////// replace image address
|
||||
UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !=''
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
INSERT INTO bedard_blogtags_tags (name,slug,id_en,locale)
|
||||
SELECT tm.name, tm.slug,ta.term_id as id_en, 'en'
|
||||
FROM orient_wordpress.`iatm_orient_2_term_taxonomy` ta
|
||||
LEFT JOIN orient_wordpress.iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id
|
||||
WHERE ta.taxonomy = 'post_tag';
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
UPDATE `backend_users` SET `id` = '2', `activated_at` = NULL, `deleted_at` = NULL WHERE `backend_users`.`id` = 1;
|
||||
|
||||
INSERT INTO orient.backend_users (id, first_name,last_name,login,email,password,created_at,is_activated)
|
||||
SELECT ID, user_nicename,display_name,user_login,user_email,user_pass,user_registered,1 from orient_wordpress.iatm_orient_users
|
||||
Loading…
Reference in New Issue