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

Commit 918ee3d2 authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

Fix md5sum and regex

parent a1078344
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -209,7 +209,8 @@
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $ret = $tmp[0];
                $ret = $tmp[0];
            } elseif ($this->commandExists('md5sum')) {
            } elseif ($this->commandExists('md5sum')) {
                exec('md5sum ' . $path. ' > '.$path.'.md5sum');
                $dir = rtrim($path, $this->filename);
                exec("cd $dir && md5sum " . $this->filename. ' > '.$path.'.md5sum');
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $ret = $tmp[0];
                $ret = $tmp[0];
            } else {
            } else {
+23 −32
Original line number Original line Diff line number Diff line
@@ -176,19 +176,11 @@
            if (count($files) > 2) {
            if (count($files) > 2) {
                
                
                foreach ($files as $file) {
                foreach ($files as $file) {
                    $filename = pathinfo($file, PATHINFO_FILENAME);
                    // Skip all files except for the ones that match the pattern

                    // filename starting with e- and ending with .zip are considered as valid files
                    if (preg_match("/IMG/i", $filename)) {
                    if (!preg_match("/^e-[0-9\.]+-(.*)-$device\.zip$/i", $file)) {
                        continue;
                    }
                    
                    if (preg_match("/latest/i", $filename)) {
                        continue;
                        continue;
                    }
                    }

                    $extension = pathinfo($file, PATHINFO_EXTENSION);

                    if ($extension == 'zip') {
                    $build = null;
                    $build = null;


                    // If APC is enabled
                    // If APC is enabled
@@ -216,7 +208,6 @@
                    }
                    }
                }
                }
            }
            }
            }
            $this->logger->debug('Total execution  time  of getBuilds in seconds');
            $this->logger->debug('Total execution  time  of getBuilds in seconds');
        }
        }