svn: /phd/trunk/phpdotnet/phd/ MediaManager.php

From: Date: Tue, 18 Aug 2009 14:00:26 +0000
Subject: svn: /phd/trunk/phpdotnet/phd/ MediaManager.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4717@lists.php.net to get a copy of this message
rquadling Tue, 18 Aug 2009 14:00:26 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287453 Log: Allow for the 3 styles for checkouts: peardoc/en (@LANG@ is a child), modules/doc-en (@LANG@ is a sibling) and doc-base/trunk+en/trunk (@LANG@/trunk is a cousin) Changed paths: U phd/trunk/phpdotnet/phd/MediaManager.php Modified: phd/trunk/phpdotnet/phd/MediaManager.php =================================================================== --- phd/trunk/phpdotnet/phd/MediaManager.php 2009-08-18 13:39:27 UTC (rev 287452) +++ phd/trunk/phpdotnet/phd/MediaManager.php 2009-08-18 14:00:26 UTC (rev 287453) @@ -86,32 +86,38 @@ protected function copyOver($filename, $newpath) { $fullpath = $this->output_dir . '/' . $newpath; - $fullfilename = $this->relative_source_path . $filename; - $altfullfilename = $this->relative_source_path . '../' . $filename; + $sourcefilenames = array ( + // Original format where @LANG@ was part of phpdoc (ala peardoc). + $this->relative_source_path . $filename, - if (file_exists($fullpath)) { - //no need to copy over again - return; - } + // Where phpdoc/modules/doc-@LANG@ is used. + $this->relative_source_path . '../' . $filename, - if (!file_exists($fullfilename)) { - if (!file_exists($altfullfilename)) { - trigger_error('Image does not exist: ' . $fullfilename, E_USER_WARNING); - return; - } + // Where phpdoc/doc-base/trunks and phpdoc/en/trunk are used. + $this->relative_source_path . '../../' . substr($filename, 0, strpos($filename, '/', 1)) . '/trunk' . substr($filename, strpos($filename, '/', 1)), + ); + $foundfile = false; + foreach($sourcefilenames as $fullfilename) { + if (file_exists($fullfilename)) { - $fullfilename = $altfullfilename; - } + if (!$this->media_dir_exists) { + $dir = dirname($fullpath); + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } + $this->media_dir_exists = true; + } - if (!$this->media_dir_exists) { - $dir = dirname($fullpath); - if (!file_exists($dir)) { - mkdir($dir, 0777, true); + $foundfile = copy($fullfilename, $fullpath); + break; } - $this->media_dir_exists = true; } - copy($fullfilename, $fullpath); + if (!$foundfile) { + trigger_error('Image does not exist: ' . $fullfilename, E_USER_WARNING); + return; + } + }//protected function copyOver(..) }//class MediaManager

« previous php.doc.cvs (#4717) next »