Вы хотите администратору удаленный репозиторий (ли это быть Linux или полем окон), или локальный репозиторий?
Лично я не столкнулся ни с какой достойной утилитой, таким образом, я использую сценарий AutoIT, который использует plink.exe PuTTY для взаимодействия через интерфейс с svnadmin на моем сервере Linux.
РЕДАКТИРОВАНИЕ : довольно хромой код, но это служит моим целям. Предполагает, что у Вас есть "conf/shared" каталог в Вашем $svndir, который будет совместно использован репозиториями, созданными этим сценарием. Заданный сценарием с AutoIt
$plink_bin = "C:\path\to\plink.exe"
$svndir = "/subversion"
$sshuser = "username"
$hostname = "host.domain.com"
$proj = InputBox("Enter project name", "Please enter a subversion project name", "")
if ($proj = "") Then
Exit(1)
EndIf
$arg = "cd " & $svndir & ";"
$arg = $arg & "svnadmin create " & $proj & ";"
$arg = $arg & "rm -fr " & $proj & "/conf;"
$arg = $arg & "ln -s ../conf/shared " & $proj & "/conf"
$command = $plink_bin & " " & $sshuser & "@" & $hostname & " " & $arg
Run($command)
Похоже, это было довольно просто. Я собрал шаблон Restful Controller, используя Zend_Rest_Controller Abstract. Просто замените возвращаемые значения no_results собственным php-объектом, содержащим данные, которые вы хотите вернуть. Комментарии приветствуются.
<?php
/**
* Restful Controller
*
* @copyright Copyright (c) 2009 ? (http://www.?.com)
*/
class RestfulController extends Zend_Rest_Controller
{
public function init()
{
$config = Zend_Registry::get('config');
$this->db = Zend_Db::factory($config->resources->db);
$this->no_results = array('status' => 'NO_RESULTS');
}
/**
* List
*
* The index action handles index/list requests; it responds with a
* list of the requested resources.
*
* @return json
*/
public function indexAction()
{
// do some processing...
// Send the JSON response:
$this->_helper->json($this->no_results);
}
// 1.9.2 fix
public function listAction() { return $this->_forward('index'); }
/**
* View
*
* The get action handles GET requests and receives an 'id' parameter; it
* responds with the server resource state of the resource identified
* by the 'id' value.
*
* @param integer $id
* @return json
*/
public function getAction()
{
$id = $this->_getParam('id', 0);
// do some processing...
// Send the JSON response:
$this->_helper->json($this->no_results);
}
/**
* Create
*
* The post action handles POST requests; it accepts and digests a
* POSTed resource representation and persists the resource state.
*
* @param integer $id
* @return json
*/
public function postAction()
{
$id = $this->_getParam('id', 0);
$my = $this->_getAllParams();
// do some processing...
// Send the JSON response:
$this->_helper->json($this->no_results);
}
/**
* Update
*
* The put action handles PUT requests and receives an 'id' parameter; it
* updates the server resource state of the resource identified by
* the 'id' value.
*
* @param integer $id
* @return json
*/
public function putAction()
{
$id = $this->_getParam('id', 0);
$my = $this->_getAllParams();
// do some processing...
// Send the JSON response:
$this->_helper->json($this->no_results);
}
/**
* Delete
*
* The delete action handles DELETE requests and receives an 'id'
* parameter; it updates the server resource state of the resource
* identified by the 'id' value.
*
* @param integer $id
* @return json
*/
public function deleteAction()
{
$id = $this->_getParam('id', 0);
// do some processing...
// Send the JSON response:
$this->_helper->json($this->no_results);
}
}
отличный пост, но я бы подумал, что Zend_Rest_Controller
направит запрос на правильное действие относительно используемого метода HTTP. Было бы неплохо, если бы запрос POST
к http: //
автоматически выполнял _forward
на postAction
для пример.
Я предложу еще одну стратегию ниже, но, возможно, я упускаю суть Zend_Rest_Controller
... прокомментируйте, пожалуйста.
Моя стратегия:
class RestfulController extends Zend_Rest_Controller
{
public function init()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
}
public function indexAction()
{
if($this->getRequest()->getMethod() === 'POST')
{return $this->_forward('post');}
if($this->getRequest()->getMethod() === 'GET')
{return $this->_forward('get');}
if($this->getRequest()->getMethod() === 'PUT')
{return $this->_forward('put');}
if($this->getRequest()->getMethod() === 'DELETE')
{return $this->_forward('delete');}
$this->_helper->json($listMyCustomObjects);
}
// 1.9.2 fix
public function listAction() { return $this->_forward('index'); }
[the rest of the code with action functions]