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

[email protected] (Hannes Magnusson)
Newsgroups php.doc.web
Message-ID <[email protected]>
bjori                                    Wed, 08 Jun 2011 18:59:39 +0000

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

Log:
- Only move the specific file we want to preview
- Use in-memory indexing for PhD
- set the move command as a property for debugging

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

Modified: web/doc-editor/trunk/php/PreviewFile.php
===================================================================
--- web/doc-editor/trunk/php/PreviewFile.php	2011-06-08 18:58:23 UTC (rev 311937)
+++ web/doc-editor/trunk/php/PreviewFile.php	2011-06-08 18:59:39 UTC (rev 311938)
@@ -70,20 +70,24 @@
         exec("$cmd");

         // We start the build for this file
-        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; '.$appConf['GLOBAL_CONFIGURATION']['php.bin'].' doc-base/configure.php --generate='.$this->path.' ; '.$appConf['GLOBAL_CONFIGURATION']['php.bin'].' ../phd/render.php --package PHP --format php -d doc-base/.manual.xml --output '.$this->outputDir;
+        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; '.$appConf['GLOBAL_CONFIGURATION']['php.bin'].' doc-base/configure.php --generate='.$this->path.' ; '.$appConf['GLOBAL_CONFIGURATION']['php.bin'].' ../phd/render.php --package PHP --format php --memoryindex -d doc-base/.manual.xml --output '.$this->outputDir;
         exec("$cmd");

         $this->buildCmd = $cmd;

-        // We move the result into preview.baseURI
-        $cmd = 'mv '.$this->outputDir.'php-web/*.php '.$this->inputDir;
+        // Only move the specific file we are generating
+        $xmlID = $this->getOutputId();
+        $filename = 'phdoe-' . time() . '-' . $xmlID. '.php';
+        $cmd = 'mv '.$this->outputDir.'php-web/'.$xmlID.'.php '.$this->inputDir. $filename;
         exec("$cmd");
+        $this->moveCmd = $cmd;

-        $this->getOutputFileName();

+        $this->previewUrl = $this->am->appConf[$this->am->project]['preview.baseURI'].'manual/en/' . $filename;
+
     }

-    private function getOutputFileName()
+    private function getOutputId()
     {
         // The output file name is the first ID of the file
         $file = explode('/', $this->path);
@@ -96,8 +100,7 @@

         $xmlIDs = explode('|',$info['xmlid']);
         $xmlID = $xmlIDs[0];
-
-        $this->previewUrl = $this->am->appConf[$this->am->project]['preview.baseURI'].'manual/en/'.$xmlID.'.php';
+        return $xmlID;
     }

     public function getPreviewUrl() {
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.