Page MenuHomeIn-Portal Phabricator

D297.diff
No OneTemporary

File Metadata

Created
Sat, Apr 19, 9:53 PM

D297.diff

Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -1755,6 +1755,7 @@
<PHRASE Label="lc_field_cachedreviewsqty" Module="Core" Type="2">TnVtYmVyIG9mIFJldmlld3M=</PHRASE>
<PHRASE Label="lc_field_cachedvotesqty" Module="Core" Type="2">TnVtYmVyIG9mIFJhdGluZyBWb3Rlcw==</PHRASE>
<PHRASE Label="lc_field_CategoryId" Module="Core" Type="2">U2VjdGlvbiBJRA==</PHRASE>
+ <PHRASE Label="lc_field_ContentBlockContent" Module="Core" Type="2">Q29udGVudCBCbG9jayBDb250ZW50</PHRASE>
<PHRASE Label="lc_field_createdbyid" Module="Core" Type="2">Q3JlYXRlZCBCeSBVc2VyIElE</PHRASE>
<PHRASE Label="lc_field_createdon" Module="Core" Type="2">RGF0ZSBDcmVhdGVk</PHRASE>
<PHRASE Label="lc_field_description" Module="Core" Type="2">RGVzY3JpcHRpb24=</PHRASE>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql
+++ core/install/install_data.sql
@@ -972,9 +972,10 @@
INSERT INTO SearchConfig VALUES ('Categories', 'CachedDescendantCatsQty', 0, 1, 'lu_fielddesc_category_cacheddescendantcatsqty', 'lc_field_CachedDescendantCatsQty', 'In-Portal', 'la_text_category', 11, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'MetaKeywords', 0, 1, 'lu_fielddesc_category_metakeywords', 'lc_field_MetaKeywords', 'In-Portal', 'la_text_category', 10, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Priority', 0, 1, 'lu_fielddesc_category_priority', 'lc_field_priority', 'In-Portal', 'la_text_category', 9, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO SearchConfig VALUES ('Categories', 'Status', 0, 1, 'lu_fielddesc_category_status', 'lc_field_status', 'In-Portal', 'la_text_category', 7, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO SearchConfig VALUES ('Categories', 'EditorsPick', 0, 1, 'lu_fielddesc_category_editorspick', 'lc_field_EditorsPick', 'In-Portal', 'la_text_category', 6, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO SearchConfig VALUES ('Categories', 'CreatedOn', 0, 1, 'lu_fielddesc_category_createdon', 'lc_field_createdon', 'In-Portal', 'la_text_category', 5, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO SearchConfig VALUES ('Categories', 'Status', 0, 1, 'lu_fielddesc_category_status', 'lc_field_status', 'In-Portal', 'la_text_category', 8, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO SearchConfig VALUES ('Categories', 'EditorsPick', 0, 1, 'lu_fielddesc_category_editorspick', 'lc_field_EditorsPick', 'In-Portal', 'la_text_category', 7, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO SearchConfig VALUES ('Categories', 'CreatedOn', 0, 1, 'lu_fielddesc_category_createdon', 'lc_field_createdon', 'In-Portal', 'la_text_category', 6, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO SearchConfig VALUES ('Categories', 'ContentBlockContent', 1, 1, 'lu_fielddesc_category_ContentBlockContent', 'lc_field_ContentBlockContent', 'In-Portal', 'la_text_category', 5, DEFAULT, 1, 'text', 'MULTI:PageRevisions.ContentBlockContent', '{ForeignTable}.PageId={LocalTable}.CategoryId AND {ForeignTable}.RevisionNumber = {LocalTable}.LiveRevisionNumber', NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Description', 1, 1, 'lu_fielddesc_category_description', 'lc_field_description', 'In-Portal', 'la_text_category', 4, DEFAULT, 2, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Name', 1, 1, 'lu_fielddesc_category_name', 'lc_field_name', 'In-Portal', 'la_text_category', 3, DEFAULT, 2, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'ParentId', 0, 1, 'lu_fielddesc_category_parentid', 'lc_field_ParentId', 'In-Portal', 'la_text_category', 2, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql
+++ core/install/install_schema.sql
@@ -1180,6 +1180,11 @@
RevisionId int(11) NOT NULL AUTO_INCREMENT,
PageId int(11) NOT NULL,
RevisionNumber int(11) NOT NULL,
+ l1_ContentBlockContent text,
+ l2_ContentBlockContent text,
+ l3_ContentBlockContent text,
+ l4_ContentBlockContent text,
+ l5_ContentBlockContent text,
IsDraft tinyint(4) NOT NULL,
FromRevisionId int(11) NOT NULL,
CreatedById int(11) DEFAULT NULL,
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -3052,3 +3052,12 @@
UPDATE PromoBlocks SET ScheduleToDate = ScheduleToDate + 86399 WHERE DATE_FORMAT(FROM_UNIXTIME(ScheduleTodate), "%H%i") = "0000";
DELETE FROM LanguageLabels WHERE PhraseKey = "LA_FLD_SCHEDULEDATE";
+
+ALTER TABLE PageRevisions
+ ADD l1_ContentBlockContent text AFTER RevisionNumber,
+ ADD l2_ContentBlockContent text AFTER l1_ContentBlockContent,
+ ADD l3_ContentBlockContent text AFTER l2_ContentBlockContent,
+ ADD l4_ContentBlockContent text AFTER l3_ContentBlockContent,
+ ADD l5_ContentBlockContent text AFTER l4_ContentBlockContent;
+UPDATE SearchConfig SET DisplayOrder = DisplayOrder + 1 WHERE DisplayOrder BETWEEN 5 AND 7 AND ModuleName = 'In-Portal';
+INSERT INTO SearchConfig VALUES ('Categories', 'ContentBlockContent', 1, 1, 'lu_fielddesc_category_ContentBlockContent', 'lc_field_ContentBlockContent', 'In-Portal', 'la_text_category', 5, DEFAULT, 1, 'text', 'MULTI:PageRevisions.ContentBlockContent', '{ForeignTable}.PageId={LocalTable}.CategoryId AND {ForeignTable}.RevisionNumber = {LocalTable}.LiveRevisionNumber', NULL, NULL, NULL, NULL, NULL);
Index: core/units/categories/categories_config.php
===================================================================
--- core/units/categories/categories_config.php
+++ core/units/categories/categories_config.php
@@ -435,6 +435,7 @@
'CurrentSort' => Array ('type' => 'string', 'default' => ''),
'IsNew' => Array ('type' => 'int', 'default' => 0),
'OldPriority' => Array ('type' => 'int', 'default' => 0),
+ 'ContentBlockContent' => array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => ''),
// for primary image
'AltName' => Array ('type' => 'string', 'default' => ''),
Index: core/units/page_revisions/page_revision_eh.php
===================================================================
--- core/units/page_revisions/page_revision_eh.php
+++ core/units/page_revisions/page_revision_eh.php
@@ -223,6 +223,54 @@
$page->SetDBField('LiveRevisionNumber', $object->GetDBField('RevisionNumber'));
$page->Update();
}
+
+ $this->syncPageContent($object->GetDBField('RevisionId'));
+ }
+
+ /**
+ * Update searchable content of the page.
+ *
+ * @param integer $revision_id Revision Id.
+ *
+ * @return void
+ */
+ protected function syncPageContent($revision_id)
+ {
+ $sql = 'SELECT *
+ FROM ' . TABLE_PREFIX . 'PageContent
+ WHERE RevisionId = ' . $revision_id;
+ $blocks = $this->Conn->Query($sql);
+
+ if ( !$blocks ) {
+ return;
+ }
+
+ /** @var kMultiLanguageHelper $ml_helper */
+ $ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
+ $fields_hash = array();
+
+ foreach ( $ml_helper->getLanguages() as $language_id ) {
+ $page_content = array();
+
+ foreach ( $blocks as $block ) {
+ if ( $block['l' . $language_id . '_Content'] ) {
+ $page_content[] = $block['l' . $language_id . '_Content'];
+ }
+ }
+
+ if ( $page_content ) {
+ $page_content = strip_tags(kUtil::unescape(implode(' ', $page_content), kUtil::ESCAPE_HTML));
+ $fields_hash['l' . $language_id . '_ContentBlockContent'] = $page_content;
+ }
+ }
+
+ if ( $fields_hash ) {
+ $this->Conn->doUpdate(
+ $fields_hash,
+ TABLE_PREFIX . 'PageRevisions',
+ 'RevisionId = ' . $revision_id
+ );
+ }
}
/**
Index: core/units/page_revisions/page_revisions_config.php
===================================================================
--- core/units/page_revisions/page_revisions_config.php
+++ core/units/page_revisions/page_revisions_config.php
@@ -68,6 +68,7 @@
'RevisionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'PageId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'RevisionNumber' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'ContentBlockContent' => array('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => null),
'IsDraft' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
@@ -92,4 +93,4 @@
'default' => 0,
)
),
-);
\ No newline at end of file
+);

Event Timeline