From e3cb4b879c85f8903686eda599a67c7ead843c5c Mon Sep 17 00:00:00 2001 From: Fran Rogers Date: Mon, 18 Aug 2008 20:06:16 +0000 Subject: [PATCH] More descriptive sanitized paths for file repo errors --- includes/filerepo/FSRepo.php | 6 +++--- includes/filerepo/LocalRepo.php | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 08ec151438..7acc531dc7 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -519,13 +519,13 @@ class FSRepo extends FileRepo { if ( !isset( $this->simpleCleanPairs ) ) { global $IP; $this->simpleCleanPairs = array( - $this->directory => 'public', - "{$this->directory}/temp" => 'temp', + $this->directory => "mwrepo://{$this->name}/public", + "{$this->directory}/temp" => "mwrepo://{$this->name}/temp", $IP => '$IP', dirname( __FILE__ ) => '$IP/extensions/WebStore', ); if ( $this->deletedDir ) { - $this->simpleCleanPairs[$this->deletedDir] = 'deleted'; + $this->simpleCleanPairs[$this->deletedDir] = "mwrepo://{$this->name}/deleted"; } } return strtr( $param, $this->simpleCleanPairs ); diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 90b198c806..b096ce0cf0 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -10,6 +10,21 @@ class LocalRepo extends FSRepo { var $fileFromRowFactory = array( 'LocalFile', 'newFromRow' ); var $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' ); + function __construct( $info ) { + parent::__construct( $info ); + + # Initialize simpleCleanPairs, to make errors less misleading + global $IP; + $this->simpleCleanPairs = array( + $this->directory => '$wgUploadDirectory', + wfTempDir() => '{wfTempDir()}', + $IP => '$IP', + ); + if ( $this->deletedDir ) { + $this->simpleCleanPairs[$this->deletedDir] = '{$wgFileStore[\'deleted\'][\'directory\']}'; + } + } + function getSlaveDB() { return wfGetDB( DB_SLAVE ); } -- 2.20.1