[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |