2020-01-14 22:25:43 +01:00
|
|
|
<?php
|
2018-01-27 00:28:32 +01:00
|
|
|
|
|
|
|
require_once (__DIR__ . '/../internals/base.php');
|
2019-12-28 22:42:25 +01:00
|
|
|
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
2018-01-27 00:28:32 +01:00
|
|
|
|
|
|
|
class MikescherGitGraph
|
|
|
|
{
|
2019-12-28 14:00:11 +01:00
|
|
|
/**
|
|
|
|
* @return ExtendedGitGraph2
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
2018-01-27 00:28:32 +01:00
|
|
|
public static function create()
|
|
|
|
{
|
|
|
|
global $CONFIG;
|
|
|
|
|
2019-12-28 14:00:11 +01:00
|
|
|
return new ExtendedGitGraph2($CONFIG['extendedgitgraph']);
|
2018-01-27 00:28:32 +01:00
|
|
|
}
|
2018-01-27 14:21:34 +01:00
|
|
|
|
|
|
|
public static function getPathRenderedData()
|
|
|
|
{
|
2019-12-28 14:00:11 +01:00
|
|
|
return __DIR__ . '/../dynamic/egg/cache_fullrenderer.html';
|
2018-01-27 14:21:34 +01:00
|
|
|
}
|
|
|
|
|
2019-12-28 14:00:11 +01:00
|
|
|
/**
|
|
|
|
* @return string|null
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public static function get()
|
2018-01-27 14:21:34 +01:00
|
|
|
{
|
2019-12-28 14:00:11 +01:00
|
|
|
$d = self::create()->loadFromCache();
|
|
|
|
if ($d === null) return "";
|
|
|
|
return $d;
|
2018-01-27 14:21:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function checkConsistency()
|
|
|
|
{
|
|
|
|
$p = self::getPathRenderedData();
|
|
|
|
|
2018-02-03 14:43:41 +01:00
|
|
|
if (!file_exists($p)) return ['result'=>'err', 'message' => 'Rendered data not found'];
|
2018-01-27 14:21:34 +01:00
|
|
|
|
2020-01-09 12:50:08 +01:00
|
|
|
if (filemtime($p) < time()-(24*60*60)) return ['result'=>'warn', 'message' => 'Rendered data is older than 1 day'];
|
2018-01-27 14:21:34 +01:00
|
|
|
|
|
|
|
return ['result'=>'ok', 'message' => ''];
|
|
|
|
}
|
2018-01-27 00:28:32 +01:00
|
|
|
}
|