| 1 |
<?php
|
| 2 |
// A bunch of defines for some of the node/vocabulary/term IDs used later.
|
| 3 |
define('DRUPAL_CORE_VID', 6);
|
| 4 |
define('DRUPAL_PROJECT_NID', 3060);
|
| 5 |
|
| 6 |
// Calculate list of core versions to use later.
|
| 7 |
$core_versions = array();
|
| 8 |
$result = db_query('SELECT td.tid, td.name FROM {term_data} td WHERE td.vid = %d ORDER BY td.name DESC', DRUPAL_CORE_VID);
|
| 9 |
while ($version = db_fetch_object($result)) {
|
| 10 |
$core_versions[$version->tid] = $version->name;
|
| 11 |
}
|
| 12 |
|
| 13 |
// Gather list of project types to use later.
|
| 14 |
$project_types = array();
|
| 15 |
$result = db_query('SELECT td.tid, td.name FROM {term_data} td INNER JOIN {term_hierarchy} th ON th.tid = td.tid WHERE td.vid = %d AND th.parent = 0', _project_get_vid());
|
| 16 |
while ($type = db_fetch_object($result)) {
|
| 17 |
if ($type->name != 'Drupal project') {
|
| 18 |
$project_types[$type->tid] = $type->name;
|
| 19 |
}
|
| 20 |
}
|
| 21 |
?>
|
| 22 |
|
| 23 |
<h2>Drupal project</h2>
|
| 24 |
<h3>Active installations</h3>
|
| 25 |
(Note: "active installations" refers to the number of Drupal sites with the <a href="http://drupal.org/project/update_status">Update Status</a> module enabled. This important security module is enabled by default in Drupal 6.x+, but previous versions will report a lower-than-normal count.)
|
| 26 |
|
| 27 |
<?php
|
| 28 |
// FIXME: Either this is wrong or the count below of top projects is wrong.
|
| 29 |
$items = array();
|
| 30 |
|
| 31 |
$total = 0;
|
| 32 |
foreach ($core_versions as $tid => $version) {
|
| 33 |
$count = db_result(db_query('SELECT pu.count FROM {project_usage_week_project} pu WHERE pu.nid = %d AND pu.tid = %d ORDER BY timestamp DESC', DRUPAL_PROJECT_NID, $tid));
|
| 34 |
if ($count > 0) {
|
| 35 |
$items[] = t('@version: @count active installations', array('@version' => $version, '@count' => number_format($count)));
|
| 36 |
$total += $count;
|
| 37 |
}
|
| 38 |
}
|
| 39 |
$items[] = t('@total total active installations', array('@total' => number_format($total)));
|
| 40 |
print theme('item_list', $items);
|
| 41 |
?>
|
| 42 |
|
| 43 |
<h3>Download statistics</h3>
|
| 44 |
Download statistics require parsing Apache logs and are periodically posted to the infrastructure list. These statistics only show a partial picture -- tarballs of Drupal that have been downloaded from drupal.org -- and do not reflect CVS checkouts, "1-click installs" from various hosting companies, etc.
|
| 45 |
|
| 46 |
Trends:
|
| 47 |
<ul>
|
| 48 |
<li><a href="http://buytaert.net/drupal-download-statistics-2006">http://buytaert.net/drupal-download-statistics-2006</a></li>
|
| 49 |
<li><a href="http://buytaert.net/drupal-download-statistics-2007">http://buytaert.net/drupal-download-statistics-2007</a></li>
|
| 50 |
</ul>
|
| 51 |
|
| 52 |
<h2>Drupal.org</h2>
|
| 53 |
<h3>Community</h3>
|
| 54 |
These figures indicate trends in Drupal community growth over time.
|
| 55 |
|
| 56 |
<?php
|
| 57 |
$items = array();
|
| 58 |
|
| 59 |
$count = db_result(db_query('SELECT COUNT(nid) FROM {node}'));
|
| 60 |
$items[] = t('Number of nodes: @count', array('@count' => number_format($count)));
|
| 61 |
|
| 62 |
$count = db_result(db_query('SELECT COUNT(cid) FROM {comments}'));
|
| 63 |
$items[] = t('Number of comments: @count', array('@count' => number_format($count)));
|
| 64 |
|
| 65 |
$count = db_result(db_query('SELECT COUNT(uid) FROM {users}'));
|
| 66 |
$items[] = t('Number of users: @count', array('@count' => number_format($count)));
|
| 67 |
|
| 68 |
print theme('item_list', $items);
|
| 69 |
?>
|
| 70 |
|
| 71 |
Trends:
|
| 72 |
<ul>
|
| 73 |
<li><a href="http://acko.net/blog/drupal-org-explosion-and-trends">http://acko.net/blog/drupal-org-explosion-and-trends</a></li>
|
| 74 |
</ul>
|
| 75 |
|
| 76 |
<h3>Traffic</h3>
|
| 77 |
I do not know where I can get this figure. I think on occasion it's posted to the infrastructure list.
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
<h2>Projects</h2>
|
| 82 |
<h3>Top 100 most popular projects</h3>
|
| 83 |
|
| 84 |
<?php
|
| 85 |
$items = array();
|
| 86 |
$result = db_query('SELECT n.nid, n.title, SUM(DISTINCT pu.count) as count FROM {node} n INNER JOIN {project_usage_week_project} pu ON n.nid = pu.nid WHERE n.nid IN (SELECT nid FROM {project_usage_week_project}) AND pu.nid <> %d GROUP BY n.nid, n.title ORDER BY count DESC LIMIT 100', DRUPAL_PROJECT_NID);
|
| 87 |
while ($row = db_fetch_object($result)) {
|
| 88 |
$items[] = t('<a href="@url">@name</a>: @count active installations', array('@url' => "http://drupal.org/node/$row->nid", '@name' => $row->title, '@count' => number_format($row->count)));
|
| 89 |
}
|
| 90 |
print theme('item_list', $items, '', 'ol');
|
| 91 |
?>
|
| 92 |
|
| 93 |
<h3>Total number of projects</h3>
|
| 94 |
<?php
|
| 95 |
|
| 96 |
foreach ($project_types as $type_tid => $type) {
|
| 97 |
echo '<h4>'. check_plain($type) .'</h4>';
|
| 98 |
$items = array();
|
| 99 |
foreach ($core_versions as $version_tid => $version) {
|
| 100 |
|
| 101 |
$count = db_result(db_query('SELECT COUNT(DISTINCT prn.pid) FROM {project_release_nodes} prn INNER JOIN {term_node} tnn ON prn.nid = tnn.nid INNER JOIN {term_node} tnp ON prn.pid = tnp.nid WHERE tnp.tid = %d AND tnn.tid = %d', $type_tid, $version_tid));
|
| 102 |
if ($count > 0) {
|
| 103 |
$items[] = t('@version @type: @count', array('@count' => number_format($count), '@version' => $version, '@type' => $type));
|
| 104 |
}
|
| 105 |
}
|
| 106 |
print theme('item_list', $items);
|
| 107 |
}
|
| 108 |
?>
|
| 109 |
|
| 110 |
<h2>Development</h2>
|
| 111 |
<?php
|
| 112 |
$items = array();
|
| 113 |
|
| 114 |
$count = db_result(db_query('SELECT COUNT(uid) FROM {cvs_accounts} WHERE status = %d', CVS_APPROVED));
|
| 115 |
$items[] = t('Number of CVS account holders: @count', array('@count' => number_format($count)));
|
| 116 |
|
| 117 |
// TODO: Number of core patches submitted per release?
|
| 118 |
|
| 119 |
// TODO: Number of contributors (both patch and cvs)?
|
| 120 |
|
| 121 |
print theme('item_list', $items);
|
| 122 |
?>
|