Commit 3a3049d2 authored by dmorley's avatar dmorley

Merge branch 'develop'

parents 365a3644 8f8aeb32
# Changelog
The format is based on [Keep a Changelog] and this project adheres to [Semantic Versioning].
## [2.4.0] - 2018-09-03
:exclamation: DB migrations required! (see [SQL migration script][2.4.0-sql-migration])
:exclimation: config.php rewritten - requires migration
### Added
- Added bootstrapping to simplify initialisation of config and database
- Config syntax has changed to array style (#155)
- Added `pghost` config to set database port
- Added `CONTRIBUTING.md`
- Podmin can choose at what fail score to send the notice out
- Podmin email shares details on why pod is failing
- Only retrieve location data for remote servers / IPs
- Fontawesome for icons
### Changed
- Introduce proper changelog format (#189)
- Moved DB migration scripts into `db` folder
- Use Curl for all http calls
- Use filter dropdowns for pre-defined columns
- Use pretty URLs (see nginx.example)
- Open pod URLs in a new tab
- Use detectlanguage.com API for language guess
- Only use JSON data, ignore HTML when returned
- Allow curl redirect on home page check
- Score now goes to -5000 before a pod is removed so dead pods get checked a while then removed for good
- Move functions to dedicated file to allow reuse
- Backup script rewrite
- Store services as json array
- Paging can be changed to some or all on advanced view
### Deprecated
### Removed
### Fixed
- Notify podmins just once at 50 when pod failing (#186)
- Add missing meta and PHP module requirements to `composer.json`
### Security
## [2.3.1] - 2018-08-05
### Added
- Podmins can link directly to their pod via `https://podupti.me/domain.name` for stats and to allow users to rate easier
- Wizard to help you filter the columns to what you need (#145)
- Cookie used to remember last pod you clicked
### Changed
- Now one table with a basic default view you can customize (#171)
- Switch to a library for country to lat long lookup
- Switch GeoIP from built in PHP to library and use newer Maxmind database file
## [2.3.0] - 2018-07-19
:exclamation: DB migrations required! (see [SQL migration script][2.2.0-sql-migration])
### Added
- Language is detected based on your homepage, edit your homepage to non-en if that is what you use
- Add development and release dates to `masterversions` table (#143)
- Store full country name, store days monitored each pod (#150)
- Store detectedlanguage (#144)
- Show version and update in full view cleaner (#143)
- Filter and search on the columns of data (#147)
- Paginate the results so they fit per page (#147)
### Changed
- Podmins can no longer access `db/pull.php` to test their pod, they can however get to a debug screen from the edit pod area
- Edit will send to email on file and be less delay, runner of site does not really have any way to verify email address
- Default new pods to `UP` to be checked
- Use the git API for release versions, check development releases on pods (#143)
- Move from [bower to yarn](https://bower.io/blog/2017/how-to-migrate-away-from-bower/) for packages
- Move to PHP 7.2 with strict typing
- Move to [Eslint compliance](https://eslint.org/docs/rules/)
- Move to [PSR-2 compliance](https://www.php-fig.org/psr/psr-2/)
- NOTE `config.php.example` change to full paths for 2 items!
- Show time as human readable everywhere (#150)
### Removed
- Unused `hidden` and `secure` columns (#140, #141)
### Fixed
- Rename table `rating_comments` to `ratingcomments` for redbean support (#146)
### Security
- Forbid access to files that should be CLI only (#152)
## [2.2.0] - 2018-05-12
:exclamation: DB migrations required! (see [SQL migration script][2.2.0-sql-migration])
### Added
- Podmins can now pause/unpause or delete from podmin area
- Graph on user growth on the network
- Add monthly stats table
### Changed
- `go.php` auto select picks a more stable pod than before
- Make map prettier
- Use lines on tables to make them more readable
- Don't delete dead pods, keep them and data for history hide them for users
- Put daily tasks in the `pull.sh` and run each day
- Update status to 1-5 rather than text
### Fixed
- Fix ipv6
[2.4.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.3.0-2.4.0.sql
[2.3.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.2.0-2.3.0.sql
[2.2.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.1.4-2.2.0.sql
[Unreleased]: https://git.feneas.org/diasporg/Poduptime/compare/master...develop
[2.3.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.3.0...2.3.1
[2.3.0]: https://git.feneas.org/diasporg/Poduptime/compare/v2.2.0...2.3.0
[2.2.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.1.3...v2.2.0
[Keep a Changelog]: https://keepachangelog.com/
[Semantic Versioning]: https://semver.org/
# How To Contribute
## Workflow
* Fork Git Repo https://git.feneas.org/diasporg/Poduptime
* Pull Git
* Create a topic branch to work from
* Commit and push your branch up
* Create a Merge Request to the develop branch
## Guidelines
* Note your changes in [`CHANGELOG.md`] following https://keepachangelog.com
* Create any necessary DB migration script in [`db/migrations`] and note them in the changelog.
* Update [`README.md`] with needed changes
* Update the [Wiki] with API changes
* Write your tests and validate them before you do your MR
## Coding Style
* PHP follows [PSR-2]
* CSS follows [CSSLint]
* JS follows [ESLint]
[`README.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/README.md
[`CHANGELOG.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/CHANGELOG.md
[`db/migrations`]: https://git.feneas.org/diasporg/Poduptime/tree/master/db/migrations
[Wiki]: https://git.feneas.org/diasporg/Poduptime/wikis/home
[PSR-2]: https://www.php-fig.org/psr/psr-2/
[CSSLint]: https://github.com/CSSLint/csslint
[ESLint]: https://eslint.org/docs/rules/
......@@ -8,9 +8,8 @@ Environmental items you need (debian based system assumed):
OS Dependencies:
```
php7.2 php7.2-curl php7.2-pgsql php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
```
GeoIP needs setup normally with a dat file
Yarn is a separate install: https://yarnpkg.com
......@@ -54,13 +53,14 @@ run `db/pull.sh debug` to debug output
run `db/pull.sh sqldebug` to debug sql
run `db/pull.sh develop` to run without email alerts to end users
run `db/pull.sh Check_System_Deleted` to re-check system deleted pods as needed
These commands can be combined
# To Upgrade:
```
git pull
yarn install
composer install
psql -U podupuser podupdb < db/migrationXXX.sql (see db/version.md for proper migration versions)
psql -U podupuser podupdb < db/migrations/xxx.sql (see db/migrations/README.md for proper migration versions)
```
# Status
......
......@@ -15,15 +15,7 @@ $_format = $_GET['format'] ?? '';
$_method = $_GET['method'] ?? '';
$_callback = $_GET['callback'] ?? '';
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/config.php';
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
require_once __DIR__ . '/boot.php';
if ($_format === 'georss') {
echo <<<EOF
......
<?php
/**
* Boot the application, loading config and database connection.
*/
declare(strict_types=1);
use DetectLanguage\DetectLanguage;
use RedBeanPHP\R;
define('PODUPTIME', microtime(true));
require_once __DIR__ . '/vendor/autoload.php';
// Initialise language detection.
DetectLanguage::setApiKey(c('dlkey'));
DetectLanguage::setSecure(true);
// Set up global DB connection.
R::setup(
sprintf(
'pgsql:host=%s;port=%d;dbname=%s',
c('pghost'),
c('pgport', 5432),
c('pgdb')
),
c('pguser'),
c('pgpass'),
true
);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
{
"name": "diasporg/poduptime",
"description": "Poduptime is software to get live stats and data on listed Diaspora Pods.",
"license": "AGPL-3.0-or-later",
"config": {
"platform": {
"php": "7.2"
......@@ -6,22 +9,29 @@
},
"require": {
"php": "^7.2",
"gabordemooij/redbean": "^5.0",
"nesbot/carbon": "^1.31",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-bcmath": "*",
"gabordemooij/redbean": "^5.1",
"nesbot/carbon": "^1.33",
"commerceguys/enum": "^1.0",
"noplanman/xec": "0.1.0",
"jaybizzle/crawler-detect": "1.*",
"patrickschur/language-detection": "^3.3",
"jaybizzle/crawler-detect": "^1.2",
"geoip2/geoip2": "^2.9",
"maxmind-db/reader": "~1.0",
"maxmind-db/reader": "^1.3",
"matriphe/iso-639": "^1.2",
"rinvex/country": "^3.1"
"rinvex/country": "^3.1",
"detectlanguage/detectlanguage": "^2.2",
"longman/ip-tools": "^1.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3"
},
"autoload": {
"classmap": ["lib"]
"classmap": ["lib"],
"files": ["lib/functions.php"]
},
"scripts": {
"check-code": [
......
......@@ -4,7 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "b4dea96de8556414616e04d0f09aa8fa",
"content-hash": "fda17d0424e9e1c45facb411a5473f27",
"packages": [
{
"name": "commerceguys/enum",
......@@ -46,16 +47,16 @@
},
{
"name": "composer/ca-bundle",
"version": "1.1.1",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169"
"reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169",
"reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
"reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
"shasum": ""
},
"require": {
......@@ -98,7 +99,54 @@
"ssl",
"tls"
],
"time": "2018-03-29T19:57:20+00:00"
"time": "2018-08-08T08:57:40+00:00"
},
{
"name": "detectlanguage/detectlanguage",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/detectlanguage/detectlanguage-php.git",
"reference": "a410dc1cfb31a9e332bd779c1cb27b1af2ab9b18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/detectlanguage/detectlanguage-php/zipball/a410dc1cfb31a9e332bd779c1cb27b1af2ab9b18",
"reference": "a410dc1cfb31a9e332bd779c1cb27b1af2ab9b18",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"autoload": {
"psr-0": {
"DetectLanguage": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurynas Butkus"
}
],
"description": "Language Detection API PHP Client",
"homepage": "https://github.com/detectlanguage/detectlanguage-php",
"keywords": [
"api",
"client",
"detect",
"detection",
"language"
],
"time": "2018-03-28T20:56:36+00:00"
},
{
"name": "gabordemooij/redbean",
......@@ -195,16 +243,16 @@
},
{
"name": "jaybizzle/crawler-detect",
"version": "v1.2.65",
"version": "v1.2.66",
"source": {
"type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "1ea1c897018c93e3c2ac76e008519085b24e339e"
"reference": "55ad4b140d821c19dbaf1a6ea9d9e5ca6444ecc1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/1ea1c897018c93e3c2ac76e008519085b24e339e",
"reference": "1ea1c897018c93e3c2ac76e008519085b24e339e",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/55ad4b140d821c19dbaf1a6ea9d9e5ca6444ecc1",
"reference": "55ad4b140d821c19dbaf1a6ea9d9e5ca6444ecc1",
"shasum": ""
},
"require": {
......@@ -240,7 +288,63 @@
"crawlerdetect",
"php crawler detect"
],
"time": "2018-07-24T17:53:06+00:00"
"time": "2018-07-30T20:23:10+00:00"
},
{
"name": "longman/ip-tools",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/akalongman/php-ip-tools.git",
"reference": "6c050dfbf91811d14b9b3aa31fb7116eac0f0a18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/akalongman/php-ip-tools/zipball/6c050dfbf91811d14b9b3aa31fb7116eac0f0a18",
"reference": "6c050dfbf91811d14b9b3aa31fb7116eac0f0a18",
"shasum": ""
},
"require": {
"ext-bcmath": "*",
"php": ">=5.5"
},
"require-dev": {
"phpspec/phpspec": "~2.1",
"phpunit/phpunit": "~4.1",
"squizlabs/php_codesniffer": "~2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Longman\\IPTools\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Avtandil Kikabidze aka LONGMAN",
"email": "akalongman@gmail.com",
"homepage": "https://longman.me",
"role": "Developer"
}
],
"description": "PHP IP Tools for manipulation with IPv4 and IPv6",
"homepage": "https://github.com/akalongman/php-ip-tools",
"keywords": [
"IP",
"Match",
"compare",
"ipv4",
"ipv6",
"mask",
"subnet",
"tools",
"utilities"
],
"time": "2016-10-23T20:08:46+00:00"
},
{
"name": "matriphe/iso-639",
......@@ -390,16 +494,16 @@
},
{
"name": "nesbot/carbon",
"version": "1.32.0",
"version": "1.33.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343"
"reference": "55667c1007a99e82030874b1bb14d24d07108413"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/64563e2b9f69e4db1b82a60e81efa327a30ff343",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413",
"reference": "55667c1007a99e82030874b1bb14d24d07108413",
"shasum": ""
},
"require": {
......@@ -441,7 +545,7 @@
"datetime",
"time"
],
"time": "2018-07-05T06:59:26+00:00"
"time": "2018-08-07T08:39:47+00:00"
},
{
"name": "noplanman/xec",
......@@ -496,30 +600,37 @@
"time": "2017-03-12T19:16:23+00:00"
},
{
"name": "patrickschur/language-detection",
"version": "v3.3.0",
"name": "rinvex/country",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/patrickschur/language-detection.git",
"reference": "21a2e7a1b9bf6bff578ac11c6dcf3d3668aeccdf"
"url": "https://github.com/rinvex/country.git",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/patrickschur/language-detection/zipball/21a2e7a1b9bf6bff578ac11c6dcf3d3668aeccdf",
"reference": "21a2e7a1b9bf6bff578ac11c6dcf3d3668aeccdf",
"url": "https://api.github.com/repos/rinvex/country/zipball/e32228ef43f26d3b02296be9454f842c52d492f3",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7"
"php": "^7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6"
"phpunit/phpunit": "^5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"LanguageDetection\\": "src/LanguageDetection"
"Rinvex\\Country\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
......@@ -528,18 +639,39 @@
],
"authors": [
{
"name": "Patrick Schur",
"email": "patrick_schur@outlook.de"
"name": "Rinvex LLC",
"email": "help@rinvex.com",
"homepage": "https://rinvex.com"
},
{
"name": "Abdelrahman Omran",
"email": "me@omranic.com",
"homepage": "https://omranic.com",
"role": "Project Lead"
},
{
"name": "The Generous Laravel Community",
"homepage": "https://github.com/rinvex/country/contributors"
}
],
"description": "A language detection library for PHP. Detects the language from a given text string.",
"homepage": "https://github.com/patrickschur/language-detection",
"description": "Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.",
"homepage": "https://rinvex.com",
"keywords": [
"detect",
"detection",
"language"
"Flexible",
"Simple",
"countries",
"country",
"currencies",
"demonym",
"dialling",
"emoji",
"flags",
"geographic",
"languages",
"rinvex",
"svg"
],
"time": "2018-02-01T17:12:47+00:00"
"time": "2017-03-07T18:40:20+00:00"
},
{
"name": "rinvex/country",
......@@ -617,16 +749,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.8.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "3296adf6a6454a050679cde90f95350ad604b171"
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
"reference": "3296adf6a6454a050679cde90f95350ad604b171",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
"shasum": ""
},
"require": {
......@@ -638,7 +770,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
"dev-master": "1.9-dev"
}
},
"autoload": {
......@@ -672,20 +804,20 @@
"portable",
"shim"
],
"time": "2018-04-26T10:06:28+00:00"
"time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/translation",
"version": "v4.1.2",
"version": "v4.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957"
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"shasum": ""
},
"require": {
......@@ -741,22 +873,22 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2018-07-23T08:20:20+00:00"
"time": "2018-08-07T12:45:11+00:00"
}
],
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
"version": "3.3.0",
"version": "3.3.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266"
"reference": "628a481780561150481a9ec74709092b9759b3ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d86873af43b4aa9d1f39a3601cc0cfcf02b25266",
"reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec",
"reference": "628a481780561150481a9ec74709092b9759b3ec",
"shasum": ""
},
"require": {
......@@ -794,7 +926,7 @@
"phpcs",
"standards"
],
"time": "2018-06-06T23:58:19+00:00"
"time": "2018-07-26T23:47:18+00:00"
}
],
"aliases": [],
......@@ -803,7 +935,12 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.2"
"php": "^7.2",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-bcmath": "*"
},
"platform-dev": [],
"platform-overrides": {
......
......@@ -4,38 +4,46 @@
* Config for Poduptime.
*/
//backup directory - full dir path
$backup_dir = __DIR__ . '/backup';