[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/db/migration/data/v30x/ -> local_url_bbcode.php (source)

   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  
  14  namespace phpbb\db\migration\data\v30x;
  15  
  16  class local_url_bbcode extends \phpbb\db\migration\migration
  17  {
  18  	static public function depends_on()
  19      {
  20          return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
  21      }
  22  
  23  	public function update_data()
  24      {
  25          return array(
  26              array('custom', array(array($this, 'update_local_url_bbcode'))),
  27          );
  28      }
  29  
  30      /**
  31      * Update BBCodes that currently use the LOCAL_URL tag
  32      *
  33      * To fix http://tracker.phpbb.com/browse/PHPBB3-8319 we changed
  34      * the second_pass_replace value, so that needs updating for existing ones
  35      */
  36  	public function update_local_url_bbcode()
  37      {
  38          $sql = 'SELECT *
  39              FROM ' . BBCODES_TABLE . '
  40              WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->get_any_char() . 'LOCAL_URL' . $this->db->get_any_char());
  41          $result = $this->db->sql_query($sql);
  42  
  43          while ($row = $this->db->sql_fetchrow($result))
  44          {
  45              if (!class_exists('acp_bbcodes'))
  46              {
  47                  if (function_exists('phpbb_require_updated'))
  48                  {
  49                      phpbb_require_updated('includes/acp/acp_bbcodes.' . $this->php_ext);
  50                  }
  51                  else
  52                  {
  53                      require($this->phpbb_root_path . 'includes/acp/acp_bbcodes.' . $this->php_ext);
  54                  }
  55              }
  56  
  57              $bbcode_match = $row['bbcode_match'];
  58              $bbcode_tpl = $row['bbcode_tpl'];
  59  
  60              $acp_bbcodes = new \acp_bbcodes();
  61              $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
  62  
  63              $sql = 'UPDATE ' . BBCODES_TABLE . '
  64                  SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
  65                  WHERE bbcode_id = ' . (int) $row['bbcode_id'];
  66              $this->sql_query($sql);
  67          }
  68          $this->db->sql_freeresult($result);
  69      }
  70  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1