Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
recalculate_email_hash.php
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 use Symfony\Component\Console\Style\SymfonyStyle;
18
19 class recalculate_email_hash extends \phpbb\console\command\command
20 {
21 /** @var \phpbb\db\driver\driver_interface */
22 protected $db;
23
24 public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
25 {
26 $this->db = $db;
27
28 parent::__construct($user);
29 }
30
31 protected function configure()
32 {
33 $this
34 ->setName('fixup:recalculate-email-hash')
35 ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'))
36 ;
37 }
38
39 protected function execute(InputInterface $input, OutputInterface $output)
40 {
41 $io = new SymfonyStyle($input, $output);
42
43 $sql = 'SELECT user_id, user_email, user_email_hash
44 FROM ' . USERS_TABLE . '
45 WHERE user_type <> ' . USER_IGNORE . "
46 AND user_email <> ''";
47 $result = $this->db->sql_query($sql);
48
49 while ($row = $this->db->sql_fetchrow($result))
50 {
51 $user_email_hash = phpbb_email_hash($row['user_email']);
52 if ($user_email_hash !== $row['user_email_hash'])
53 {
54 $sql_ary = array(
55 'user_email_hash' => $user_email_hash,
56 );
57
58 $sql = 'UPDATE ' . USERS_TABLE . '
59 SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
60 WHERE user_id = ' . (int) $row['user_id'];
61 $this->db->sql_query($sql);
62
63 if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)
64 {
65 $io->table(
66 array('user_id', 'user_email', 'user_email_hash'),
67 array(array($row['user_id'], $row['user_email'], $user_email_hash))
68 );
69 }
70 }
71 }
72 $this->db->sql_freeresult($result);
73
74 $io->success($this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS'));
75 }
76 }
77