Skip to content

Commit

Permalink
Merge pull request #1007 from Anisan/patch-1
Browse files Browse the repository at this point in the history
performance optimization for linkedobject
  • Loading branch information
sergejey authored Sep 15, 2021
2 parents f5e06dc + 571c4e6 commit 4e41e18
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions modules/linkedobject/linkedobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,9 @@ function run()
}

if ($this->object_field) {
$objects = SQLSelect("SELECT * FROM objects ORDER BY CLASS_ID, TITLE");
$objects = SQLSelect("SELECT objects.*, classes.TITLE AS CLASS_NAME FROM objects JOIN classes WHERE CLASS_ID=classes.ID ORDER BY CLASS_ID, TITLE");

foreach($objects as $key => $object) {
$className = SQLSelectOne("SELECT TITLE FROM classes WHERE ID = '".$object['CLASS_ID']."'");
if($object['CLASS_ID'] != $objects[$key-1]['CLASS_ID']) {
$objects[$key]['NEW_GROUP_START'] = 1;
} else {
Expand All @@ -250,9 +249,6 @@ function run()
} else {
$objects[$key]['NEW_GROUP_END'] = 0;
}

$objects[$key]['CLASS_NAME'] = $className['TITLE'];

}

$objects[]=array('ID'=>'scripts','TITLE'=>'AllScripts','DESCRIPTION'=>LANG_SCRIPTS);
Expand Down Expand Up @@ -327,4 +323,4 @@ function install($data = '')
* TW9kdWxlIGNyZWF0ZWQgTm92IDE5LCAyMDE0IHVzaW5nIFNlcmdlIEouIHdpemFyZCAoQWN0aXZlVW5pdCBJbmMgd3d3LmFjdGl2ZXVuaXQuY29tKQ==
*
*/
?>
?>

0 comments on commit 4e41e18

Please sign in to comment.