mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-02 14:47:35 +02:00
[Bridge] Use static variable in listBridges()
This prevents the function from re-loading the same data over and over again. Instead the same data is returned on each call, during a single request.
This commit is contained in:
@@ -70,7 +70,10 @@ EOD;
|
||||
* @return array List of the bridges
|
||||
*/
|
||||
static public function listBridges(){
|
||||
$listBridge = array();
|
||||
|
||||
static $listBridge = array(); // Initialized on first call
|
||||
|
||||
if(empty($listBridge)) {
|
||||
$dirFiles = scandir(self::getDir());
|
||||
|
||||
if($dirFiles !== false) {
|
||||
@@ -80,6 +83,7 @@ EOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $listBridge;
|
||||
}
|
||||
|
Reference in New Issue
Block a user