From: Platonides Date: Tue, 27 Jul 2010 12:30:19 +0000 (+0000) Subject: Use MediaWiki wfTempDir() and tempnam() instead of global $tmpPath and rand() X-Git-Tag: 1.31.0-rc.0~35891 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=e7644d5568acc2fdea9f9e6be3baea2d174f8597;p=lhc%2Fweb%2Fwiklou.git Use MediaWiki wfTempDir() and tempnam() instead of global $tmpPath and rand() --- diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php index 05fbdf9715..70e9d969b9 100644 --- a/maintenance/mwdocgen.php +++ b/maintenance/mwdocgen.php @@ -37,9 +37,6 @@ if ( php_sapi_name() != 'cli' ) { /** 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 @@ $exclude = ''; # Functions # +define( 'MEDIAWIKI', true ); +require_once( "$mwPath/includes/GlobalFunctions.php" ); + /** * Read a line from the shell * @param $prompt String @@ -133,7 +133,6 @@ function getSvnRevision( $dir ) { * (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 @@ function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, '{{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;