blob: 8021885d594b7cd62523d63eb1e6e4b7dc4bd042 [file] [log] [blame]
<?php
/********************************************************************************
* Copyright (c) 2018 The Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
require_once dirname ( __FILE__ ) . '/../charts.inc';
function chart_project_licenses(ChartContext $context) {
return ChartBuilder::named ( 'project_licenses' )
->title ( "Licenses (:date)" )
->description ( "Licenses in use by Eclipse Projects." )
->pieChart()
->query ('foundation', "
SELECT
license, count(project) as count
from (
SELECT
p.ProjectId as project,
group_concat(
if(LicenseId='EPL1.0','EPL-1.0',
if(LicenseId='EPL2.0','EPL-2.0',
if(LicenseId='EDL1.0','EDL-1.0',
if(LicenseId='ASL2.0','Apache-2.0',
if(LicenseId='CCBY3','CC-BY-3.0',
if(LicenseId='GPL-2.0_CP','GPL-2.0 WITH Classpath-exception-2.0'
LicenseId))))))
ORDER BY LicenseId separator ' OR ') as license
FROM ProjectLicenses as pl
JOIN Projects as p on pl.ProjectId=p.ProjectId
AND p.IsActive group by p.ProjectId
) as ProjectsAndLicenses
group by license
order by count desc
" )
->substitute ( ':date', (new DateTime())->format('Y-m-d') )
->column ( 'License', 'license', 'string')
->column ( 'Count', 'count', 'number' );
}
?>