Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1167471
D535.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 23, 12:44 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Wed, Sep 24, 12:44 PM (20 h, 34 m)
Engine
blob
Format
Raw Data
Handle
756224
Attached To
D535: INP-1921 - Improve Change Log performance
D535.id.diff
View Options
Index: core/units/logs/change_logs/change_log_eh.php
===================================================================
--- core/units/logs/change_logs/change_log_eh.php
+++ core/units/logs/change_logs/change_log_eh.php
@@ -35,6 +35,41 @@
}
/**
+ * @inheritDoc
+ */
+ protected function prepareObject(&$object, kEvent $event)
+ {
+ parent::prepareObject($object, $event);
+
+ $object->SetFieldOption('Prefix', 'options', $this->generatePrefixFieldOptions('Prefix'));
+ $object->SetFieldOption('MasterPrefix', 'options', $this->generatePrefixFieldOptions('MasterPrefix'));
+ }
+
+ /**
+ * Builds prefix options.
+ *
+ * @param string $field Field.
+ *
+ * @return array
+ */
+ protected function generatePrefixFieldOptions($field)
+ {
+ $sql = 'SELECT DISTINCT ' . $field . '
+ FROM ' . TABLE_PREFIX . 'ChangeLogs';
+ $prefixes = $this->Conn->GetCol($sql);
+
+ $ret = array();
+
+ foreach ( $prefixes as $prefix ) {
+ $ret[$prefix] = 'la_prefix_' . $prefix;
+ }
+
+ asort($ret);
+
+ return $ret;
+ }
+
+ /**
* Updates affected record count in session, when change log record is deleted
*
* @param kEvent $event
@@ -63,4 +98,4 @@
{
$this->Application->SetConfigValue('UseChangeLog', 1);
}
-}
\ No newline at end of file
+}
Index: core/units/logs/change_logs/change_logs_config.php
===================================================================
--- core/units/logs/change_logs/change_logs_config.php
+++ core/units/logs/change_logs/change_logs_config.php
@@ -106,22 +106,16 @@
),
'OccuredOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'time_format' => 'H:i:s', 'default' => NULL),
'Prefix' => Array (
- 'type' => 'string', 'formatter' => 'kOptionsFormatter',
- 'options_sql' => 'SELECT DISTINCT %s FROM '.TABLE_PREFIX.'ChangeLogs ORDER BY Phrase',
- 'option_key_field' => 'Prefix',
- 'option_title_field' => 'CONCAT(\'la_prefix_\', Prefix) AS Phrase',
- 'use_phrases' => 1,
- 'max_len' => 255, 'not_null' => 1, 'default' => ''
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options' => array(), 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => '',
),
'ItemId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Changes' => Array ('type' => 'string', 'formatter' => 'kChangesFormatter', 'default' => NULL),
'MasterPrefix' => Array (
- 'type' => 'string', 'formatter' => 'kOptionsFormatter',
- 'options_sql' => 'SELECT DISTINCT %s FROM '.TABLE_PREFIX.'ChangeLogs ORDER BY Phrase',
- 'option_key_field' => 'MasterPrefix',
- 'option_title_field' => 'CONCAT(\'la_prefix_\',MasterPrefix) AS Phrase',
- 'use_phrases' => 1,
- 'max_len' => 255, 'not_null' => 1, 'default' => ''
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options' => array(), 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => '',
),
'MasterId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
),
Event Timeline
Log In to Comment