Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0b26fb9 authored by syphyr's avatar syphyr Committed by Julian Xhokaxhiu
Browse files

Add size field to JSON

LineageOS now requires a size field.
parent a4250081
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
        private $filePath = '';
        private $buildProp = '';
        private $uid = null;
        private $size = '';

        /**
         * Constructor of the Build class.
@@ -83,6 +84,7 @@
            $this->model = $this->getBuildPropValue( 'ro.lineage.device' ) ?? $this->getBuildPropValue( 'ro.cm.device' ) ?? ( $tokens[1] == 'cm' ? $tokens[6] : $tokens[5] );
            $this->version = $tokens[2];
            $this->uid = hash( 'sha256', $this->timestamp.$this->model.$this->apiLevel, false );
            $this->size = filesize($this->filePath);

            $position = strrpos( $physicalPath, '/builds/full' );
            if ( $position === FALSE )
@@ -162,6 +164,14 @@

        /* Getters */

        /**
         * Get filesize of the current build
         * @return string filesize in bytes
         */
        public function getSize() {
          return $this->size;
        }

        /**
         * Get a unique id of the current build
         * @return string A unique id
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@
                    'datetime' => $build->getTimestamp(),
                    'version' => $build->getVersion(),
                    'id' => $build->getUid(),
                    'size' => $build->getSize(),
                ));
            }