Petit problème d'authentification avec la fonction UPDATE + Correctif.

5 views
Skip to first unread message

Raphaël Aurieres

unread,
May 30, 2011, 9:07:19 AM5/30/11
to fredistra...@googlegroups.com
Pas vraiment un bug, juste un oublie.
La commande UPDATE ne gérait pas les paramètres d'authentification fournis par l'utilisateur.

Voici la version corrigée de la fonction "update" du fichier "app/vendors/fbollon/commands.php" :

    public static function update( $projectDir, $options = array() ) {
        $actionLog = self::initAction('update',$projectDir,'SvnAction',$options);
        $configDirectory = '';
        if ( is_null($projectDir) ) {
            $actionLog->error(sprintf(__('Forbidden NULL value for input parameter [%s]',true),$projectDir));   
        } else if (!is_dir($projectDir) ) {
            $actionLog->error(sprintf(__('Directory %s not found',true), $projectDir));
        } else if ( !is_dir($projectDir.DS.'.svn') ) {
            $actionLog->error(sprintf(__('Specified directory %s is not a working copy',true), $projectDir.DS.'.svn'));
        } else if ( !is_writeable($projectDir) ) {
            $actionLog->error(sprintf(__('Specified directory %s is not writeable',true), $projectDir));
        }
            
        // Define step options
        $default_options = array(
            'revision'             => null,
            'configDirectory'    => null,
            'parseResponse'     => false
        );
        $options = array_merge($default_options, $options);
       
        // Execute command
        $projectDir = Utils::formatPath($projectDir);
        $revision = ($options['revision']!=null)?' -r' . $options['revision']:'';
        $authentication = '';
        if (!is_null($options['user_svn'])) {
            $authentication .= '--username '.$options['user_svn'];
            if (!empty($options['password_svn'])) {
                $authentication .= ' --password '.$options['password_svn'];
            }
        }

        if (!is_null($options['configDirectory'])) {
            $configDirectory = '--config-dir '.Utils::formatPath( $options['configDirectory'] );
        }
        $command = "svn update --non-interactive $configDirectory $revision $authentication 2>&1";
        ShellAction::executeCommand( $command, array(
            'directory'    => $projectDir,
            'actionLog' => $actionLog
            )
        );
       
        // Parse response
        if ( !(strpos( $actionLog->getResult() , 'PROPFIND request failed on' ) === false) && $options['parseResponse'] ) {
            $actionLog->error(__('An error has been detected in the SVN output',true));
        }
       
        // End action
        $actionLog->end();
        return $actionLog;
    }// update

Connaissant peu SVN, j'ai simplement comparé avec le code de la fonction "checkout". Tout était déjà dedans... ;-)

A part ça, le projet est-il toujours maintenu ? D'autres versions sont-elles prévues ?

Bonne continuation...
Reply all
Reply to author
Forward
0 new messages