I want to get a release number such as r1212 for 1.0.7. I just tried to get it in 'framework/YiiBase.php' but it has r1211 instead. Do we have a way to get such a number corresponded to 1.0.7?
I want to get a release number such as r1212 for 1.0.7. I just tried to get it in 'framework/YiiBase.php' but it has r1211 instead. Do we have a way to get such a number corresponded to 1.0.7?
Depending on the releasing process, the revision number you get from YiiBase.php may vary. Usually, it is one less than the official release number.
Yeah I guess so. Then, what I should do is that I do not care much about the correctness, as it may vary one or two.
FYI, followings is my small extension.
<?php // @version $Id: YiiBase.php class EyiiVersion { const ID = 'EyiiVersion'; public static function getVersion() { $value=Yii::app()->cache->get(self::ID); if($value===false) { $file=Yii::app()->basePath.'/../../../framework/YiiBase.php'; $fh = fopen($file, 'r'); $flag = true; while(($rec = fgets($fh)) && $flag) { if (strpos($rec, '$Id:')) { $tok = split(' ', $rec); $value = $tok[5]; $flag = false; } } fclose($fh); Yii::app()->cache->set(self::ID, $value, 3600*24, new CFileCacheDependency($file)); } return $value; } }