Subversion Repositories ezsvn

[/] [trunk/] [extension/] [ezsvn/] [modules/] [svn/] [client.php] - Blame information for rev 29

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 xrow
<?php
2
 
3
// include classes
4
include_once( "lib/ezsoap/classes/ezsoapclient.php" );
5
include_once( "lib/ezsoap/classes/ezsoaprequest.php" );
6
 
7
$Module =& $Params['Module'];
8
include_once( 'kernel/common/template.php' );
9 29 xrow
$tpl =& eZTemplate::factory();
10 2 xrow
 
11
$http =& eZHTTPTool::instance();
12
 
13
$output = "";
14
if ( $http->hasPostVariable( 'Execute' ) )
15
{
16
        $ini =& eZINI::instance( 'svn.ini' );
17
        if ( !$options['user'] )
18
            $options['user'] = $ini->variable( 'Settings', 'User' );
19
        if ( !$options['password'] )
20
            $options['password'] = $ini->variable( 'Settings', 'Password' );
21
        if ( !$options['server'] )
22
            $options['server'] = $ini->variable( 'Settings', 'Server' );
23
        if ( !$options['server-port'] )
24
            $options['server-port'] = $ini->variable( 'Settings', 'Port' );
25
        if ( !$options['config-id'] )
26
            $options['config-id'] = $ini->variable( 'Settings', 'ConfigID' );
27
 
28
    // create a new client
29
    if ( $options['server-port'] )
30
        $client = new eZSOAPClient( $options['server'], '/svn/configserver', $options['server-port'] );
31
    else
32
        $client = new eZSOAPClient( $options['server'], '/svn/configserver' );
33
    $client->setLogin( $options['user'] );
34
    $client->setPassword( $options['password'] );
35
 
36
    // create the SOAP request object
37
    $request = new eZSOAPRequest( "eZSOAPsvn::config", 'http://' . $server . '/svn/configserver' );
38
 
39
    // add parameters to the request #'3f5bedf1f158f517d2d14c8b475eeae2'
40
    $request->addParameter( "remote_id", $options['config-id'] );
41
 
42
    // send the request to the server and fetch the response
43
    $response =& $client->send( $request );
44
 
45
    if ( $response->isFault() )
46
    {
47
        #$cli->output(  "SOAP fault: " . $response->faultCode(). " - " . $response->faultString() . "" );
48
   }
49
    else
50
    {
51
        $configarray = $response->value();
52
        include_once( 'extension/ezsvn/classes/ezsvn.php' );
53
        if ( !$options['include-base'] )
54
            $configarray  = array_slice( $configarray, 1);
55
 
56
        foreach ( $configarray as $repository )
57
        {
58
            $output .= $repository['url'] . "\n";
59
            $result = eZSVN::execute( $repository );
60
                        if ( $result === false )
61
                                $output .= 'An error occured.' ."\n";
62
                        if ( is_array( $result ) )
63
                                $output .= join( $result['output'], "\n" ) . "\n";
64
                        $output .= "\n";
65
        }
66
        $output .= 'All sources updated.' . "\n";
67
        include_once( 'kernel/classes/ezcache.php' );
68
        eZCache::clearAll();
69
        $output .= 'Cleared all caches.' . "\n";
70
    }
71
}
72
$tpl->setVariable( 'output', $output );
73
$Result = array();
74
$Result['left_menu'] = "design:parts/ezadmin/menu.tpl";
75
$Result['content'] = $tpl->fetch( "design:ezsvn/client.tpl" );
76
$Result['path'] = array( array( 'url' => false,
77
                        'text' => 'SVN client' ) );
78 29 xrow
?>