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

Commit 3fd43f81 authored by Ronak Patel's avatar Ronak Patel Committed by Arnau Vàzquez
Browse files

Store md5 computation if missing to speed up future queries

parent 29ff26c5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -201,12 +201,13 @@
            if (empty($path)) {
                $path = $this->filePath;
            }
            // Pretty much faster if it is available

            if (file_exists($path . ".md5sum")) {
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $ret = $tmp[0];
            } elseif ($this->commandExists('md5sum')) {
                $tmp = explode("  ", exec('md5sum ' . $path));
                exec('md5sum ' . $path. ' > '.$path.'.md5sum');
                $tmp = explode("  ", file_get_contents($path . '.md5sum'));
                $ret = $tmp[0];
            } else {
                $ret = md5_file($path);
@@ -215,6 +216,7 @@
            return $ret;
        }


        /* Getters */

        /**