2014-09-07 07:09:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check to see if the currently accessed version is out of date or
|
|
|
|
* perhaps a future version rather than the stable edition
|
|
|
|
*
|
|
|
|
* @return false|ArrayData
|
|
|
|
*/
|
|
|
|
|
|
|
|
class DocumentationViewerVersionWarning extends Extension {
|
|
|
|
|
|
|
|
public function VersionWarning() {
|
|
|
|
$page = $this->owner->getPage();
|
|
|
|
$version = $this->owner->getVersion();
|
|
|
|
$versions = $this->owner->getVersions();
|
|
|
|
|
2014-09-07 10:35:08 +02:00
|
|
|
if($version && $page && $versions->count() > 0) {
|
2014-09-07 07:09:28 +02:00
|
|
|
$stable = $this->owner->getStableVersion();
|
2014-09-07 10:35:08 +02:00
|
|
|
|
2014-09-07 07:09:28 +02:00
|
|
|
$compare = $version->compare($stable);
|
|
|
|
|
|
|
|
// same
|
|
|
|
if($version == $stable) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($version == "master" || $compare > 0) {
|
|
|
|
return $this->customise(new ArrayData(array(
|
|
|
|
'FutureRelease' => true,
|
|
|
|
'StableVersion' => DBField::create_field('HTMLText', $stable)
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $this->customise(new ArrayData(array(
|
|
|
|
'OutdatedRelease' => true,
|
|
|
|
'StableVersion' => DBField::create_field('HTMLText', $stable)
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|