Skip to content

Commit

Permalink
Fixes issue #2 related to MySQL 7 and DISTINCT queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsowell committed Mar 16, 2016
1 parent 22fbc79 commit e84f769
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion system/user/addons/wiki/addon.setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'author_url' => 'http://ellislab.com/',
'name' => 'Wiki',
'description' => '',
'version' => '3.0.1',
'version' => '3.0.2',
'namespace' => 'User\Addons\Wiki',
'settings_exist' => TRUE,
'docs_url' => 'https://github.com/EllisLab/Wiki/wiki',
Expand Down
15 changes: 12 additions & 3 deletions system/user/addons/wiki/mod.wiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -1206,13 +1206,15 @@ function title_list($type = '')
switch ($type)
{
case 'uncategorized_pages' :

$this->return_data = str_replace('{wiki:page}', $this->_fetch_template('wiki_special_uncategorized_pages.html'), $this->return_data);

/** ---------------------------------------
/** Get categorized page ids
/** ---------------------------------------*/

$query = ee()->db->distinct('exp_wiki_category_articles.page_id')
$query = ee()->db->distinct()
->select('exp_wiki_category_articles.page_id')
->from('wiki_category_articles')
->join('wiki_page', 'exp_wiki_page.page_id = exp_wiki_category_articles.page_id')
->where('wiki_id', $this->wiki_id)
Expand Down Expand Up @@ -1907,11 +1909,18 @@ function retrieve_categories($namespace, $page_id='', $show_empty='y')

if ($page_id != '')
{
$query = ee()->db->query("SELECT cat_id FROM exp_wiki_category_articles WHERE page_id = '".ee()->db->escape_str($page_id)."'");
$query = ee()->db->select('cat_id')
->from('wiki_category_articles')
->where('page_id', $page_id)
->get();
}
else
{
$query = ee()->db->query("SELECT DISTINCT cat_id FROM exp_wiki_category_articles");
$query = ee()->db->distinct()
->select('cat_id')
->from('wiki_category_articles')
->get();

}

if ($query->num_rows() == 0)
Expand Down

0 comments on commit e84f769

Please sign in to comment.