svn: /web/doc-editor/trunk/php/ SvnClient.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sat, 28 Nov 2009 13:52:33 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291383

Log:
Multi-line into log message is now ok

Changed paths:
    U   web/doc-editor/trunk/php/SvnClient.php

Modified: web/doc-editor/trunk/php/SvnClient.php
===================================================================
--- web/doc-editor/trunk/php/SvnClient.php	2009-11-28 13:51:27 UTC (rev 291382)
+++ web/doc-editor/trunk/php/SvnClient.php	2009-11-28 13:52:33 UTC (rev 291383)
@@ -281,6 +281,22 @@
         return true;
     }

+    public function createCommitLogFile($log)
+    {
+        $path = tempnam(sys_get_temp_dir(), 'Doc_Editor_Commit_Log_Message');
+
+        $handle = fopen($path, "w");
+        fwrite($handle, $log);
+        fclose($handle);
+
+        return $path;
+    }
+
+    public function deleteCommitLogFile($path)
+    {
+        @unlink($path);
+    }
+
     /**
      * Executes svn commit
      *
@@ -292,6 +308,9 @@
      */
     public function commit($log, $create=false, $update=false, $delete=false)
     {
+
+        $pathLogFile = $this->createCommitLogFile($log);
+
         $create_stack = array();
         for ($i = 0; $create && $i < count($create); $i++) {
             $p = $create[$i]->lang.'/'.$create[$i]->path.'/'.$create[$i]->name;
@@ -338,7 +357,7 @@
         $log = str_replace("'", "\\'", $log);
         $cmd = $cmdDelete.
                $cmdCreate.
-               "svn ci --no-auth-cache --non-interactive -m '$log' --username $vcsLogin --password $vcsPasswd $filesUpdate $filesDelete $filesCreate";
+               "svn ci --no-auth-cache --non-interactive -F $pathLogFile --username $vcsLogin --password $vcsPasswd $filesUpdate $filesDelete $filesCreate";

         $cmd = 'cd '.DOC_EDITOR_VCS_PATH.'; ' .$cmd;

@@ -349,6 +368,9 @@
             if (strlen(trim(implode('', $output))) != 0) break;
         }

+        // Delete tmp logMessage file
+        $this->deleteCommitLogFile($pathLogFile);
+
         return $output;
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.