当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::canManageRelease方法代码示例

本文整理汇总了PHP中Repository::canManageRelease方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::canManageRelease方法的具体用法?PHP Repository::canManageRelease怎么用?PHP Repository::canManageRelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository::canManageRelease方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newreleaseAction

 public function newreleaseAction()
 {
     $this->_helper->layout->disableLayout();
     $userid = $this->session->userid;
     if (is_numeric($userid) == false || $_SERVER["Repository_Enabled"] !== 'true') {
         $this->_helper->viewRenderer->setNoRender();
         header("Status: 404 Not Found");
         return;
     }
     $this->view->error = "";
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->_helper->viewRenderer->setNoRender();
         $swid = isset($_POST["swid"]) ? $_POST["swid"] : null;
         $swname = isset($_POST["swname"]) ? $_POST["swname"] : null;
         $repoareaid = isset($_POST["repoareaname"]) ? $_POST["repoareaname"] : null;
         if (Repository::canManageRelease($swid, $userid) === false) {
             header("Status: 404 Not Found");
             return;
         }
         header("Content-Type: text/xml");
         if (is_numeric($swid) == false) {
             echo "<response error='No software id given to create new release.' ></response>";
             return;
         }
         $parentid = isset($_POST["parentid"]) ? $_POST["parentid"] : "";
         if (trim($parentid) == "") {
             $parentid = 0;
         }
         if (is_numeric($parentid) == false) {
             echo "<response error='Release update is not associated with any release.' ></response>";
             return;
         }
         $displayVersion = isset($_POST["displayversion"]) ? $_POST["displayversion"] : null;
         if (trim($displayVersion) == "") {
             echo "<response error='No display version given for the release.' ></response>";
             return;
         }
         $id = Repository::createRelease($swid, $swname, $displayVersion, $repoareaid, $parentid, $userid);
         if (is_numeric($id) == true) {
             Repository::addReleaseByExternalId($id, $this->session->userid, "1");
             Repository::addReleaseByExternalId($id, $this->session->userid, "2");
             $rel = new Repository_Model_MetaProductReleases();
             $rel->filter->id->equals($id);
             if (count($rel->items) > 0) {
                 $r = $rel->items[0];
                 $newrel = new RestRepositoryAreaItem(array("id" => $r->repoareaid));
                 echo "<response id='" . $id . "'>";
                 echo $newrel->get();
                 echo "</response>";
             } else {
                 echo "<response error='Could not retrieve new product release information.'></response>";
             }
         } else {
             if (is_numeric($id) == false) {
                 echo "<response error='" . $id . "'></response>";
             } else {
                 echo "<response error='Unkown error occured during release creation.'></response>";
             }
         }
     } else {
         if ($_SERVER['REQUEST_METHOD'] == "GET") {
             $swid = $this->_getParam("swid");
             if (is_numeric($swid) == false) {
                 $this->view->error = "No software id given";
                 return;
             }
             $rtype = strtolower(trim($this->_getParam("releasetype")));
             if ($rtype == "") {
                 $rtype = "major";
             }
             switch ($rtype) {
                 case "update":
                     break;
                 case "major":
                     break;
                 default:
                     $this->view->error = "Invalid release type given. The release type can be either major or update.";
                     return;
             }
             $this->view->appName = $this->_getParam("name");
             $this->view->baselist = Repository::getProductBaseReleases($swid);
             $this->view->type = $rtype;
         } else {
             $this->_helper->viewRenderer->setNoRender();
             header("Status: 404 Not Found");
             return;
         }
     }
 }
开发者ID:IASA-GR,项目名称:appdb-core,代码行数:89,代码来源:ReleaseController.php

示例2: unmarkpackagesAction

 public static function unmarkpackagesAction()
 {
     $ids = isset($_POST["ids"]) ? $_POST["ids"] : null;
     $releaseid = isset($_POST["releaseid"]) ? $_POST["releaseid"] : null;
     $swid = isset($_POST["swid"]) ? $_POST["swid"] : null;
     $userid = $this->session->userid;
     if ($ids !== null && is_array($ids) == false && is_numeric($ids) == true) {
         $ids = array($ids);
     }
     if ($_SERVER['REQUEST_METHOD'] != "POST" || $_SERVER["Repository_Enabled"] !== 'true' || is_numeric($userid) == false || is_array($ids) === false || is_numeric($releaseid) == false || is_numeric($swid) == false || Repository::canManageRelease($swid, $userid) == false) {
         header("Status: 404 Not Found");
         return;
     }
     $res = Repository::unmarkPoaPackage($ids, $releaseid, $userid);
     header("Content-Type: text/xml");
     if ($res === true) {
         echo "<response success='true'>OK</response>";
         return;
     } else {
         echo "<response success='false'>";
         for ($i = 0; $i < count($res); $i += 1) {
             echo "<package id='" . $res[$i]["id"] . "' result='" . $res[$i]["result"] . "' />";
         }
         echo "</response>";
     }
 }
开发者ID:IASA-GR,项目名称:appdb-core,代码行数:26,代码来源:DispatchController.php

示例3: uploadAction

 public function uploadAction()
 {
     ob_start();
     ob_get_clean();
     ob_end_clean();
     $this->_helper->viewRenderer->setNoRender();
     $releaseid = $this->_getParam("releaseid");
     $targetid = $this->_getParam("targetid");
     $swid = $this->_getParam("swid");
     $userid = $this->session->userid;
     if ($_SERVER["Repository_Enabled"] !== 'true' || is_numeric($this->session->userid) === false || is_numeric($releaseid) === false || is_numeric($targetid) === false || is_numeric($swid) === false || $releaseid <= 0 || $targetid <= 0 || $swid <= 0 || Repository::canManageRelease($swid, $userid) === false) {
         header("Status: 404 Not Found");
         return;
     }
     //Get release
     $rl = new RestProductReleaseItem(array("id" => $releaseid));
     $release = $rl->getRawData();
     if (!$this->handleresterror($rl, "release")) {
         return;
     }
     //retrieve upload target directory
     $targetDir = RepositoryFS::getScratchSpaceForRelease($release, $error, true);
     $targetDir .= $targetid;
     //If cannot find or create the target upload directory...
     if ($targetDir === false) {
         return $this->chunkUploadResponse('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "' . $error . '"}, "id" : "id"}');
     }
     $file = $this->chunkUploadHandling($targetDir);
     if ($file === false) {
         return;
     }
     /*****************************************************
      * THIS CODE WILL BE REACHED IF UPLOADING IS COMPLETE *
      ******************************************************/
     //check if release is a candidate revert it to unverified
     if ($release->currentStateId == 3) {
         RepositoryBackend::unpublish($release->id, "candidate", $output);
         //TODO: Send command to commrepo backend to remove candidate repositories
     }
     //get uploaded filename (full path)
     $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
     //Get target (os arch combination)
     $rl = new RestTargetItem(array("id" => $targetid));
     $target = $rl->getRawData();
     if (!$this->handleresterror($rl, "target")) {
         return;
     }
     $warnings = null;
     $res = RepositoryFS::storeUploadedFile($file, $release, $target, $userid, $warnings);
     ob_start();
     ob_get_clean();
     ob_end_clean();
     header("Content-Type: text/xml");
     if (file_exists($file)) {
         @unlink($file);
     }
     if ($res !== true && (is_numeric($res) === false || $res === false)) {
         echo '<repository datatype="item" content="upload" ><upload result="error" releaseid="' . $releaseid . '" targetid="' . $targetid . '" filename="' . $file . '" error="' . $res . '"></upload></repository>';
         return;
     }
     echo '<repository datatype="item" content="upload"><upload result="success" releaseid="' . $releaseid . '" targetid="' . $targetid . '" filename="' . $file . '"';
     if ($warnings !== null) {
         echo 'warning="' . $warnings . '"';
     }
     echo '>';
     $pcks = new Repository_Model_MetaPoaReleasePackages();
     $pcks->filter->id->equals($res);
     if (count($pcks->items) > 0) {
         $pck = $pcks->items[0];
         $xml = $pck->toXML(true);
         $xml = RepositoryXSLT::transform($xml, "poapackage");
         debug_log($xml);
         echo $xml;
     }
     echo '</upload></repository>';
     return;
 }
开发者ID:IASA-GR,项目名称:appdb-core,代码行数:77,代码来源:StorageController.php


注:本文中的Repository::canManageRelease方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。