Skip to content

Commit e84f769

Browse files
committed
Fixes issue #2 related to MySQL 7 and DISTINCT queries.
1 parent 22fbc79 commit e84f769

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

system/user/addons/wiki/addon.setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'author_url' => 'http://ellislab.com/',
66
'name' => 'Wiki',
77
'description' => '',
8-
'version' => '3.0.1',
8+
'version' => '3.0.2',
99
'namespace' => 'User\Addons\Wiki',
1010
'settings_exist' => TRUE,
1111
'docs_url' => 'https://github.com/EllisLab/Wiki/wiki',

system/user/addons/wiki/mod.wiki.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,15 @@ function title_list($type = '')
12061206
switch ($type)
12071207
{
12081208
case 'uncategorized_pages' :
1209+
12091210
$this->return_data = str_replace('{wiki:page}', $this->_fetch_template('wiki_special_uncategorized_pages.html'), $this->return_data);
12101211

12111212
/** ---------------------------------------
12121213
/** Get categorized page ids
12131214
/** ---------------------------------------*/
12141215

1215-
$query = ee()->db->distinct('exp_wiki_category_articles.page_id')
1216+
$query = ee()->db->distinct()
1217+
->select('exp_wiki_category_articles.page_id')
12161218
->from('wiki_category_articles')
12171219
->join('wiki_page', 'exp_wiki_page.page_id = exp_wiki_category_articles.page_id')
12181220
->where('wiki_id', $this->wiki_id)
@@ -1907,11 +1909,18 @@ function retrieve_categories($namespace, $page_id='', $show_empty='y')
19071909

19081910
if ($page_id != '')
19091911
{
1910-
$query = ee()->db->query("SELECT cat_id FROM exp_wiki_category_articles WHERE page_id = '".ee()->db->escape_str($page_id)."'");
1912+
$query = ee()->db->select('cat_id')
1913+
->from('wiki_category_articles')
1914+
->where('page_id', $page_id)
1915+
->get();
19111916
}
19121917
else
19131918
{
1914-
$query = ee()->db->query("SELECT DISTINCT cat_id FROM exp_wiki_category_articles");
1919+
$query = ee()->db->distinct()
1920+
->select('cat_id')
1921+
->from('wiki_category_articles')
1922+
->get();
1923+
19151924
}
19161925

19171926
if ($query->num_rows() == 0)

0 commit comments

Comments
 (0)