BUGFIX Removed double quoting of $where parameter in Translatable::get_existing_content_languages() (fixes #6203, thanks cloph) (from r114080)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@114081 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-11-23 19:22:53 +00:00 committed by Sam Minnee
parent 28f1c20c5d
commit b5e9b911d3

View File

@ -1288,13 +1288,11 @@ class Translatable extends DataObjectDecorator implements PermissionProvider {
* Get a list of languages with at least one element translated in (including the default language)
*
* @param string $className Look for languages in elements of this class
* @param string $where Optional SQL WHERE statement
* @return array Map of languages in the form locale => langName
*/
static function get_existing_content_languages($className = 'SiteTree', $where = '') {
$baseTable = ClassInfo::baseDataClass($className);
//We don't quote $where if it is empty:
if($where!='')
$where="\"$where\"";
$query = new SQLQuery("Distinct \"Locale\"","\"$baseTable\"",$where, '', "\"Locale\"");
$dbLangs = $query->execute()->column();
$langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs);