Browse Source

Properly update value of static variable so Redis command is only defined once

Patrick Pokatilo 9 years ago
parent
commit
efc0733c3b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Packagist/WebBundle/Model/DownloadManager.php

+ 2 - 1
src/Packagist/WebBundle/Model/DownloadManager.php

@@ -114,11 +114,12 @@ class DownloadManager
      */
     public function addDownload($package, $version)
     {
-        static $loaded;
+        static $loaded = false;
         $redis = $this->redis;
 
         if (!$loaded) {
             $redis->getProfile()->defineCommand('downloadsIncr', 'Packagist\Redis\DownloadsIncr');
+            $loaded = true;
         }
 
         if ($package instanceof Package) {