Пример #1
0
 private function _loadNupkg($file, $userId)
 {
     $r = new SingleResult();
     $r->Success = true;
     try {
         $nugetReader = new NugetManager();
         $parsedNuspec = $nugetReader->LoadNuspecFromFile($file);
         $r->Id = $parsedNuspec->Id;
         $r->Version = $parsedNuspec->Version;
         $pathInfo = basename($file);
         $realPath = Path::Combine(Settings::$PackagesRoot, $r->Id . "." . $r->Version . ".nupkg");
         if ($realPath != $file) {
             if (file_exists($realPath) && DIRECTORY_SEPARATOR == '/') {
                 unlink($realPath);
             }
             rename($file, $realPath);
             $file = $realPath;
         }
         $parsedNuspec->UserId = $userId;
         $nuspecData = $nugetReader->SaveNuspec($file, $parsedNuspec);
     } catch (Exception $ex) {
         $r->Success = false;
         $r->Reason = $ex->getMessage();
     }
     return $r;
 }
Пример #2
0
            if ($result["errorCode"] != null) {
                $message .= "Error code is:" . $result["errorCode"] . ".";
            }
            unlink($result["destination"]);
            ?>
		parent.packagesUploadControllerCallback(false,"none","none","<?php 
            echo $result["errorMessage"];
            ?>
");
		<?php 
        } else {
            try {
                $udb = new UserDb();
                $user = $udb->GetByUserId($loginController->UserId);
                $nugetReader = new NugetManager();
                $parsedNuspec = $nugetReader->LoadNuspecFromFile($result["destination"]);
                $parsedNuspec->UserId = $user->Id;
                $nuspecData = $nugetReader->SaveNuspec($result["destination"], $parsedNuspec);
                $message = "Uploaded " . $result["name"] . " on " . dirname($result["destination"]);
                ?>
			parent.packagesUploadControllerCallback(true,"<?php 
                echo $parsedNuspec->Id;
                ?>
","<?php 
                echo $parsedNuspec->Version;
                ?>
");
			<?php 
            } catch (Exception $ex) {
                unlink($result["destination"]);
                ?>