Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -1755,6 +1755,7 @@
TnVtYmVyIG9mIFJldmlld3M=
TnVtYmVyIG9mIFJhdGluZyBWb3Rlcw==
U2VjdGlvbiBJRA==
+ Q29udGVudCBCbG9jayBDb250ZW50
Q3JlYXRlZCBCeSBVc2VyIElE
RGF0ZSBDcmVhdGVk
RGVzY3JpcHRpb24=
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,11 @@
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;
+INSERT INTO SearchConfig VALUES ('Categories', 'ContentBlockContent', '0', '0', 'lu_fielddesc_category_ContentBlockContent', 'lc_field_ContentBlockContent', 'In-Portal', 'la_text_category', '22', DEFAULT, '0', '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', '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,55 @@
$page->SetDBField('LiveRevisionNumber', $object->GetDBField('RevisionNumber'));
$page->Update();
}
+
+ $where_clause = array(
+ 'PageId = ' . $object->GetDBField('PageId'),
+ 'RevisionId = ' . $object->GetDBField('RevisionId'),
+ );
+
+ $sql = 'SELECT *
+ FROM ' . TABLE_PREFIX . 'PageContent
+ WHERE (' . implode(') AND (', $where_clause) . ')';
+ $blocks = $this->Conn->Query($sql);
+
+ if ( $blocks ) {
+ $this->syncPageContent($blocks);
+ }
+ }
+
+ /**
+ * Update searchable content of the page.
+ *
+ * @param array $blocks Content Blocks data.
+ *
+ * @return void
+ */
+ protected function syncPageContent(array $blocks)
+ {
+ /** @var kMultiLanguageHelper $ml_helper */
+ $ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
+ $fields_hash = array();
+ $languages = $ml_helper->getLanguages();
+
+ foreach ( $languages 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 ) {
+ $condition = 'RevisionId = ' . $blocks[0]['RevisionId'];
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'PageRevisions', $condition);
+ }
}
/**
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
+);