| @@ 15-23 (lines=9) @@ | ||
| 12 | ||
| 13 | class m2_initial_data extends \phpbb\db\migration\migration |
|
| 14 | { |
|
| 15 | public function effectively_installed() |
|
| 16 | { |
|
| 17 | $sql = 'SELECT * FROM ' . $this->table_prefix . 'ideas_statuses'; |
|
| 18 | $result = $this->db->sql_query_limit($sql, 1); |
|
| 19 | $row = $this->db->sql_fetchrow($result); |
|
| 20 | $this->db->sql_freeresult($result); |
|
| 21 | ||
| 22 | return $row !== false; |
|
| 23 | } |
|
| 24 | ||
| 25 | static public function depends_on() |
|
| 26 | { |
|
| @@ 15-25 (lines=11) @@ | ||
| 12 | ||
| 13 | class m4_update_statuses extends \phpbb\db\migration\migration |
|
| 14 | { |
|
| 15 | public function effectively_installed() |
|
| 16 | { |
|
| 17 | $sql = 'SELECT status_id |
|
| 18 | FROM ' . $this->table_prefix . "ideas_statuses |
|
| 19 | WHERE status_name='New'"; |
|
| 20 | $result = $this->db->sql_query($sql); |
|
| 21 | $row = $this->db->sql_fetchrow($result); |
|
| 22 | $this->db->sql_freeresult($result); |
|
| 23 | ||
| 24 | return $row === false; |
|
| 25 | } |
|
| 26 | ||
| 27 | static public function depends_on() |
|
| 28 | { |
|
| @@ 301-311 (lines=11) @@ | ||
| 298 | * |
|
| 299 | * @return array|false The idea row set, or false if not found. |
|
| 300 | */ |
|
| 301 | public function get_idea($id) |
|
| 302 | { |
|
| 303 | $sql = 'SELECT * |
|
| 304 | FROM ' . $this->table_ideas . ' |
|
| 305 | WHERE idea_id = ' . (int) $id; |
|
| 306 | $result = $this->db->sql_query_limit($sql, 1); |
|
| 307 | $row = $this->db->sql_fetchrow($result); |
|
| 308 | $this->db->sql_freeresult($result); |
|
| 309 | ||
| 310 | return $row; |
|
| 311 | } |
|
| 312 | ||
| 313 | /** |
|
| 314 | * Returns an idea specified by its topic ID. |
|
| @@ 320-330 (lines=11) @@ | ||
| 317 | * |
|
| 318 | * @return array|false The idea row set, or false if not found. |
|
| 319 | */ |
|
| 320 | public function get_idea_by_topic_id($id) |
|
| 321 | { |
|
| 322 | $sql = 'SELECT idea_id |
|
| 323 | FROM ' . $this->table_ideas . ' |
|
| 324 | WHERE topic_id = ' . (int) $id; |
|
| 325 | $result = $this->db->sql_query_limit($sql, 1); |
|
| 326 | $idea_id = (int) $this->db->sql_fetchfield('idea_id'); |
|
| 327 | $this->db->sql_freeresult($result); |
|
| 328 | ||
| 329 | return $this->get_idea($idea_id); |
|
| 330 | } |
|
| 331 | ||
| 332 | /** |
|
| 333 | * Do a live search on idea titles. Return any matches based on a given search query. |
|
| @@ 518-528 (lines=11) @@ | ||
| 515 | * |
|
| 516 | * @return string The idea's title |
|
| 517 | */ |
|
| 518 | public function get_title($id) |
|
| 519 | { |
|
| 520 | $sql = 'SELECT idea_title |
|
| 521 | FROM ' . $this->table_ideas . ' |
|
| 522 | WHERE idea_id = ' . (int) $id; |
|
| 523 | $result = $this->db->sql_query_limit($sql, 1); |
|
| 524 | $idea_title = $this->db->sql_fetchfield('idea_title'); |
|
| 525 | $this->db->sql_freeresult($result); |
|
| 526 | ||
| 527 | return $idea_title; |
|
| 528 | } |
|
| 529 | ||
| 530 | /** |
|
| 531 | * Submits a vote on an idea. |
|