├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .lando.yml ├── .lando └── mongo.yml ├── LICENSE.md ├── about.md ├── app ├── Console │ └── Kernel.php ├── DrupalStats │ ├── Console │ │ └── Commands │ │ │ ├── GetCommandBase.php │ │ │ ├── GetNewUsers.php │ │ │ ├── GetNodes.php │ │ │ ├── GetPiftCiJob.php │ │ │ ├── GetTerms.php │ │ │ ├── GetUsers.php │ │ │ ├── UpdateNodes.php │ │ │ └── UpdatePiftCiJob.php │ ├── Controllers │ │ ├── Api │ │ │ └── ProjectController.php │ │ ├── Data │ │ │ ├── CiJobsDataController.php │ │ │ ├── ProjectDataController.php │ │ │ ├── ProjectIssueDataController.php │ │ │ └── UserDataController.php │ │ ├── MarkdownPageController.php │ │ └── Visualizations │ │ │ ├── CiJobPageController.php │ │ │ ├── ProjectIssuePageController.php │ │ │ ├── ProjectPageController.php │ │ │ └── UserPageController.php │ ├── Jobs │ │ ├── RetrieveFieldOrganizationJob.php │ │ ├── RetrieveFieldReleaseJob.php │ │ ├── RetrieveJobBase.php │ │ ├── RetrieveNodeCollectionJob.php │ │ ├── RetrievePiftCiJobCollectionJob.php │ │ ├── RetrieveTermCollectionJob.php │ │ ├── RetrieveTermJob.php │ │ └── RetrieveUserCollectionJob.php │ ├── Middleware │ │ └── CacheMiddleware.php │ ├── Models │ │ ├── Entities │ │ │ ├── FieldCollectionOrganization.php │ │ │ ├── FieldCollectionRelease.php │ │ │ ├── JobStatus.php │ │ │ ├── Node.php │ │ │ ├── PiftCiJob.php │ │ │ ├── Term.php │ │ │ └── User.php │ │ ├── Repositories │ │ │ ├── FieldOrganizationRepository.php │ │ │ ├── FieldReleaseRepository.php │ │ │ ├── NodeRepository.php │ │ │ ├── PiftCiJobRepository.php │ │ │ ├── RepositoryBase.php │ │ │ ├── TermRepository.php │ │ │ └── UserRepository.php │ │ └── Services │ │ │ ├── CountryHelper.php │ │ │ └── JobStatusService.php │ └── Transformers │ │ ├── NodeTransformer.php │ │ ├── ProjectDataTransformer.php │ │ ├── ProjectReleaseTransformer.php │ │ └── TermDataTransformer.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── VerificationController.php │ │ └── Controller.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php └── User.php ├── artisan ├── bootstrap ├── app.php ├── autoload.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── sentry.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ └── 2016_02_10_205627_mongodb-indexes.php └── seeds │ └── DatabaseSeeder.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ ├── app.css │ └── app.css.map ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ ├── glyphicons-halflings-regular.woff2 │ └── vendor │ │ └── bootstrap-sass │ │ └── bootstrap │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 ├── geojson │ └── countries.geo.json ├── images │ ├── 01-module-downloads.png │ ├── 02-project-downloads.png │ ├── 03-projects-growth.png │ ├── 04-issues-breakdown.png │ ├── 05-user-countries.png │ ├── 06-user-languages.png │ ├── 07-user-expertise.png │ ├── 08-tests-status.png │ └── 09-tests-reasons.png ├── index.php ├── js │ ├── app.js │ ├── d3-cloud.js │ └── d3-cloud.js.map ├── mix-manifest.json ├── robots.txt ├── svg │ ├── 403.svg │ ├── 404.svg │ ├── 500.svg │ └── 503.svg └── web.config ├── readme.md ├── resources ├── country-list.json ├── js │ ├── app.js │ ├── bootstrap.js │ ├── components │ │ └── ExampleComponent.vue │ └── d3-cloud.js ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── sass │ ├── _variables.scss │ └── app.scss ├── views │ ├── charts │ │ └── growth-chart.blade.php │ ├── ci-jobs │ │ ├── test-jobs.blade.php │ │ └── test-reasons.blade.php │ ├── errors │ │ └── 503.blade.php │ ├── issues │ │ ├── project-breakdown.blade.php │ │ └── project-issue-count.blade.php │ ├── layouts │ │ ├── master.blade.php │ │ └── svg.blade.php │ ├── projects │ │ ├── module-downloads.blade.php │ │ ├── project-downloads.blade.php │ │ └── projects-growth.blade.php │ ├── simple-content.blade.php │ ├── users │ │ ├── user-countries.blade.php │ │ ├── user-country-growth.blade.php │ │ ├── user-expertise.blade.php │ │ ├── user-gender-growth.blade.php │ │ ├── user-growth.blade.php │ │ └── user-languages.blade.php │ ├── vendor │ │ └── .gitkeep │ └── welcome.blade.php └── world-110m.json ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=homestead 13 | DB_USERNAME=homestead 14 | DB_PASSWORD=secret 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | PUSHER_APP_ID= 34 | PUSHER_APP_KEY= 35 | PUSHER_APP_SECRET= 36 | PUSHER_APP_CLUSTER=mt1 37 | 38 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 39 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 40 | 41 | SENTRY_LARAVEL_DSN= 42 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | /.idea 7 | /.vscode 8 | /.vagrant 9 | Homestead.json 10 | Homestead.yaml 11 | npm-debug.log 12 | yarn-error.log 13 | .env 14 | .phpunit.result.cache 15 | -------------------------------------------------------------------------------- /.lando.yml: -------------------------------------------------------------------------------- 1 | name: drustats 2 | recipe: laravel 3 | 4 | services: 5 | appserver: 6 | type: php:7.2 7 | webroot: public 8 | run_as_root: 9 | - "pecl install mongodb" 10 | - "docker-php-ext-enable mongodb" 11 | database: 12 | type: mongo:3.5 13 | config: .lando/mongo.yml 14 | 15 | #config: 16 | # php: 7.2 17 | # webroot: public 18 | # xdebug: true 19 | 20 | tooling: 21 | mongo: 22 | service: database 23 | description: Drop into the mongo shell 24 | -------------------------------------------------------------------------------- /.lando/mongo.yml: -------------------------------------------------------------------------------- 1 | # mongod.conf 2 | 3 | # for documentation of all options, see: 4 | # http://docs.mongodb.org/manual/reference/configuration-options/ 5 | 6 | # Where and how to store data. 7 | storage: 8 | dbPath: /data/db 9 | journal: 10 | enabled: true 11 | # engine: 12 | # mmapv1: 13 | # wiredTiger: 14 | 15 | # where to write logging data. 16 | systemLog: 17 | destination: file 18 | logAppend: true 19 | path: /var/log/mongodb/mongod.log 20 | 21 | # network interfaces 22 | net: 23 | port: 27017 24 | bindIp: 0.0.0.0 25 | 26 | # how the process runs 27 | processManagement: 28 | timeZoneInfo: /usr/share/zoneinfo 29 | 30 | #security: 31 | 32 | #operationProfiling: 33 | 34 | #replication: 35 | 36 | #sharding: 37 | 38 | ## Enterprise-Only Options: 39 | 40 | #auditLog: 41 | 42 | #snmp: 43 | -------------------------------------------------------------------------------- /about.md: -------------------------------------------------------------------------------- 1 | DruStats provides visualizations for a variety of data obtained using the drupal.org API. This was built for a [developer contest](http://www.azrisolutions.com/drupalconasia-devcontest) organized by [Azri Solutions](http://www.azrisolutions.com/) at [DrupalCon Asia 2016](https://events.drupal.org/asia2016/dc-asia-azri-developer-contest). As per the contest rules, only data from drupal.org API is used to build the visualizations. 2 | 3 | Many of the visualizations are interactive to various degrees. You can hover over different parts of any visualizations to see popups with more information, e.g., hovering over any circle in the module downloads bubble graph would show the number of downloads for that module. Further, legend in some of the visualizations highlight the corresponding data when you hover over it. For example, hover over each legend cell in issues breakdown to see where that item is in the pie chart. 4 | 5 | This application is licensed under [GPL-v2](https://github.com/hussainweb/drupal-stats/blob/master/LICENSE.md). It uses various third party components which are licensed under [similar or permissive licenses](https://github.com/hussainweb/drupal-stats#license). Drupal is a [registered trademark](http://drupal.com/trademark) of [Dries Buytaert](http://buytaert.net/). 6 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('dsupdate:nodes project_release')->dailyAt('23:00'); 41 | $schedule->command('dsupdate:nodes project_module')->dailyAt('1:00'); 42 | $schedule->command('dsupdate:nodes project_theme')->dailyAt('1:30'); 43 | $schedule->command('dsupdate:nodes project_theme_engine')->dailyAt('2:00'); 44 | $schedule->command('dsupdate:nodes project_theme_drupalorg')->dailyAt('2:10'); 45 | $schedule->command('dsupdate:nodes project_core')->dailyAt('2:20'); 46 | $schedule->command('dsupdate:nodes project_distribution')->dailyAt('2:30'); 47 | $schedule->command('dsupdate:nodes organization')->dailyAt('2:40'); 48 | $schedule->command('dsupdate:nodes casestudy')->dailyAt('2:50'); 49 | $schedule->command('dsupdate:nodes book')->dailyAt('3:00'); 50 | $schedule->command('dsupdate:nodes project_issue')->dailyAt('3:30'); 51 | // $schedule->command('dsget:new-users')->dailyAt('4:30'); 52 | } 53 | 54 | /** 55 | * Register the Closure based commands for the application. 56 | * 57 | * @return void 58 | */ 59 | protected function commands() 60 | { 61 | $this->load(__DIR__.'../DrupalStats/Console/Commands'); 62 | require base_path('routes/console.php'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetCommandBase.php: -------------------------------------------------------------------------------- 1 | signature .= ' {--page=0 : Page to begin retrieving} 17 | {--sort= : Sort criteria} 18 | {--direction= : Direction of sorting}'; 19 | parent::__construct(); 20 | } 21 | 22 | protected function getQueryFromOptions() 23 | { 24 | $query = [ 25 | 'page' => $this->option('page'), 26 | ]; 27 | 28 | if ($opt = $this->option('sort')) { 29 | $query['sort'] = $opt; 30 | } 31 | if ($opt = $this->option('direction')) { 32 | $query['direction'] = $opt; 33 | } 34 | 35 | return $query; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetNewUsers.php: -------------------------------------------------------------------------------- 1 | getJobStatus('users', function () { 38 | /** @var Database $db */ 39 | $db = DB::getMongoDB(); 40 | 41 | $last_job = $db->users->findOne([], [ 42 | 'sort' => ['uid' => -1], 43 | 'limit' => 1, 44 | ]); 45 | return $last_job->uid; 46 | }); 47 | 48 | if (!empty($job->queued)) { 49 | $this->error('The request is already queued. You should see updates soon.'); 50 | return 1; 51 | } 52 | 53 | $req = new UserCollectionRequest([ 54 | 'sort' => 'uid', 55 | 'direction' => 'DESC', 56 | ]); 57 | $options = [ 58 | 'last_uid' => $job->last_uid, 59 | ]; 60 | $this->dispatch(new RetrieveUserCollectionJob($req, $options)); 61 | 62 | $job->queued = true; 63 | $job->save(); 64 | 65 | $this->line('The request is now queued. You should see updates soon.'); 66 | return 0; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetNodes.php: -------------------------------------------------------------------------------- 1 | getQueryFromOptions(); 40 | if ($type = $this->argument('type')) { 41 | $params['type'] = $type; 42 | $options['type'] = $type; 43 | } 44 | $this->dispatch(new RetrieveNodeCollectionJob(new NodeCollectionRequest($params), $options)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetPiftCiJob.php: -------------------------------------------------------------------------------- 1 | dispatch(new RetrievePiftCiJobCollectionJob(new PiftCiJobCollectionRequest($this->getQueryFromOptions()))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetTerms.php: -------------------------------------------------------------------------------- 1 | dispatch(new RetrieveTermCollectionJob(new TaxonomyTermCollectionRequest($this->getQueryFromOptions()))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/GetUsers.php: -------------------------------------------------------------------------------- 1 | dispatch(new RetrieveUserCollectionJob(new UserCollectionRequest($this->getQueryFromOptions()))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/UpdateNodes.php: -------------------------------------------------------------------------------- 1 | argument('type'); 38 | $job = $job_status_service->getJobStatus('nodes-' . $type, function () use ($type) { 39 | /** @var Database $db */ 40 | $db = DB::getMongoDB(); 41 | 42 | $last_job = $db->nodes->findOne([], [ 43 | 'sort' => ['changed' => -1], 44 | 'type' => $type, 45 | 'limit' => 1, 46 | ]); 47 | return $last_job->changed; 48 | }); 49 | 50 | if (!empty($job->queued)) { 51 | $this->error('The request is already queued. You should see updates soon.'); 52 | return 1; 53 | } 54 | 55 | $req = new NodeCollectionRequest([ 56 | 'type' => $type, 57 | 'sort' => 'changed', 58 | 'direction' => 'DESC', 59 | ]); 60 | $options = [ 61 | 'last_updated' => $job->last_updated, 62 | 'type' => $type, 63 | ]; 64 | $this->dispatch(new RetrieveNodeCollectionJob($req, $options)); 65 | 66 | $job->queued = true; 67 | $job->save(); 68 | 69 | $this->line('The request is now queued. You should see updates soon.'); 70 | return 0; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/DrupalStats/Console/Commands/UpdatePiftCiJob.php: -------------------------------------------------------------------------------- 1 | getJobStatus('pift_ci_jobs', function () { 38 | /** @var Database $db */ 39 | $db = DB::getMongoDB(); 40 | 41 | $last_job = $db->pift_ci_jobs->findOne([], [ 42 | 'sort' => ['updated' => -1], 43 | 'limit' => 1, 44 | ]); 45 | return $last_job->updated; 46 | }); 47 | 48 | if (!empty($job->queued)) { 49 | $this->error('The request is already queued. You should see updates soon.'); 50 | return 1; 51 | } 52 | 53 | $req = new PiftCiJobCollectionRequest([ 54 | 'sort' => 'updated', 55 | 'direction' => 'DESC', 56 | ]); 57 | $options = [ 58 | 'last_updated' => $job->last_updated, 59 | ]; 60 | $this->dispatch(new RetrievePiftCiJobCollectionJob($req, $options)); 61 | 62 | $job->queued = true; 63 | $job->save(); 64 | 65 | $this->line('The request is now queued. You should see updates soon.'); 66 | return 0; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Api/ProjectController.php: -------------------------------------------------------------------------------- 1 | middleware('data.cache'); 23 | 24 | $this->fractalManager = $fractal_manager; 25 | $include = $request->query->get('include'); 26 | if ($include) { 27 | $this->fractalManager->parseIncludes($request->query->get('include')); 28 | } 29 | } 30 | 31 | public function projectInfo($name) 32 | { 33 | $node = Node::where('field_project_machine_name', $name) 34 | ->whereIn('type', [ 35 | 'project_module', 36 | 'project_theme', 37 | 'project_core', 38 | 'project_distribution', 39 | 'project_theme_engine', 40 | 'project_drupalorg', 41 | ]) 42 | ->first(); 43 | 44 | if (!$node) { 45 | abort(404); 46 | } 47 | 48 | $resource = new Item($node, new ProjectDataTransformer()); 49 | 50 | return $this->fractalManager->createData($resource)->toArray(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Data/CiJobsDataController.php: -------------------------------------------------------------------------------- 1 | middleware('data.cache', [ 22 | 'except' => [ 23 | 'cijobsRefresh', 24 | ], 25 | ]); 26 | } 27 | 28 | public function cijobsBranchStatus() 29 | { 30 | /** @var Database $db */ 31 | $db = DB::getMongoDB(); 32 | 33 | $rows = $db->pift_ci_jobs->aggregate([ 34 | [ 35 | '$group' => [ 36 | '_id' => [ 37 | 'branch' => '$core_branch', 38 | 'status' => '$status', 39 | ], 40 | 'count' => [ 41 | '$sum' => 1, 42 | ], 43 | ], 44 | ], 45 | ])->toArray(); 46 | 47 | $statuses = array_unique(array_map(function ($row) { 48 | return $row->_id->status; 49 | }, $rows)); 50 | $branches = array_unique(array_map(function ($row) { 51 | return $row->_id->branch ?: 'not-set'; 52 | }, $rows)); 53 | 54 | sort($statuses); 55 | sort($branches); 56 | 57 | $data = []; 58 | foreach ($statuses as $status) { 59 | foreach ($branches as $branch) { 60 | $data[$status][$branch] = [ 61 | 'branch' => $branch, 62 | 'status' => $status, 63 | 'count' => 0, 64 | ]; 65 | } 66 | } 67 | 68 | foreach ($rows as $row) { 69 | $branch = $row->_id->branch ?: 'not-set'; 70 | $status = $row->_id->status; 71 | 72 | $data[$status][$branch] = [ 73 | 'branch' => $branch, 74 | 'status' => $status, 75 | 'count' => $row->count, 76 | ]; 77 | } 78 | 79 | $data = array_map(function ($data) { 80 | return array_values($data); 81 | }, $data); 82 | 83 | return response()->json([ 84 | 'branches' => array_values($branches), 85 | 'status' => array_values($statuses), 86 | 'data' => array_values($data), 87 | ]); 88 | } 89 | 90 | public function cijobsBranchReason() 91 | { 92 | /** @var Database $db */ 93 | $db = DB::getMongoDB(); 94 | 95 | $rows = $db->pift_ci_jobs->aggregate([ 96 | [ 97 | '$group' => [ 98 | '_id' => [ 99 | 'branch' => '$core_branch', 100 | 'reason' => '$reason', 101 | ], 102 | 'count' => [ 103 | '$sum' => 1, 104 | ], 105 | ], 106 | ], 107 | ])->toArray(); 108 | 109 | $reasons = array_unique(array_map(function ($row) { 110 | return $row->_id->reason ?: 'not-set'; 111 | }, $rows)); 112 | $branches = array_unique(array_map(function ($row) { 113 | return $row->_id->branch ?: 'not-set'; 114 | }, $rows)); 115 | 116 | sort($reasons); 117 | sort($branches); 118 | 119 | $data = []; 120 | foreach ($branches as $branch) { 121 | foreach ($reasons as $reason) { 122 | $data[$branch][$reason] = [ 123 | 'branch' => $branch, 124 | 'reason' => $reason, 125 | 'count' => 0, 126 | ]; 127 | } 128 | } 129 | 130 | foreach ($rows as $row) { 131 | $branch = $row->_id->branch ?: 'not-set'; 132 | $reason = $row->_id->reason ?: 'not-set'; 133 | 134 | $data[$branch][$reason] = [ 135 | 'branch' => $branch, 136 | 'reason' => $reason, 137 | 'count' => $row->count, 138 | ]; 139 | } 140 | 141 | $data = array_map(function ($data) { 142 | return array_values($data); 143 | }, $data); 144 | 145 | return response()->json([ 146 | 'branches' => array_values($branches), 147 | 'reasons' => array_values($reasons), 148 | 'data' => array_values($data), 149 | ]); 150 | } 151 | 152 | public function cijobsRefresh(JobStatusService $job_status_service) 153 | { 154 | $job = $job_status_service->getJobStatus('pift_ci_jobs', function () { 155 | /** @var Database $db */ 156 | $db = DB::getMongoDB(); 157 | 158 | $last_job = $db->pift_ci_jobs->findOne([], [ 159 | 'sort' => ['updated' => -1], 160 | 'limit' => 1, 161 | ]); 162 | return $last_job->updated; 163 | }); 164 | 165 | if (!empty($job->queued)) { 166 | return response()->json([ 167 | 'message' => 'The request is already queued. You should see updates soon.', 168 | ])->setStatusCode(406); 169 | } 170 | 171 | $req = new PiftCiJobCollectionRequest([ 172 | 'sort' => 'updated', 173 | 'direction' => 'DESC', 174 | ]); 175 | $options = [ 176 | 'last_updated' => $job->last_updated, 177 | ]; 178 | $this->dispatch(new RetrievePiftCiJobCollectionJob($req, $options)); 179 | 180 | $job->queued = true; 181 | $job->save(); 182 | 183 | return response()->json([ 184 | 'message' => 'We have queued the request. You should see updates soon.', 185 | ])->setStatusCode(202); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/MarkdownPageController.php: -------------------------------------------------------------------------------- 1 | $title, 21 | 'page_content' => $content, 22 | ]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Visualizations/CiJobPageController.php: -------------------------------------------------------------------------------- 1 | 'CI Jobs - Status of tests']); 17 | } 18 | 19 | public function cijobReason() 20 | { 21 | return view('ci-jobs/test-reasons', ['title' => 'CI Jobs - Reasons for testing']); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Visualizations/ProjectIssuePageController.php: -------------------------------------------------------------------------------- 1 | $title, 23 | 'project_name' => $name, 24 | ]); 25 | } 26 | 27 | public function projectIssueCount(Request $request) 28 | { 29 | $title = 'Issues Count in projects'; 30 | $url = "data/project-issue-count"; 31 | if ($request->input('open_issues')) { 32 | $url .= "?open_issues=1"; 33 | } 34 | return view('issues/project-issue-count', [ 35 | 'title' => $title, 36 | 'url' => url($url), 37 | ]); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Visualizations/ProjectPageController.php: -------------------------------------------------------------------------------- 1 | 'Module - Categories - Downloads Bubble Chart']); 17 | } 18 | 19 | public function projectDownloads() 20 | { 21 | return view('projects/project-downloads', ['title' => 'Projects - Downloads Bubble Chart']); 22 | } 23 | 24 | public function projectsGrowth() 25 | { 26 | $values = [ 27 | 'title' => 'Projects Growth', 28 | 'data_url' => url('data/projects-growth'), 29 | 'data_types' => [ 30 | 'project_module' => 'Modules', 31 | 'project_theme' => 'Themes', 32 | 'project_distribution' => 'Distributions', 33 | 'project_core' => 'Core', 34 | 'project_theme_engine' => 'Theme Engines', 35 | ], 36 | 'default_data_types' => [ 37 | 'project_module', 38 | 'project_theme', 39 | 'project_distribution', 40 | 'project_core', 41 | 'project_theme_engine', 42 | ], 43 | 'show_filter' => true, 44 | ]; 45 | return view('projects/projects-growth', $values); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/DrupalStats/Controllers/Visualizations/UserPageController.php: -------------------------------------------------------------------------------- 1 | 'User - Languages']); 17 | } 18 | 19 | public function userExpertise() 20 | { 21 | return view('users/user-expertise', ['title' => 'User - Expertise']); 22 | } 23 | 24 | public function userCountries() 25 | { 26 | return view('users/user-countries', ['title' => 'User - Countries']); 27 | } 28 | 29 | public function userGrowth() 30 | { 31 | $values = [ 32 | 'title' => 'User Growth', 33 | 'data_url' => url('data/user-growth'), 34 | 'data_types' => [ 35 | 'total' => 'Total', 36 | ], 37 | 'default_data_types' => [ 38 | 'total', 39 | ], 40 | 'show_filter' => false, 41 | 'y_number_format' => '2s', 42 | ]; 43 | return view('users/user-growth', $values); 44 | } 45 | 46 | public function userGenderGrowth() 47 | { 48 | $values = [ 49 | 'title' => 'User Gender Growth', 50 | 'data_url' => url('data/user-gender-growth'), 51 | 'data_types' => [ 52 | 'na' => 'N/A', 53 | 'male' => 'Male', 54 | 'female' => 'Female', 55 | 'other' => 'Other', 56 | 'transgender' => 'Transgender', 57 | ], 58 | 'default_data_types' => [ 59 | 'male', 60 | 'female', 61 | 'other', 62 | 'transgender', 63 | ], 64 | 'show_filter' => true, 65 | 'y_number_format' => '2s', 66 | ]; 67 | return view('users/user-gender-growth', $values); 68 | } 69 | 70 | public function userCountryGrowth() 71 | { 72 | $values = [ 73 | 'title' => 'User Country Growth', 74 | 'data_url' => url('data/user-country-growth'), 75 | 'data_types' => [], 76 | 'default_data_types' => [], 77 | 'show_filter' => false, 78 | 'y_number_format' => '2s', 79 | ]; 80 | return view('users/user-country-growth', $values); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveFieldOrganizationJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . "\n"; 24 | 25 | $client = new Client(); 26 | /** @var FieldCollection $term */ 27 | $fc = $client->getEntity($this->request); 28 | 29 | if (empty($fc->item_id)) { 30 | echo "Skipping empty field collection " . (string) $this->request->getUri() . "\n"; 31 | return; 32 | } 33 | 34 | $repo = new FieldOrganizationRepository(); 35 | $repo->saveEntity($fc); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveFieldReleaseJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . "\n"; 24 | 25 | $client = new Client(); 26 | /** @var FieldCollection $term */ 27 | $fc = $client->getEntity($this->request); 28 | 29 | if (empty($fc->item_id)) { 30 | echo "Skipping empty field collection " . (string) $this->request->getUri() . "\n"; 31 | return; 32 | } 33 | 34 | $repo = new FieldReleaseRepository(); 35 | $repo->saveEntity($fc); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveJobBase.php: -------------------------------------------------------------------------------- 1 | request = $request; 39 | $this->options = $options; 40 | } 41 | 42 | protected function getOption($name, $default = null) 43 | { 44 | return !empty($this->options[$name]) ? $this->options[$name] : $default; 45 | } 46 | 47 | protected function getMaxUpdated() 48 | { 49 | return $this->getOption('max_updated'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveNodeCollectionJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . ".\n"; 29 | 30 | $client = new Client(); 31 | $collection = $client->getEntity($this->request); 32 | $repo = new NodeRepository(); 33 | 34 | // Save the maximum updated value in options as we won't have the actual 35 | // maximum when parsing later pages. 36 | $max_updated = $this->getMaxUpdated(); 37 | $hit_last_updated = false; 38 | 39 | /** @var Node $node */ 40 | foreach ($collection as $node) { 41 | $max_updated = ($max_updated < $node->changed) ? $node->changed : $max_updated; 42 | if (!empty($this->options['last_updated']) && $node->changed < $this->options['last_updated']) { 43 | $hit_last_updated = true; 44 | break; 45 | } 46 | $repo->saveEntity($node); 47 | } 48 | 49 | foreach ($repo->terms as $tid) { 50 | // This should already be an integer, but make sure. 51 | $tid = (int) $tid; 52 | if (is_null(Term::find($tid))) { 53 | echo "Queueing term " . $tid . "...\n"; 54 | $this->dispatch(new RetrieveTermJob(new TaxonomyTermRequest($tid))); 55 | } 56 | } 57 | 58 | foreach ($repo->releases as $release) { 59 | echo "Queuing release " . $release . "...\n"; 60 | $this->dispatch(new RetrieveFieldReleaseJob(new FieldCollectionRequest($release))); 61 | } 62 | 63 | if (!$hit_last_updated && $next_url = $collection->getNextLink()) { 64 | $next_url_params = []; 65 | parse_str($next_url->getQuery(), $next_url_params); 66 | $this->options['max_updated'] = $max_updated; 67 | $this->dispatch(new RetrieveNodeCollectionJob(new NodeCollectionRequest($next_url_params), $this->options)); 68 | } 69 | else { 70 | if (!empty($this->options['last_updated']) && $job_status = JobStatus::find('nodes-' . $this->getOption('type', ''))) { 71 | echo sprintf("Completed retrieving nodes from %s.\n", 72 | date('Y-m-d H:i:s', $this->options['last_updated'])); 73 | $job_status->queued = false; 74 | $job_status->last_updated = $max_updated; 75 | $job_status->save(); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrievePiftCiJobCollectionJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . ".\n"; 26 | 27 | $client = new Client(); 28 | $collection = $client->getEntity($this->request); 29 | $repo = new PiftCiJobRepository(); 30 | 31 | // Save the maximum updated value in options as we won't have the actual 32 | // maximum when parsing later pages. 33 | $max_updated = $this->getMaxUpdated(); 34 | $hit_last_updated = false; 35 | 36 | /** @var PiftCiJob $job */ 37 | foreach ($collection as $job) { 38 | $max_updated = ($max_updated < $job->updated) ? $job->updated : $max_updated; 39 | if (!empty($this->options['last_updated']) && $job->updated < $this->options['last_updated']) { 40 | $hit_last_updated = true; 41 | break; 42 | } 43 | $repo->saveEntity($job); 44 | } 45 | 46 | if (!$hit_last_updated && $next_url = $collection->getNextLink()) { 47 | $next_url_params = []; 48 | parse_str($next_url->getQuery(), $next_url_params); 49 | $this->options['max_updated'] = $max_updated; 50 | $this->dispatch(new RetrievePiftCiJobCollectionJob(new PiftCiJobCollectionRequest($next_url_params), $this->options)); 51 | } 52 | else { 53 | if (!empty($this->options['last_updated']) && $job_status = JobStatus::find('pift_ci_jobs')) { 54 | echo sprintf("Completed retrieving ci jobs from %s.\n", 55 | date('Y-m-d H:i:s', $this->options['last_updated'])); 56 | $job_status->queued = false; 57 | $job_status->last_updated = $max_updated; 58 | $job_status->save(); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveTermCollectionJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . ".\n"; 25 | 26 | $client = new Client(); 27 | $collection = $client->getEntity($this->request); 28 | $repo = new TermRepository(); 29 | 30 | /** @var TaxonomyTerm $term */ 31 | foreach ($collection as $term) { 32 | $repo->saveEntity($term); 33 | } 34 | 35 | if ($next_url = $collection->getNextLink()) { 36 | $next_url_params = []; 37 | parse_str($next_url->getQuery(), $next_url_params); 38 | $this->dispatch(new RetrieveTermCollectionJob(new TaxonomyTermCollectionRequest($next_url_params), $this->options)); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveTermJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . "\n"; 25 | 26 | $client = new Client(); 27 | /** @var TaxonomyTerm $term */ 28 | $term = $client->getEntity($this->request); 29 | 30 | if (empty($term->tid)) { 31 | echo "Skipping empty term " . (string) $this->request->getUri() . "\n"; 32 | return; 33 | } 34 | 35 | $repo = new TermRepository(); 36 | $repo->saveEntity($term); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/DrupalStats/Jobs/RetrieveUserCollectionJob.php: -------------------------------------------------------------------------------- 1 | request->getUri() . ".\n"; 27 | 28 | $client = new Client(); 29 | $collection = $client->getEntity($this->request); 30 | $repo = new UserRepository(); 31 | 32 | // Save the maximum updated value in options as we won't have the actual 33 | // maximum when parsing later pages. 34 | $max_uid = $this->getOption('max_uid'); 35 | $hit_last_uid = false; 36 | 37 | /** @var User $user */ 38 | foreach ($collection as $user) { 39 | // Skip anonymous user as we don't need to save it. 40 | if (!$user->uid) { 41 | continue; 42 | } 43 | $max_uid = ($max_uid < $user->uid) ? $user->uid : $max_uid; 44 | if (!empty($this->options['last_uid']) && $user->uid < $this->options['last_uid']) { 45 | $hit_last_uid = true; 46 | break; 47 | } 48 | $repo->saveEntity($user); 49 | } 50 | 51 | foreach ($repo->organizations as $organization) { 52 | echo "Queuing organization " . $organization . "...\n"; 53 | $this->dispatch(new RetrieveFieldOrganizationJob(new FieldCollectionRequest($organization))); 54 | } 55 | 56 | if (!$hit_last_uid && $next_url = $collection->getNextLink()) { 57 | $next_url_params = []; 58 | parse_str($next_url->getQuery(), $next_url_params); 59 | $this->options['max_uid'] = $max_uid; 60 | $this->dispatch(new RetrieveUserCollectionJob(new UserCollectionRequest($next_url_params), $this->options)); 61 | } 62 | else { 63 | if (!empty($this->options['last_uid']) && $job_status = JobStatus::find('users')) { 64 | echo sprintf("Completed retrieving users from uid %d.\n", 65 | $this->options['last_uid']); 66 | $job_status->queued = false; 67 | $job_status->last_uid = $max_uid; 68 | $job_status->save(); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/DrupalStats/Middleware/CacheMiddleware.php: -------------------------------------------------------------------------------- 1 | buildCacheKey($request); 25 | if (!is_null($response = Cache::get($key))) { 26 | return $this->unserializeResponse($response); 27 | } 28 | 29 | /** @var Response $response */ 30 | $response = $next($request); 31 | Cache::put($key, $this->serializeResponse($response), static::CACHE_MINUTES); 32 | 33 | return $response; 34 | } 35 | 36 | /** 37 | * Derive a cache key from the request. 38 | * 39 | * @param \Illuminate\Http\Request $request 40 | * @param string $suffix 41 | * 42 | * @return string 43 | * The cache key. 44 | */ 45 | protected function buildCacheKey(Request $request, $suffix = '') 46 | { 47 | return 'route_' . Str::slug($request->getUri()) . $suffix; 48 | } 49 | 50 | protected function serializeResponse(Response $response) 51 | { 52 | $content = $response->getContent(); 53 | $status_code = $response->getStatusCode(); 54 | $headers = $response->headers; 55 | return serialize(compact('content', 'status_code', 'headers')); 56 | } 57 | 58 | protected function unserializeResponse($serializedResponse) 59 | { 60 | $responseProperties = unserialize($serializedResponse); 61 | $response = new Response($responseProperties['content'], $responseProperties['status_code']); 62 | $response->headers = $responseProperties['headers']; 63 | return $response; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Entities/FieldCollectionOrganization.php: -------------------------------------------------------------------------------- 1 | uri); 33 | } 34 | elseif ($key == 'field_organization_reference') { 35 | unset($value->uri); 36 | unset($value->resource); 37 | } 38 | elseif (in_array($key, $keys_make_int)) { 39 | $value = (int) $value; 40 | } 41 | 42 | return parent::processValue($key, $value); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Repositories/FieldReleaseRepository.php: -------------------------------------------------------------------------------- 1 | uri); 34 | } 35 | elseif ($key == 'field_release_file' && isset($value->file)) { 36 | unset($value->file->uri); 37 | unset($value->file->resource); 38 | } 39 | elseif (in_array($key, $keys_make_int)) { 40 | $value = (int) $value; 41 | } 42 | 43 | return parent::processValue($key, $value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Repositories/NodeRepository.php: -------------------------------------------------------------------------------- 1 | $term_item) { 75 | $this->terms[$term_item->id] = (int) $term_item->id; 76 | unset($value[$i]->uri); 77 | unset($value[$i]->resource); 78 | } 79 | } 80 | else { 81 | $this->terms[$value->id] = (int) $value->id; 82 | unset($value->uri); 83 | unset($value->resource); 84 | } 85 | } 86 | elseif (in_array($key, $keys_nullify)) { 87 | $value = null; 88 | } 89 | elseif (in_array($key, $keys_references)) { 90 | if (is_array($value)) { 91 | foreach ($value as $i => $item) { 92 | if ($key == 'field_release_files') { 93 | $this->releases[$item->id] = $item->id; 94 | } 95 | unset($value[$i]->uri); 96 | unset($value[$i]->resource); 97 | } 98 | } 99 | else { 100 | unset($value->uri); 101 | unset($value->resource); 102 | } 103 | } 104 | elseif (in_array($key, $keys_files)) { 105 | foreach ($value as $i => $item) { 106 | if (isset($value[$i]->file)) { 107 | unset($value[$i]->file->uri); 108 | unset($value[$i]->file->resource); 109 | } 110 | } 111 | } 112 | elseif (in_array($key, $keys_make_int)) { 113 | $value = (int) $value; 114 | } 115 | elseif (in_array($key, $keys_make_bool)) { 116 | $value = (bool) $value; 117 | } 118 | 119 | return parent::processValue($key, $value); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Repositories/PiftCiJobRepository.php: -------------------------------------------------------------------------------- 1 | getModel(); 32 | $item = $model->findOrNew($entity->getId()); 33 | foreach ($entity->getData() as $key => $value) { 34 | $item->$key = $this->processValue($key, $value); 35 | } 36 | $item->_id = $entity->getId(); 37 | $item->save(); 38 | } 39 | 40 | /** 41 | * Process the value of a property and optionally modify it. 42 | * 43 | * @param string $key 44 | * The key of the property 45 | * @param mixed $value 46 | * The value of the property 47 | * 48 | * @return mixed 49 | * The modified value of the property 50 | */ 51 | protected function processValue($key, $value) 52 | { 53 | return $value; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Repositories/TermRepository.php: -------------------------------------------------------------------------------- 1 | uri); 29 | unset($value->resource); 30 | } 31 | elseif ($key == 'parents_all') { 32 | foreach ($value as $i => $item) { 33 | unset($value[$i]->uri); 34 | unset($value[$i]->resource); 35 | } 36 | } 37 | elseif ($key == 'tid') { 38 | $value = (int) $value; 39 | } 40 | 41 | return parent::processValue($key, $value); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Repositories/UserRepository.php: -------------------------------------------------------------------------------- 1 | $item) { 43 | if ($key == 'field_organizations') { 44 | $this->organizations[$item->id] = $item->id; 45 | } 46 | unset($value[$i]->uri); 47 | unset($value[$i]->resource); 48 | } 49 | } 50 | elseif (in_array($key, $keys_make_int)) { 51 | $value = (int) $value; 52 | } 53 | 54 | return parent::processValue($key, $value); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Services/CountryHelper.php: -------------------------------------------------------------------------------- 1 | countryCodes = json_decode(file_get_contents(resource_path('country-list.json')), true); 18 | $this->countries = array_flip($this->countryCodes); 19 | } 20 | 21 | public function getCountry($alpha3_code) 22 | { 23 | return isset($this->countries[$alpha3_code]) ? $this->countries[$alpha3_code] : null; 24 | } 25 | 26 | public function getCountryCode($name) 27 | { 28 | return isset($this->countryCodes[$name]) ? $this->countryCodes[$name] : null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/DrupalStats/Models/Services/JobStatusService.php: -------------------------------------------------------------------------------- 1 | _id = $name; 21 | $job->last_updated = $get_last_updated(); 22 | $job->queued = false; 23 | } 24 | 25 | return $job; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/DrupalStats/Transformers/NodeTransformer.php: -------------------------------------------------------------------------------- 1 | $field_name)) { 16 | return null; 17 | } 18 | 19 | $term = Term::find((int) $node->$field_name['id']); 20 | if (!$term) { 21 | return null; 22 | } 23 | 24 | return $this->item($term, new TermDataTransformer()); 25 | } 26 | 27 | protected function processTaxonomyVocabularyArray(Node $node, $vid) 28 | { 29 | $field_name = 'taxonomy_vocabulary_' . $vid; 30 | if (empty($node->$field_name)) { 31 | return null; 32 | } 33 | 34 | $ids = array_map(function ($item) { 35 | return (int) $item['id']; 36 | }, $node->$field_name); 37 | 38 | return $this->collection(Term::whereIn('_id', $ids)->get(), new TermDataTransformer()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/DrupalStats/Transformers/ProjectDataTransformer.php: -------------------------------------------------------------------------------- 1 | $node->nid, 21 | 'type' => $node->type, 22 | 'title' => $node->title, 23 | 'machine_name' => $node->field_project_machine_name, 24 | 'project_type' => $node->field_project_type, 25 | 'issue_queue' => $node->field_project_has_issue_queue, 26 | 'components' => $node->field_project_components, 27 | 'releases' => $node->field_project_has_releases, 28 | 'downloads' => $node->field_download_count, 29 | 'demo' => $node->field_project_demo['url'] ?? '', 30 | 'documentation' => $node->field_project_documentation['url'] ?? '', 31 | 'homepage' => $node->field_project_homepage['url'] ?? '', 32 | 'created' => date('c', $node->created), 33 | 'changed' => date('c', $node->changed), 34 | ]; 35 | } 36 | 37 | public function includeModuleCategories(Node $node) 38 | { 39 | return $this->processTaxonomyVocabularyArray($node, '3'); 40 | } 41 | 42 | public function includeMaintenanceStatus(Node $node) 43 | { 44 | return $this->processTaxonomyVocabulary($node, '44'); 45 | } 46 | 47 | public function includeDevelopmentStatus(Node $node) 48 | { 49 | return $this->processTaxonomyVocabulary($node, '46'); 50 | } 51 | 52 | public function includeReleases(Node $node) 53 | { 54 | $releases = Node::where('type', 'project_release') 55 | ->where('field_release_project.id', (string) $node->nid) 56 | ->get(); 57 | return $this->collection($releases, new ProjectReleaseTransformer()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/DrupalStats/Transformers/ProjectReleaseTransformer.php: -------------------------------------------------------------------------------- 1 | $node->nid, 19 | 'title' => $node->title, 20 | 'version' => [ 21 | 'full' => $node->field_release_version, 22 | 'major' => $node->field_release_version_major, 23 | 'minor' => $node->field_release_version_minor, 24 | 'patch' => $node->field_release_version_patch, 25 | 'extra' => $node->field_release_version_extra, 26 | 'vcs_label' => $node->field_release_vcs_label, 27 | ], 28 | 'created' => date('c', $node->created), 29 | 'changed' => date('c', $node->changed), 30 | ]; 31 | } 32 | 33 | public function includeCoreCompatibility(Node $node) 34 | { 35 | return $this->processTaxonomyVocabulary($node, '6'); 36 | } 37 | 38 | public function includeReleaseType(Node $node) 39 | { 40 | return $this->processTaxonomyVocabularyArray($node, '7'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/DrupalStats/Transformers/TermDataTransformer.php: -------------------------------------------------------------------------------- 1 | $term->tid, 15 | 'name' => $term->name, 16 | 'description' => $term->description, 17 | ]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | bound('sentry') && $this->shouldReport($exception)) { 38 | app('sentry')->captureException($exception); 39 | } 40 | 41 | parent::report($exception); 42 | } 43 | 44 | /** 45 | * Render an exception into an HTTP response. 46 | * 47 | * @param \Illuminate\Http\Request $request 48 | * @param \Exception $exception 49 | * @return \Illuminate\Http\Response 50 | */ 51 | public function render($request, Exception $exception) 52 | { 53 | return parent::render($request, $exception); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 41 | } 42 | 43 | /** 44 | * Get a validator for an incoming registration request. 45 | * 46 | * @param array $data 47 | * @return \Illuminate\Contracts\Validation\Validator 48 | */ 49 | protected function validator(array $data) 50 | { 51 | return Validator::make($data, [ 52 | 'name' => 'required|string|max:255', 53 | 'email' => 'required|string|email|max:255|unique:users', 54 | 'password' => 'required|string|min:6|confirmed', 55 | ]); 56 | } 57 | 58 | /** 59 | * Create a new user instance after a valid registration. 60 | * 61 | * @param array $data 62 | * @return \App\User 63 | */ 64 | protected function create(array $data) 65 | { 66 | return User::create([ 67 | 'name' => $data['name'], 68 | 'email' => $data['email'], 69 | 'password' => Hash::make($data['password']), 70 | ]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | 'bindings', 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 63 | 'data.cache' => \App\DrupalStats\Middleware\CacheMiddleware::class, 64 | ]; 65 | } 66 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'encrypted' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache/data'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'cache', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => env( 90 | 'CACHE_PREFIX', 91 | str_slug(env('APP_NAME', 'laravel'), '_').'_cache' 92 | ), 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mongodb'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Database Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here are each of the database connections setup for your application. 24 | | Of course, examples of configuring each database platform that is 25 | | supported by Laravel is shown below to make development simple. 26 | | 27 | | 28 | | All database work in Laravel is done through the PHP PDO facilities 29 | | so make sure you have the driver for your particular database of 30 | | choice installed on your machine before you begin development. 31 | | 32 | */ 33 | 34 | 'connections' => [ 35 | 36 | 'sqlite' => [ 37 | 'driver' => 'sqlite', 38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 39 | 'prefix' => '', 40 | ], 41 | 42 | 'mysql' => [ 43 | 'driver' => 'mysql', 44 | 'host' => env('DB_HOST', '127.0.0.1'), 45 | 'port' => env('DB_PORT', '3306'), 46 | 'database' => env('DB_DATABASE', 'forge'), 47 | 'username' => env('DB_USERNAME', 'forge'), 48 | 'password' => env('DB_PASSWORD', ''), 49 | 'unix_socket' => env('DB_SOCKET', ''), 50 | 'charset' => 'utf8mb4', 51 | 'collation' => 'utf8mb4_unicode_ci', 52 | 'prefix' => '', 53 | 'strict' => true, 54 | 'engine' => null, 55 | ], 56 | 57 | 'pgsql' => [ 58 | 'driver' => 'pgsql', 59 | 'host' => env('DB_HOST', '127.0.0.1'), 60 | 'port' => env('DB_PORT', '5432'), 61 | 'database' => env('DB_DATABASE', 'forge'), 62 | 'username' => env('DB_USERNAME', 'forge'), 63 | 'password' => env('DB_PASSWORD', ''), 64 | 'charset' => 'utf8', 65 | 'prefix' => '', 66 | 'schema' => 'public', 67 | 'sslmode' => 'prefer', 68 | ], 69 | 70 | 'sqlsrv' => [ 71 | 'driver' => 'sqlsrv', 72 | 'host' => env('DB_HOST', 'localhost'), 73 | 'port' => env('DB_PORT', '1433'), 74 | 'database' => env('DB_DATABASE', 'forge'), 75 | 'username' => env('DB_USERNAME', 'forge'), 76 | 'password' => env('DB_PASSWORD', ''), 77 | 'charset' => 'utf8', 78 | 'prefix' => '', 79 | ], 80 | 81 | 'mongodb' => [ 82 | 'driver' => 'mongodb', 83 | 'host' => env('DB_HOST', 'localhost'), 84 | 'port' => env('DB_PORT', 27017), 85 | 'database' => env('DB_DATABASE', 'drustats'), 86 | 'username' => env('DB_USERNAME', ''), 87 | 'password' => env('DB_PASSWORD', ''), 88 | 'options' => [ 89 | 'db' => 'admin', 90 | ], 91 | ], 92 | 93 | ], 94 | 95 | /* 96 | |-------------------------------------------------------------------------- 97 | | Migration Repository Table 98 | |-------------------------------------------------------------------------- 99 | | 100 | | This table keeps track of all the migrations that have already run for 101 | | your application. Using this information, we can determine which of 102 | | the migrations on disk haven't actually been run in the database. 103 | | 104 | */ 105 | 106 | 'migrations' => 'migrations', 107 | 108 | /* 109 | |-------------------------------------------------------------------------- 110 | | Redis Databases 111 | |-------------------------------------------------------------------------- 112 | | 113 | | Redis is an open source, fast, and advanced key-value store that also 114 | | provides a richer set of commands than a typical key-value systems 115 | | such as APC or Memcached. Laravel makes it easy to dig right in. 116 | | 117 | */ 118 | 119 | 'redis' => [ 120 | 121 | 'client' => 'predis', 122 | 123 | 'default' => [ 124 | 'host' => env('REDIS_HOST', '127.0.0.1'), 125 | 'password' => env('REDIS_PASSWORD', null), 126 | 'port' => env('REDIS_PORT', 6379), 127 | 'database' => env('REDIS_DB', 0), 128 | ], 129 | 130 | 'cache' => [ 131 | 'host' => env('REDIS_HOST', '127.0.0.1'), 132 | 'password' => env('REDIS_PASSWORD', null), 133 | 'port' => env('REDIS_PORT', 6379), 134 | 'database' => env('REDIS_CACHE_DB', 1), 135 | ], 136 | 137 | ], 138 | 139 | ]; 140 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Log Channels 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the log channels for your application. Out of 26 | | the box, Laravel uses the Monolog PHP logging library. This gives 27 | | you a variety of powerful log handlers / formatters to utilize. 28 | | 29 | | Available Drivers: "single", "daily", "slack", "syslog", 30 | | "errorlog", "monolog", 31 | | "custom", "stack" 32 | | 33 | */ 34 | 35 | 'channels' => [ 36 | 'stack' => [ 37 | 'driver' => 'stack', 38 | 'channels' => ['single'], 39 | ], 40 | 41 | 'single' => [ 42 | 'driver' => 'single', 43 | 'path' => storage_path('logs/laravel.log'), 44 | 'level' => 'debug', 45 | ], 46 | 47 | 'daily' => [ 48 | 'driver' => 'daily', 49 | 'path' => storage_path('logs/laravel.log'), 50 | 'level' => 'debug', 51 | 'days' => 7, 52 | ], 53 | 54 | 'slack' => [ 55 | 'driver' => 'slack', 56 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 57 | 'username' => 'Laravel Log', 58 | 'emoji' => ':boom:', 59 | 'level' => 'critical', 60 | ], 61 | 62 | 'stderr' => [ 63 | 'driver' => 'monolog', 64 | 'handler' => StreamHandler::class, 65 | 'with' => [ 66 | 'stream' => 'php://stderr', 67 | ], 68 | ], 69 | 70 | 'syslog' => [ 71 | 'driver' => 'syslog', 72 | 'level' => 'debug', 73 | ], 74 | 75 | 'errorlog' => [ 76 | 'driver' => 'errorlog', 77 | 'level' => 'debug', 78 | ], 79 | ], 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | ]; 124 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'beanstalkd'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => env('SQS_KEY', 'your-public-key'), 54 | 'secret' => env('SQS_SECRET', 'your-secret-key'), 55 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 56 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 57 | 'region' => env('SQS_REGION', 'us-east-1'), 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | 'block_for' => null, 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Failed Queue Jobs 73 | |-------------------------------------------------------------------------- 74 | | 75 | | These options configure the behavior of failed queue job logging so you 76 | | can control which database and table are used to store the jobs that 77 | | have failed. You may change them to any database / table you wish. 78 | | 79 | */ 80 | 81 | 'failed' => [ 82 | 'database' => env('DB_CONNECTION', 'mysql'), 83 | 'table' => 'failed_jobs', 84 | ], 85 | 86 | ]; 87 | -------------------------------------------------------------------------------- /config/sentry.php: -------------------------------------------------------------------------------- 1 | env('SENTRY_LARAVEL_DSN'), 5 | 6 | // capture release as git sha 7 | // 'release' => trim(exec('git log --pretty="%h" -n1 HEAD')), 8 | 9 | // Capture bindings on SQL queries 10 | 'breadcrumbs.sql_bindings' => true, 11 | 12 | // Capture default user context 13 | 'user_context' => false, 14 | ); 15 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => env('SES_REGION', 'us-east-1'), 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker $faker) { 17 | return [ 18 | 'name' => $faker->name, 19 | 'email' => $faker->unique()->safeEmail, 20 | 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret 21 | 'remember_token' => str_random(10), 22 | ]; 23 | }); 24 | -------------------------------------------------------------------------------- /database/migrations/2016_02_10_205627_mongodb-indexes.php: -------------------------------------------------------------------------------- 1 | index('type'); 18 | $collection->index('title'); 19 | $collection->index('changed'); 20 | $collection->index('comment_count'); 21 | $collection->index('author.id'); 22 | 23 | // Project release fields. 24 | $collection->index('field_download_count'); 25 | $collection->index('field_release_project.id'); 26 | 27 | // Project (module, themes, etc...) fields. 28 | $collection->index('field_project_type'); 29 | $collection->index('field_supporting_organizations.id'); 30 | 31 | // Term fields. 32 | $collection->index('taxonomy_vocabulary_3.id'); 33 | $collection->index('taxonomy_vocabulary_6.id'); 34 | $collection->index('taxonomy_vocabulary_7.id'); 35 | $collection->index('taxonomy_vocabulary_44.id'); 36 | $collection->index('taxonomy_vocabulary_46.id'); 37 | $collection->index('taxonomy_vocabulary_52.id'); 38 | }); 39 | 40 | Schema::table('users', function ($collection) { 41 | $collection->index('field_areas_of_expertise.id'); 42 | $collection->index('field_country'); 43 | $collection->index('field_gender'); 44 | $collection->index('field_languages'); 45 | $collection->index('field_organizations.id'); 46 | }); 47 | 48 | Schema::table('field_collection_organizations', function ($collection) { 49 | $collection->index('host_entity.id'); 50 | $collection->index('field_organization_name'); 51 | }); 52 | 53 | Schema::table('field_collection_releases', function ($collection) { 54 | $collection->index('host_entity.id'); 55 | $collection->index('field_release_file_downloads'); 56 | }); 57 | } 58 | 59 | /** 60 | * Reverse the migrations. 61 | * 62 | * @return void 63 | */ 64 | public function down() 65 | { 66 | // 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.18", 14 | "bootstrap-sass": "^3.3.7", 15 | "cross-env": "^5.1", 16 | "jquery": "^3.2", 17 | "laravel-mix": "^2.1.14", 18 | "lodash": "^4.17.11", 19 | "popper.js": "^1.14.4", 20 | "vue": "^2.5.17" 21 | }, 22 | "dependencies": { 23 | "d3": "^3.5.14", 24 | "d3-cloud": "^1.2.5", 25 | "nvd3": "^1.8.6" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /public/images/01-module-downloads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/01-module-downloads.png -------------------------------------------------------------------------------- /public/images/02-project-downloads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/02-project-downloads.png -------------------------------------------------------------------------------- /public/images/03-projects-growth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/03-projects-growth.png -------------------------------------------------------------------------------- /public/images/04-issues-breakdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/04-issues-breakdown.png -------------------------------------------------------------------------------- /public/images/05-user-countries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/05-user-countries.png -------------------------------------------------------------------------------- /public/images/06-user-languages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/06-user-languages.png -------------------------------------------------------------------------------- /public/images/07-user-expertise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/07-user-expertise.png -------------------------------------------------------------------------------- /public/images/08-tests-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/08-tests-status.png -------------------------------------------------------------------------------- /public/images/09-tests-reasons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussainweb/drupal-stats/f9e211dbf56ae172a572dedda10271cfa88f9201/public/images/09-tests-reasons.png -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css", 4 | "/js/d3-cloud.js": "/js/d3-cloud.js", 5 | "/geojson/countries.geo.json": "/geojson/countries.geo.json" 6 | } 7 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/svg/404.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/svg/503.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # DruStats 2 | 3 | [![Software License](https://img.shields.io/badge/license-GPLv2-brightgreen.svg?style=flat-square)](LICENSE.md) 4 | 5 | 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. 6 | 7 | ## Usage 8 | 9 | See installation section for detailed instructions on installing this application. 10 | 11 | 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. 12 | 13 | These are the commands provided by this application to queue requests. 14 | 15 | ~~~sh 16 | php artisan dsget:nodes {type} 17 | php artisan dsget:cijobs 18 | php artisan dsget:users 19 | php artisan dsget:terms 20 | php artisan dsupdate:nodes {type} 21 | php artisan dsupdate:cijobs 22 | ~~~ 23 | 24 | All the `dsget` commands have the following options. 25 | 26 | ~~~sh 27 | --page={page} --sort={field} --direction={ASC|DESC} 28 | ~~~ 29 | 30 | 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. 31 | 32 | ### Schedule updates 33 | 34 | 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. 35 | 36 | ~~~ 37 | * * * * * php /path/to/artisan schedule:run 38 | ~~~ 39 | 40 | See [Laravel's documentation](https://laravel.com/docs/5.2/scheduling#introduction) for more details. 41 | 42 | ## Requirements 43 | 44 | The application needs the following software to run. 45 | 46 | * PHP 5.5.9 (tested only on PHP 7) 47 | * MongoDB 3.2 48 | * PHP MongoDB extension 49 | * Beanstalkd (the application would work without this but would not be able to update the database) 50 | * Any web server that can work with PHP 51 | 52 | To use the application, the following software is needed. 53 | 54 | * Any modern browser (IE9+, Chrome, Firefox) 55 | * Javascript to view the visualizations 56 | 57 | ### Development Requirements 58 | 59 | To develop with this application, the following software is needed in addition to the above requirements. 60 | 61 | * Composer 62 | * Node.js (with npm) 63 | * Gulp 64 | 65 | ## Installation 66 | 67 | These are the software components and libraries required to use DruStats. 68 | 69 | * Apache, nginx, or any webserver compatible with PHP-FPM or PHP modules 70 | * [PHP 5.5.9](http://php.net/downloads.php) (PHP 7 recommended) 71 | * [MongoDB 3.2](https://docs.mongodb.org/manual/installation/) 72 | * [PHP MongoDB](http://php.net/manual/en/mongodb.setup.php) extension 73 | * [Beanstalk](http://kr.github.io/beanstalkd/download.html) 74 | * [Composer](https://getcomposer.org/) (installed globally) 75 | 76 | Clone [this repository](https://github.com/hussainweb/drupal-stats) and run the following command in the directory. 77 | 78 | ~~~sh 79 | $ git clone https://github.com/hussainweb/drupal-stats.git 80 | $ cd drupal-stats/ 81 | $ composer install 82 | ~~~ 83 | 84 | 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. 85 | 86 | ~~~sh 87 | $ php artisan migrate 88 | ~~~ 89 | 90 | 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. 91 | 92 | ## License 93 | 94 | This application is open-sourced software licensed under the [GPLv2 license](http://opensource.org/licenses/GPL-2.0). 95 | 96 | ### Third Party Components 97 | 98 | 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. 99 | 100 | * Laravel - [MIT License](http://opensource.org/licenses/MIT) 101 | * MongoDB - [GNU AGPL v3.0](http://www.fsf.org/licensing/licenses/agpl-3.0.html) 102 | * PHP MongoDB extension - [Apache License](http://www.apache.org/licenses/LICENSE-2.0) 103 | * Beanstalk - [MIT](https://github.com/kr/beanstalkd/blob/master/LICENSE) 104 | * Drupal API Client - [GPL v2](https://github.com/hussainweb/drupal-api-client/blob/master/LICENSE.md) 105 | * Laravel MongoDB model - [MIT](https://github.com/jenssegers/laravel-mongodb/blob/master/composer.json) 106 | * Pheanstalk - [MIT](https://github.com/pda/pheanstalk/blob/master/LICENSE) 107 | * Artisan Beans - [MIT](https://github.com/pmatseykanets/artisan-beans/blob/master/LICENSE.txt) 108 | * PHP Markdown Lib - [BSD-3-Clause](https://github.com/michelf/php-markdown/blob/lib/License.md) 109 | * Bootstrap - [MIT](https://github.com/twbs/bootstrap/blob/master/LICENSE) 110 | * d3.js - [BSD License](https://github.com/mbostock/d3/blob/master/LICENSE) 111 | * d3-legend - [Permissive License](https://github.com/susielu/d3-legend/blob/master/LICENSE) 112 | * d3-cloud - [BSD](https://github.com/jasondavies/d3-cloud/blob/master/LICENSE) 113 | * Johan World GeoJSON - [UNLICENSE](https://github.com/johan/world.geo.json/blob/master/UNLICENSE) 114 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * First we will load all of this project's JavaScript dependencies which 4 | * includes Vue and other libraries. It is a great starting point when 5 | * building robust, powerful web applications using Vue and Laravel. 6 | */ 7 | 8 | require('./bootstrap'); 9 | 10 | window.Vue = require('vue'); 11 | 12 | /** 13 | * Next, we will create a fresh Vue application instance and attach it to 14 | * the page. Then, you may begin adding components to this application 15 | * or customize the JavaScript scaffolding to fit your unique needs. 16 | */ 17 | 18 | Vue.component('example-component', require('./components/ExampleComponent.vue')); 19 | 20 | const app = new Vue({ 21 | el: '#app' 22 | }); 23 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | 2 | window._ = require('lodash'); 3 | window.Popper = require('popper.js').default; 4 | 5 | /** 6 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 7 | * for JavaScript based Bootstrap features such as modals and tabs. This 8 | * code may be modified to fit the specific needs of your application. 9 | */ 10 | 11 | try { 12 | window.$ = window.jQuery = require('jquery'); 13 | 14 | require('bootstrap-sass'); 15 | } catch (e) {} 16 | 17 | /** 18 | * We'll load the axios HTTP library which allows us to easily issue requests 19 | * to our Laravel back-end. This library automatically handles sending the 20 | * CSRF token as a header based on the value of the "XSRF" token cookie. 21 | */ 22 | 23 | window.axios = require('axios'); 24 | 25 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 26 | 27 | /** 28 | * Next we will register the CSRF Token as a common header with Axios so that 29 | * all outgoing HTTP requests automatically have it attached. This is just 30 | * a simple convenience so we don't have to attach every token manually. 31 | */ 32 | 33 | let token = document.head.querySelector('meta[name="csrf-token"]'); 34 | 35 | if (token) { 36 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 37 | } else { 38 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 39 | } 40 | 41 | /** 42 | * Echo exposes an expressive API for subscribing to channels and listening 43 | * for events that are broadcast by Laravel. Echo and event broadcasting 44 | * allows your team to easily build robust real-time web applications. 45 | */ 46 | 47 | // import Echo from 'laravel-echo' 48 | 49 | // window.Pusher = require('pusher-js'); 50 | 51 | // window.Echo = new Echo({ 52 | // broadcaster: 'pusher', 53 | // key: process.env.MIX_PUSHER_APP_KEY, 54 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 55 | // encrypted: true 56 | // }); 57 | -------------------------------------------------------------------------------- /resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /resources/js/d3-cloud.js: -------------------------------------------------------------------------------- 1 | d3.layout.cloud = require('d3-cloud'); 2 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | 2 | // Body 3 | $body-bg: #f5f8fa; 4 | 5 | // Borders 6 | $laravel-border-color: darken($body-bg, 10%); 7 | $list-group-border: $laravel-border-color; 8 | $navbar-default-border: $laravel-border-color; 9 | $panel-default-border: $laravel-border-color; 10 | $panel-inner-border: $laravel-border-color; 11 | 12 | // Brands 13 | $brand-primary: #3097D1; 14 | $brand-info: #8eb4cb; 15 | $brand-success: #2ab27b; 16 | $brand-warning: #cbb956; 17 | $brand-danger: #bf5329; 18 | 19 | // Typography 20 | $font-family-sans-serif: "Raleway", sans-serif; 21 | $font-size-base: 14px; 22 | $line-height-base: 1.6; 23 | $text-color: #636b6f; 24 | 25 | // Navbar 26 | $navbar-default-bg: #fff; 27 | 28 | // Buttons 29 | $btn-default-color: $text-color; 30 | 31 | // Inputs 32 | $input-border: lighten($text-color, 40%); 33 | $input-border-focus: lighten($brand-primary, 25%); 34 | $input-color-placeholder: lighten($text-color, 30%); 35 | 36 | // Panels 37 | $panel-default-heading-bg: #fff; 38 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | $drupal-color: #0678be; 2 | 3 | // Fonts 4 | @import url(https://fonts.googleapis.com/css?family=Lato:400,100); 5 | @import url(https://fonts.googleapis.com/css?family=Maven+Pro:400,700); 6 | @import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600); 7 | 8 | // Variables 9 | @import "variables"; 10 | 11 | $navbar-inverse-bg: $drupal-color; 12 | $navbar-inverse-brand-color: white; 13 | $navbar-inverse-link-color: white; 14 | $navbar-inverse-color: white; 15 | 16 | @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 17 | 18 | html { 19 | position: relative; 20 | min-height: 100%; 21 | } 22 | 23 | body { 24 | /* Margin bottom by footer height */ 25 | margin-bottom: 90px; 26 | } 27 | 28 | h1, h2, h3, h4, h5, h6, .title { 29 | font-family: 'Maven Pro', sans-serif; 30 | font-weight: 700; 31 | } 32 | 33 | .footer { 34 | position: absolute; 35 | margin-bottom: 0; 36 | bottom: 0; 37 | width: 100%; 38 | /* Set the fixed height of the footer here */ 39 | min-height: 90px; 40 | 41 | .navbar-text a { 42 | color: white; 43 | } 44 | } 45 | 46 | .navbar-brand { 47 | font-family: 'Maven Pro', sans-serif; 48 | font-weight: 400; 49 | } 50 | 51 | .title { 52 | font-weight: 100; 53 | font-family: 'Lato'; 54 | font-size: 96px; 55 | } 56 | 57 | .row { 58 | margin-bottom: 20px; 59 | } 60 | -------------------------------------------------------------------------------- /resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/views/issues/project-issue-count.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('styles') 4 | 10 | @endpush 11 | 12 | @push('scripts') 13 | 14 | 15 | 98 | @endpush 99 | 100 | @section('svgcontent') 101 |
102 |
103 | 104 | 105 |
106 |
107 |
108 |

Project Issue Count Bubble Chart

109 |

This chart shows the top 200 projects according to their issue counts (modules, themes, etc) from drupal.org. The color indicates the type of the project and the size of the bubble indicates the number of issues.

110 |
111 | @endsection 112 | -------------------------------------------------------------------------------- /resources/views/layouts/svg.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @push('scripts') 4 | @endpush 5 | 6 | @section('content') 7 |
8 | 11 | 12 | @yield('presvgcontent') 13 | 14 |
15 |
16 | 17 | @yield('svgcontent') 18 |
19 | @endsection 20 | -------------------------------------------------------------------------------- /resources/views/projects/module-downloads.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('styles') 4 | 10 | @endpush 11 | 12 | @push('scripts') 13 | 14 | 15 | 96 | @endpush 97 | 98 | @section('svgcontent') 99 |
100 |
101 | 102 | 103 |
104 |
105 |
106 |

Module Downloads Bubble Chart

107 |

This chart shows the top 200 downloaded modules from drupal.org. The color indicates the category and the size of the bubble indicates the number of downloads.

108 |
109 | @endsection 110 | -------------------------------------------------------------------------------- /resources/views/projects/project-downloads.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('styles') 4 | 10 | @endpush 11 | 12 | @push('scripts') 13 | 14 | 15 | 96 | @endpush 97 | 98 | @section('svgcontent') 99 |
100 |
101 | 102 | 103 |
104 |
105 |
106 |

Project Downloads Bubble Chart

107 |

This chart shows the top 200 downloaded projects (modules, themes, etc) from drupal.org. The color indicates the type of the project and the size of the bubble indicates the number of downloads.

108 |
109 | @endsection 110 | -------------------------------------------------------------------------------- /resources/views/projects/projects-growth.blade.php: -------------------------------------------------------------------------------- 1 | @extends('charts.growth-chart') 2 | 3 | @section('svgcontent') 4 |
5 |

Projects Growth

6 |

This chart shows the growth in projects (modules, themes, etc...) on drupal.org since the beginning. Number of projects of types like theme engines and core is too small to be seen when compared to a large number of regular themes and modules. To see them better, disable 'Modules' and/or 'Themes' using the checkboxes above.

7 |

This chart is accurate for all the nodes that are present on the system at the time of first complete crawl. This means that the chart does not show projects that were created and subsequently deleted as the API would not return any information about it. This is not significant as the projects are probably never deleted unless it is spam or other exceptional circumstances.

8 |
9 | @endsection 10 | -------------------------------------------------------------------------------- /resources/views/simple-content.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('content') 4 |
5 | 8 | 9 |
10 | {!! $page_content !!} 11 |
12 |
13 | @endsection 14 | -------------------------------------------------------------------------------- /resources/views/users/user-countries.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('styles') 4 | 48 | @endpush 49 | 50 | @push('scripts') 51 | 52 | 53 | 54 | 159 | @endpush 160 | 161 | @section('svgcontent') 162 |
163 |

Drupalers around the world

164 |

These are all the Drupalers around the world. Darker shade of blue indicates more Drupalers in that country. This information is taken and aggregated from all user profiles on d.o.

165 |
166 | @endsection 167 | -------------------------------------------------------------------------------- /resources/views/users/user-country-growth.blade.php: -------------------------------------------------------------------------------- 1 | @extends('charts.growth-chart') 2 | 3 | @section('svgcontent') 4 |
5 |

Users Growth by Country

6 |

This chart shows the growth in users on drupal.org since the beginning. There seems to be no data before 2001 where it immediately starts with 2000+ users. The rest of the chart should be fairly accurate.

7 |

This chart is accurate for all the users that are present and not blocked on the system at the time of first complete crawl. This means that the chart does not show users that were created and subsequently deleted/blocked as the API would not return any information about it. This could be a significant number which can be guessed by user id.

8 |
9 | @endsection 10 | -------------------------------------------------------------------------------- /resources/views/users/user-expertise.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('scripts') 4 | 5 | 6 | 65 | @endpush 66 | 67 | @section('svgcontent') 68 |
69 |

Areas of Expertise

70 |

This word cloud shows various areas of expertise of registered Drupal users all over the world. This information is taken and aggregated from all user profiles on d.o.

71 |

The size of the word is proportional (on a logarithmic scale) to number of users who have marked it as their expertise. Hover over the word to see the count of users with that expertise. Since this is a browser based visualization, you may use the browser's find feature to find your favourite expertise.

72 |
73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/users/user-gender-growth.blade.php: -------------------------------------------------------------------------------- 1 | @extends('charts.growth-chart') 2 | 3 | @section('svgcontent') 4 |
5 |

Users Growth by Gender

6 |

This chart shows the growth in users on drupal.org since the beginning. There seems to be no data before 2001 where it immediately starts with 2000+ users. The rest of the chart should be fairly accurate.

7 |

This chart is accurate for all the users that are present and not blocked on the system at the time of first complete crawl. This means that the chart does not show users that were created and subsequently deleted/blocked as the API would not return any information about it. This could be a significant number which can be guessed by user id.

8 |
9 | @endsection 10 | -------------------------------------------------------------------------------- /resources/views/users/user-growth.blade.php: -------------------------------------------------------------------------------- 1 | @extends('charts.growth-chart') 2 | 3 | @section('svgcontent') 4 |
5 |

Users Growth

6 |

This chart shows the growth in users on drupal.org since the beginning. There seems to be no data before 2001 where it immediately starts with 2000+ users. The rest of the chart should be fairly accurate.

7 |

This chart is accurate for all the users that are present and not blocked on the system at the time of first complete crawl. This means that the chart does not show users that were created and subsequently deleted/blocked as the API would not return any information about it. This could be a significant number which can be guessed by user id.

8 |
9 | @endsection 10 | -------------------------------------------------------------------------------- /resources/views/users/user-languages.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.svg') 2 | 3 | @push('scripts') 4 | 5 | 6 | 68 | @endpush 69 | 70 | @section('svgcontent') 71 |
72 |

Spoken Languages

73 |

This word cloud shows various languages spoken by the registered Drupal users all over the world. This information is taken and aggregated from all user profiles on d.o.

74 |

The size of the word is proportional (on a logarithmic scale) to number of users who have marked that they speak the language. Hover over the word to see the count of users speaking that language. Since this is a browser based visualization, you may use the browser's find feature to find your favourite languages.

75 |
76 | @endsection 77 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('content') 4 |
5 |
Drupal Statistics Collector
6 |
7 |
8 |
9 | 10 | Module Downloads Bubble 11 | 12 |

Module Downloads Bubble

13 |

The top 200 modules from drupal.org arranged by downloads and category.

14 | View 15 |
16 |
17 | 18 | Project Downloads Bubble 19 | 20 |

Project Downloads Bubble

21 |

The top 200 projects from drupal.org arranged by downloads and project type.

22 | View 23 |
24 |
25 | 26 | Project Growth 27 | 28 |

Project Growth

29 |

The growth of each project type over the years.

30 | View 31 |
32 |
33 |
34 |
35 | 36 | Issues Breakdown 37 | 38 |

Issues Breakdown

39 |

Breakdown of issues for all projects or for a specific project.

40 | View 41 |
42 |
43 | 44 | User Countries 45 | 46 |

User Countries

47 |

User registrations on drupal.org per each country in the world.

48 | View 49 |
50 |
51 | 52 | User Languages 53 | 54 |

User Languages

55 |

Languages spoken by drupal.org users

56 | View 57 |
58 |
59 |
60 |
61 | 62 | User Expertise 63 | 64 |

User Expertise

65 |

Areas of expertise of drupal.org users

66 | View 67 |
68 |
69 | 70 | CI Jobs Status 71 | 72 |

CI Jobs Status

73 |

Status of CI jobs running on each branch

74 | View 75 |
76 |
77 | 78 | CI Jobs Reasons 79 | 80 |

CI Jobs Reasons

81 |

Reasons for each CI job run

82 | View 83 |
84 |
85 | @endsection 86 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | 20 | Route::get('/project/{name}', '\App\DrupalStats\Controllers\Api\ProjectController@projectInfo'); 21 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .js('resources/js/d3-cloud.js', 'public/js') 16 | .sass('resources/sass/app.scss', 'public/css') 17 | .copy('vendor/johan/worldjson/countries.geo.json', 'public/geojson/countries.geo.json'); 18 | --------------------------------------------------------------------------------