diff options
| author | Christian Fowler <cfowler@einstein> | 2014-08-22 09:55:41 -0400 |
|---|---|---|
| committer | Christian Fowler <cfowler@einstein> | 2014-08-22 09:55:41 -0400 |
| commit | 9c467e4719d5469e7b796b60be6b32f74e8a61d9 (patch) | |
| tree | 223f026db0e1cbe369f249d66b9d6ba668cd86fa | |
| parent | 79bf28f12231f93b7dbf35393af39c321f336fc9 (diff) | |
| download | wiki-9c467e4719d5469e7b796b60be6b32f74e8a61d9.tar.gz wiki-9c467e4719d5469e7b796b60be6b32f74e8a61d9.tar.bz2 wiki-9c467e4719d5469e7b796b60be6b32f74e8a61d9.zip | |
For BitPage::getList, make content_type_guid optional, as the primary join is on wiki_pages; this allows for BitBooks to appear in the getList
| -rw-r--r-- | BitPage.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/BitPage.php b/BitPage.php index febfa18..11999c3 100644 --- a/BitPage.php +++ b/BitPage.php @@ -585,9 +585,13 @@ class BitPage extends LibertyMime { $whereSql = $joinSql = $selectSql = ''; $bindVars = array(); - array_push( $bindVars, $this->mContentTypeGuid ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, NULL, $pListHash ); + if ( !empty( $pListHash['content_type_guid'] ) ) { + $whereSql .= " AND lc.`content_type_guid`=? "; + $bindVars[] = $pListHash['content_type_guid']; + } + // make find_title compatible with {minifind} if( empty( $pListHash['find_title'] )) { $pListHash['find_title'] = $pListHash['find']; @@ -626,6 +630,7 @@ class BitPage extends LibertyMime { } if( empty( $pListHash['orphans_only'] )) { + $whereSql = preg_replace('/^ AND */',' WHERE ', $whereSql); $query = "SELECT uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name, wp.`page_id`, wp.`wiki_page_size` as `len`, lcds.`data` AS `summary`, wp.`edit_comment`, wp.`content_id`, wp.`flag`, @@ -638,7 +643,7 @@ class BitPage extends LibertyMime { LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary') LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_hits` lch ON (lc.`content_id` = lch.`content_id`) $joinSql - WHERE lc.`content_type_guid`=? $whereSql + $whereSql ORDER BY ".$this->mDb->convertSortmode( $pListHash['sort_mode'] ); $query_cant = " SELECT COUNT(*) @@ -647,9 +652,11 @@ class BitPage extends LibertyMime { INNER JOIN `".BIT_DB_PREFIX."users_users` uuc ON ( uuc.`user_id` = lc.`user_id` ) INNER JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = lc.`modifier_user_id` ) $joinSql - WHERE lc.`content_type_guid`=? $whereSql + $whereSql "; } else { + $whereSql .= ' AND lcl.`to_content_id` is NULL '; + $whereSql = preg_replace('/^ AND */',' WHERE ', $whereSql); $query = "SELECT uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name, wp.`page_id`, wp.`wiki_page_size` AS `len`,lcds.`data` AS `summary`, wp.`edit_comment`, wp.`content_id`, wp.`flag`, @@ -663,9 +670,7 @@ class BitPage extends LibertyMime { LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_hits` lch ON (lc.`content_id` = lch.`content_id`) LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary') $joinSql - WHERE lc.`content_type_guid`=? - AND lcl.`to_content_id` is NULL - $whereSql + $whereSql ORDER BY ".$this->mDb->convertSortmode( $pListHash['sort_mode'] ); $query_cant = " SELECT COUNT(*) @@ -673,9 +678,7 @@ class BitPage extends LibertyMime { LEFT JOIN `".BIT_DB_PREFIX."liberty_content_links` lcl ON (wp.`content_id` = lcl.`to_content_id`) INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lc.`content_id` = wp.`content_id`) $joinSql - WHERE lc.`content_type_guid`=? - AND lcl.`to_content_id` IS NULL - $whereSql"; + $whereSql"; } // If sort mode is versions then offset is 0, max_records is -1 (again) and sort_mode is nil |
