1
0
www.mikescher.com/www/internals/mikeschergitgraph.php

45 lines
1.0 KiB
PHP
Raw Normal View History

2018-01-27 00:28:32 +01:00
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
require_once (__DIR__ . '/../internals/base.php');
2019-12-28 14:00:11 +01:00
require_once (__DIR__ . '/../extern/egh/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
if (filemtime($p) < time()-(3*7*24*60*60)) return ['result'=>'warn', 'message' => 'Rendered data is older than 3 weeks'];
return ['result'=>'ok', 'message' => ''];
}
2018-01-27 00:28:32 +01:00
}