Skip to content

Commit

Permalink
Enhance timestamp
Browse files Browse the repository at this point in the history
If build.prop is missing, use the ZIP file modified time. Also, always return an int value ( and not a string ) as the official OTA is doing.
  • Loading branch information
julianxhokaxhiu committed Nov 10, 2017
1 parent e25c135 commit 1d71127
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Helpers/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($fileName, $physicalPath) {
// - builds/CURRENT_ZIP_FILE.zip.prop ( which must exist )
$this->buildProp = explode( "\n", @file_get_contents('zip://'.$this->filePath.'#system/build.prop') ?? @file_get_contents($filePath.'.prop') );
// Try to fetch build.prop values. In some cases, we can provide a fallback, in other a null value will be given
$this->timestamp = $this->getBuildPropValue( 'ro.build.date.utc' ) ?? '';
$this->timestamp = intval( $this->getBuildPropValue( 'ro.build.date.utc' ) ?? filemtime($this->filePath) );
$this->incremental = $this->getBuildPropValue( 'ro.build.version.incremental' ) ?? '';
$this->apiLevel = $this->getBuildPropValue( 'ro.build.version.sdk' ) ?? '';
$this->model = $this->getBuildPropValue( 'ro.lineage.device' ) ?? $this->getBuildPropValue( 'ro.cm.device' ) ?? ( $tokens[1] == 'cm' ? $tokens[6] : $tokens[5] );
Expand Down

0 comments on commit 1d71127

Please sign in to comment.