http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70009
Revision: 70009
Author: platonides
Date: 2010-07-27 12:30:19 +0000 (Tue, 27 Jul 2010)
Log Message:
-----------
Use MediaWiki wfTempDir() and tempnam() instead of global $tmpPath and rand()
Modified Paths:
--------------
trunk/phase3/maintenance/mwdocgen.php
Modified: trunk/phase3/maintenance/mwdocgen.php
===================================================================
--- trunk/phase3/maintenance/mwdocgen.php 2010-07-27 12:20:22 UTC (rev
70008)
+++ trunk/phase3/maintenance/mwdocgen.php 2010-07-27 12:30:19 UTC (rev
70009)
@@ -37,9 +37,6 @@
/** Figure out the base directory for MediaWiki location */
$mwPath = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR;
-/** Global variable: temporary directory */
-$tmpPath = '/tmp/';
-
/** doxygen binary script */
$doxygenBin = 'doxygen';
@@ -67,6 +64,9 @@
# Functions
#
+define( 'MEDIAWIKI', true );
+require_once( "$mwPath/includes/GlobalFunctions.php" );
+
/**
* Read a line from the shell
* @param $prompt String
@@ -133,7 +133,6 @@
* (LocalSettings.php, AdminSettings.php and .svn directories
are always excluded)
*/
function generateConfigFile( $doxygenTemplate, $outputDirectory,
$stripFromPath, $currentVersion, $svnstat, $input, $exclude ) {
- global $tmpPath;
$template = file_get_contents( $doxygenTemplate );
@@ -147,7 +146,7 @@
'{{EXCLUDE}}' => $exclude,
);
$tmpCfg = str_replace( array_keys( $replacements ), array_values(
$replacements ), $template );
- $tmpFileName = $tmpPath . 'mwdocgen' . rand() . '.tmp';
+ $tmpFileName = tempnam( wfTempDir(), 'mwdocgen-' );
file_put_contents( $tmpFileName , $tmpCfg ) or die( "Could not write
doxygen configuration to file $tmpFileName\n" );
return $tmpFileName;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs