| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function evaluate() |
||
| 36 | { |
||
| 37 | // See if there are too many database queries |
||
| 38 | if ($this->sample->craftDbMs >= self::MAX_QUERY_TIME) { |
||
| 39 | $displayCraftDbMs = ($this->sample->craftDbMs / 1000) . 's'; |
||
| 40 | $this->hasRecommendation = true; |
||
| 41 | $this->summary = Craft::t( |
||
| 42 | 'webperf', |
||
| 43 | 'Look into decreasing the time database queries are taking', |
||
| 44 | [] |
||
| 45 | ); |
||
| 46 | $this->detail = Craft::t( |
||
| 47 | 'webperf', |
||
| 48 | 'The database queries took {displayCraftDbMs} to execute. Try to simplify the database queries, or leverage Eager Loading in Craft to speed them up.', |
||
| 49 | [ |
||
| 50 | 'displayCraftDbMs' => $displayCraftDbMs, |
||
| 51 | ] |
||
| 52 | ); |
||
| 53 | $this->learnMoreUrl = 'https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading'; |
||
| 54 | |||
| 55 | return; |
||
| 56 | } |
||
| 59 |