Exemplo n.º 1
0
 /**
  * Get the cache file path (without cache-files-dir prefix).
  *
  * @param PackageInterface $p
  * @return type
  */
 public function getCacheKey($p)
 {
     $distRef = $p->getDistReference();
     if (preg_match('{^[a-f0-9]{40}$}', $distRef)) {
         return $p->getName() . '/' . $distRef . '.' . $p->getDistType();
     }
     // Composer builds the key like this, but it doesn't work:
     //return $p->getName().'/'.$p->getVersion().'-'.$distRef.'.'.$p->getDistType();
     // we need to apply the SHA1 fix from
     // https://github.com/krispypen/composer/commit/d8fa9ab57efdac94cd7135d96c2523932ac30f8b
     return $p->getName() . '/' . $p->getVersion() . '-' . $distRef . '-' . $p->getDistSha1Checksum() . '.' . $p->getDistType();
 }