Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

recalculate_email_hash.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 1.92 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * For full copyright and license information, please see
10  * the docs/CREDITS.txt file.
11  *
12  */
13  namespace phpbb\console\command\fixup;
14   
15  use Symfony\Component\Console\Input\InputInterface;
16  use Symfony\Component\Console\Output\OutputInterface;
17   
18  class recalculate_email_hash extends \phpbb\console\command\command
19  {
20      /** @var \phpbb\db\driver\driver_interface */
21      protected $db;
22   
23      function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
24      {
25          $this->db = $db;
26   
27          parent::__construct($user);
28      }
29   
30      protected function configure()
31      {
32          $this
33              ->setName('fixup:recalculate-email-hash')
34              ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'))
35          ;
36      }
37   
38      protected function execute(InputInterface $input, OutputInterface $output)
39      {
40          $sql = 'SELECT user_id, user_email, user_email_hash
41              FROM ' . USERS_TABLE . '
42              WHERE user_type <> ' . USER_IGNORE . "
43                  AND user_email <> ''";
44          $result = $this->db->sql_query($sql);
45   
46          while ($row = $this->db->sql_fetchrow($result))
47          {
48              $user_email_hash = phpbb_email_hash($row['user_email']);
49              if ($user_email_hash !== $row['user_email_hash'])
50              {
51                  $sql_ary = array(
52                      'user_email_hash'    => $user_email_hash,
53                  );
54   
55                  $sql = 'UPDATE ' . USERS_TABLE . '
56                      SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
57                      WHERE user_id = ' . (int) $row['user_id'];
58                  $this->db->sql_query($sql);
59   
60                  if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)
61                  {
62                      $output->writeln(sprintf(
63                          'user_id %d, email %s => %s',
64                          $row['user_id'],
65                          $row['user_email'],
66                          $user_email_hash
67                      ));
68                  }
69              }
70          }
71          $this->db->sql_freeresult($result);
72   
73          $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');
74      }
75  }
76