GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

release_0_0_13::revert_schema()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
*
4
* @package phpBB Extension - RH Topic Tags
5
* @copyright (c) 2014 Robet Heim
6
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
*
8
*/
9
10
namespace robertheim\topictags\migrations;
11
12
use robertheim\topictags\prefixes;
13
use robertheim\topictags\tables;
14
15
class release_0_0_13 extends \phpbb\db\migration\migration
16
{
17
	protected $version = '0.0.13-b1';
18
19
	public function effectively_installed()
20
	{
21
		return version_compare($this->config[prefixes::CONFIG.'_version'], $this->version, '>=');
22
	}
23
24
	public static function depends_on()
25
	{
26
		return array(
27
			'\robertheim\topictags\migrations\release_0_0_12',
28
		);
29
	}
30
31
	public function update_schema()
32
	{
33
		return array(
34
			'add_columns'	=> array(
35
				$this->table_prefix . tables::TAGS	=> array(
36
					'tag_lowercase'	=> array('VCHAR:30', ''),
37
				),
38
			),
39
		);
40
	}
41
42
	public function revert_schema()
43
	{
44
		return array(
45
			'drop_columns'	=> array(
46
				$this->table_prefix . tables::TAGS	=> array(
47
					'tag_lowercase',
48
				),
49
			),
50
		);
51
	}
52
53 View Code Duplication
	public function update_data()
54
	{
55
		return array(
56
			array('custom', array(array($this, 'calculate_lowercase_tags'))),
57
			array('config.update', array(prefixes::CONFIG.'_version', $this->version)),
58
		);
59
	}
60
61
	public function calculate_lowercase_tags()
62
	{
63
		$sql = 'SELECT id, tag
64
			FROM ' . $this->table_prefix . tables::TAGS;
65
		$result = $this->db->sql_query($sql);
66
67
		while ($row = $this->db->sql_fetchrow($result))
68
		{
69
			$sql_ary = array(
70
				'tag_lowercase' =>utf8_strtolower($row['tag']),
71
			);
72
			$sql = 'UPDATE ' . $this->table_prefix . tables::TAGS . '
73
				SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
74
				WHERE id = ' . $row['id'];
75
			$this->db->sql_query($sql);
76
		}
77
78
		$this->db->sql_freeresult($result);
79
	}
80
}
81