Skip to content

Commit

Permalink
Simplify get_build
Browse files Browse the repository at this point in the history
That function has too much IO and is not up-to-date
FreshRSS/FreshRSS@02d1dac
  • Loading branch information
Alkarex committed Jun 16, 2024
1 parent b5c61d8 commit 1f155cd
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2117,28 +2117,8 @@ public static function get_build()
return self::$SIMPLEPIE_BUILD;
}

$root = dirname(__FILE__, 2);
if (file_exists($root . '/.git/index')) {
self::$SIMPLEPIE_BUILD = filemtime($root . '/.git/index');

return self::$SIMPLEPIE_BUILD;
} elseif (file_exists($root . '/SimplePie')) {
$time = 0;
foreach (glob($root . '/SimplePie/*.php') as $file) {
if (($mtime = filemtime($file)) > $time) {
$time = $mtime;
}
}
self::$SIMPLEPIE_BUILD = $time;

return self::$SIMPLEPIE_BUILD;
} elseif (file_exists(dirname(__FILE__) . '/Core.php')) {
self::$SIMPLEPIE_BUILD = filemtime(dirname(__FILE__) . '/Core.php');

return self::$SIMPLEPIE_BUILD;
}

self::$SIMPLEPIE_BUILD = filemtime(__FILE__);
$mtime = @filemtime(dirname(__FILE__) . '/SimplePie.php'); // FreshRSS
self::$SIMPLEPIE_BUILD = $mtime ?: (filemtime(__FILE__) ?: 0); // FreshRSS

return self::$SIMPLEPIE_BUILD;
}
Expand Down

0 comments on commit 1f155cd

Please sign in to comment.