Git Product home page Git Product logo

civicrm-pingback's Introduction

civicrm-pingback

This repository contains the files used for the https://latest.civicrm.org website. This is used by CiviCRM core to check if any updates are needed.

As part of this update check (ie. pingback), a number of anonymous information is collected on the CiviCRM instance (see https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/VersionCheck.php). This information is stored in the stats database, and used notably for the CiviCRM statistics (see https://stats.civicrm.org).

Requirements:

CLI: View/edit all releases

./bin/pb edit

CLI: List releases

./bin/pb release:list

CLI: Add a new release

### Add a new security release
./bin/pb release:add 4.7.99 --date=2017-01-01 --security=true

## Add a new non-security release
./bin/pb release:add 4.7.99 --date=2017-01-01 --security=false

## Add a new release. (Default: Non-security, today's date)
./bin/pb release:add 4.7.99

End-point: stable.php

The stable.php is the primary end-point for pingbacks and version-checks.

Different versions of CiviCRM expect the response to be in different formats. The format parameter allows the requester to indicate the response:

  • No format (deprecated): Returns a textual string with the current stable release. (This was used up until early/mid 4.x's.)
  • format=json (deprecated): Returns a JSON document with a list of versions and their release-dates (This was introduced in mid 4.x.')
  • format=summary: Returns a JSON document with a list of messages summarizing the upgrade situation. (This was introduced in 5.x.)

All variants accept additional parameters with technical details and statistics about the requester's deployment. For example:

  • version: CiviCRM version
  • lang: Preferred lanugage
  • uf: CMS type (WordPress, Drupal8, etc)
  • PHP: PHP version
  • MySQL: MySQL version
  • (*See CRM_Utils_VersionCheck for more complete listing *)

Development: Testing

Tests are implemented in PHPUnit. To run all tests, simply call phpunit without any arguments:

phpunit4

Development: Working with the summary report

The summary report produces a list of messages advising admins about available upgrades. A typical request might be for http://localhost/stable.php?hash=abcd1234&format=summary&version=5.0.alpha1&... and it returns a JSON document for one site. Ex:

{
   "patch" : {
      "name" : "patch",
      "severity" : "warning",
      "title" : "CiviCRM Patch Available",
      "message" : "<p>The site is running 5.0.alpha1. Additional patches are available:</p><ul>\n<li>5.0.0 (2018-04-04)</li></ul>"
   }
}

However, during development, you're not just concerned with one version (5.0.alpha1) -- you want to check how the advice is displayed for many versions (4.7.31,4.7.29,4.6.36,5.0.0,...). To preview all these, use a web browser to navigate to http://localhost/stable.php?format=devPreview. This page is handy for quickly iterating on messages.

There is also PHPUnit test coverage for the summary report in SummaryReportTest and DevPreviewReportTest.

One of the tests, DevPreviewReportTest::testExampleFile(), has a special workflow. Its purpose is to monitor changes in the HTML output across a series of example version-numbers. To do this, we store copies of the devPreview generated from hypothetical data-sets (ex1.json, ex2-dates.json, etc) and see if the HTML changes.

After making any changes to the HTML messages/markup in SummaryReport or DevPreviewReport, you can run phpunit4. It will highlight the HTML changes. If the changes look good, then update the example file, e.g.

curl 'http://localhost/stable.php?format=devPreview&versionsFile=ex1.json&versions=5.0.0,5.0.beta1,4.7.31,4.7.29,4.6.36,4.6.32,4.5.10' > tests/Report/DevPreview-ex1-a.html

civicrm-pingback's People

Contributors

agh1 avatar colemanw avatar michaelmcandrew avatar mlutfy avatar nganivet avatar totten avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.