DruStats provides visualizations for a variety of data obtained using the drupal.org API. This was built for a developer contest organized by Azri Solutions at DrupalCon Asia 2016. As per the contest rules, only data from drupal.org API is used to build the visualizations.
See installation section for detailed instructions on installing this application.
Once installed, the website may be used as any other web application directly from the browser. With a clean database, the software will not be able to show any visualizations. PHP CLI (with Laravel Artisan) is used to initiate commands that queue requests for retrieving data.
These are the commands provided by this application to queue requests.
php artisan dsget:nodes {type}
php artisan dsget:cijobs
php artisan dsget:users
php artisan dsget:terms
php artisan dsupdate:nodes {type}
php artisan dsupdate:cijobs
All the dsget
commands have the following options.
--page={page} --sort={field} --direction={ASC|DESC}
All dsget
commands start at the specified page (defaults to 0) and continue accessing the subsequent pages until it reaches the end. This is only required for initial setup or if you want to reset all data in the database. Normally, you would use dsupdate
commands to retrieve fresh content.
The application adds schedules to run various update commands at daily intervals at different times. A single cron job is required to allow Laravel to run this schedule.
* * * * * php /path/to/artisan schedule:run
See Laravel's documentation for more details.
The application needs the following software to run.
- PHP 5.5.9 (tested only on PHP 7)
- MongoDB 3.2
- PHP MongoDB extension
- Beanstalkd (the application would work without this but would not be able to update the database)
- Any web server that can work with PHP
To use the application, the following software is needed.
- Any modern browser (IE9+, Chrome, Firefox)
- Javascript to view the visualizations
To develop with this application, the following software is needed in addition to the above requirements.
- Composer
- Node.js (with npm)
- Gulp
These are the software components and libraries required to use DruStats.
- Apache, nginx, or any webserver compatible with PHP-FPM or PHP modules
- PHP 5.5.9 (PHP 7 recommended)
- MongoDB 3.2
- PHP MongoDB extension
- Beanstalk
- Composer (installed globally)
Clone this repository and run the following command in the directory.
$ git clone https://github.com/hussainweb/drupal-stats.git
$ cd drupal-stats/
$ composer install
Once composer installs the framework and other required libraries, run the migrations to setup the database. Currently, only indexes are created and the migrations are not strictily necessary for the working but it is recommended to migrate anyway.
$ php artisan migrate
The application is now ready for use and only needs data. Refer to the usage section to see how to start retrieving data from d.o. It might be a good idea to start with a database dump rather than retrieving the whole data yourself. Contact me for a database dump.
This application is open-sourced software licensed under the GPLv2 license.
This application is built using Laravel and many languages and technologies. It also uses data from various sources and the licenses are mentioned on a best-effort basis. All these licenses permit usage of these libraries or data for the purpose of this application and the license is preserved.
- Laravel - MIT License
- MongoDB - GNU AGPL v3.0
- PHP MongoDB extension - Apache License
- Beanstalk - MIT
- Drupal API Client - GPL v2
- Laravel MongoDB model - MIT
- Pheanstalk - MIT
- Artisan Beans - MIT
- PHP Markdown Lib - BSD-3-Clause
- Bootstrap - MIT
- d3.js - BSD License
- d3-legend - Permissive License
- d3-cloud - BSD
- Johan World GeoJSON - UNLICENSE