Skip to content
Snippets Groups Projects

3063856-11.x

Closes #3063856

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • quietone added 1 commit

    added 1 commit

    • f1a08893 - Apply 7 suggestion(s) to 3 file(s)

    Compare with previous version

  • quietone added 1 commit

    added 1 commit

    Compare with previous version

  • quietone added 2 commits

    added 2 commits

    • dbcebe4e - Add another Database exception to catch
    • 30ce65a2 - Remove changes from ProfileFieldValues

    Compare with previous version

  • quietone added 1 commit

    added 1 commit

    • aa1eb30e - Remove changes fro d7/User.php

    Compare with previous version

  • Benji Fisher added 1 commit

    added 1 commit

    Compare with previous version

  • quietone added 540 commits

    added 540 commits

    Compare with previous version

  • quietone added 94 commits

    added 94 commits

    Compare with previous version

  • quietone added 136 commits

    added 136 commits

    Compare with previous version

  • quietone added 54 commits

    added 54 commits

    Compare with previous version

  • Alex Pott added 13 commits

    added 13 commits

    Compare with previous version

  • Alex Pott added 1 commit

    added 1 commit

    Compare with previous version

  • Alex Pott added 1 commit

    added 1 commit

    Compare with previous version

  • quietone added 15 commits

    added 15 commits

    Compare with previous version

  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher
  • 91 $entries = [];
    92 $table = $this->xpath('.//table[@id="admin-migrate-msg"]/tbody/tr');
    93 if ($table) {
    94 foreach ($table as $row) {
    95 $entry = [];
    96 $cells = $row->findAll('css', 'td');
    97 if (count($cells) == 3) {
    98 $entry = [
    99 'id' => $cells[0]->getText(),
    100 'severity' => array_search($cells[1]->getText(), $levels),
    101 'message' => $cells[2]->getText(),
    102 ];
    103 $entries[] = $entry;
    104 }
    105 }
    106 }
    • Comment on lines +93 to +106
      Suggested change
      86 if ($table) {
      87 foreach ($table as $row) {
      88 $entry = [];
      89 $cells = $row->findAll('css', 'td');
      90 if (count($cells) == 3) {
      91 $entry = [
      92 'id' => $cells[0]->getText(),
      93 'severity' => array_search($cells[1]->getText(), $levels),
      94 'message' => $cells[2]->getText(),
      95 ];
      96 $entries[] = $entry;
      97 }
      98 }
      99 }
      86 foreach ($table as $row) {
      87 $cells = $row->findAll('css', 'td');
      88 if (count($cells) === 3) {
      89 $entries[] = [
      90 'id' => $cells[0]->getText(),
      91 'severity' => array_search($cells[1]->getText(), $levels, TRUE),
      92 'message' => $cells[2]->getText(),
      93 ];
      94 }
      95 }
    • There are several changes here.

      1. According to the API docs for $this->xpath(), the return value is always an array. If NULL or FALSE were a possible value, then my personal preference would be foreach ($table ?: [] as $row) instead of the explicit if.
      2. Since $entry is not referenced outside the inner if block, there is no need to define it outside that block. Then we can eliminate it.
      3. I have used strict comparison (=== instead of ==) and added the optional parameter to array_search() to use strict comparison. Eventually, we will be using PHPStan at a level where these are required.
    • Please register or sign in to reply
  • quietone added 17 commits

    added 17 commits

    Compare with previous version

  • 60 */
    61 protected function getLevelCounts(array $levels): array {
    62 $entries = $this->getMessages();
    63 $count = array_fill(1, count($levels), 0);
    64 foreach ($entries as $entry) {
    65 if (array_key_exists($entry['severity'], $levels)) {
    66 $count[$entry['severity']]++;
    67 }
    68 }
    69 return $count;
    70 }
    71
    72 /**
    73 * Gets the migrate messages.
    74 *
    75 * @return string|int[][]
  • 71
    72 /**
    73 * Gets the migrate messages.
    74 *
    75 * @return string|int[][]
    76 * List of log events where each event is an array with following keys:
    77 * - msg_id: (string) A message id.
    78 * - severity: (int) The MigrationInterface error level.
    79 * - message: (string) The migration message.
    80 */
    81 protected function getMessages(): array {
    82 $levels = [
    83 MigrationInterface::MESSAGE_ERROR => 'Error',
    84 MigrationInterface::MESSAGE_WARNING => 'Warning',
    85 MigrationInterface::MESSAGE_NOTICE => 'Notice',
    86 MigrationInterface::MESSAGE_INFORMATIONAL => 'Info',
  • quietone added 69 commits

    added 69 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading