public function vendor($request)
 {
     $name = $request->param('Vendor');
     $vendor = AddonVendor::get()->filter('Name', $name)->first();
     if (!$vendor) {
         $this->httpError(404);
     }
     return new VendorController($this, $vendor);
 }
 private function updateAddon(Addon $addon, Package $package, array $versions)
 {
     if (!$addon->VendorID) {
         $vendor = AddonVendor::get()->filter('Name', $addon->VendorName())->first();
         if (!$vendor) {
             $vendor = new AddonVendor();
             $vendor->Name = $addon->VendorName();
             $vendor->write();
         }
         $addon->VendorID = $vendor->ID;
     }
     $addon->Type = str_replace('silverstripe-', '', $package->getType());
     $addon->Description = $package->getDescription();
     $addon->Released = strtotime($package->getTime());
     $addon->Repository = $package->getRepository();
     $addon->Downloads = $package->getDownloads()->getTotal();
     $addon->DownloadsMonthly = $package->getDownloads()->getMonthly();
     $addon->Favers = $package->getFavers();
     foreach ($versions as $version) {
         $this->updateVersion($addon, $version);
     }
     // If there is no build, then queue one up if the add-on requires
     // one.
     if (!$addon->BuildQueued) {
         if (!$addon->BuiltAt) {
             $this->resque->queue('first_build', 'BuildAddonJob', array('id' => $addon->ID));
             $addon->BuildQueued = true;
         } else {
             $built = (int) $addon->obj('BuiltAt')->format('U');
             foreach ($versions as $version) {
                 if (strtotime($version->getTime()) > $built) {
                     $this->resque->queue('update', 'BuildAddonJob', array('id' => $addon->ID));
                     $addon->BuildQueued = true;
                     break;
                 }
             }
         }
     }
     $addon->LastUpdated = time();
     $addon->write();
 }