From: Fran Rogers Date: Mon, 18 Aug 2008 20:06:16 +0000 (+0000) Subject: More descriptive sanitized paths for file repo errors X-Git-Tag: 1.31.0-rc.0~45818 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=e3cb4b879c85f8903686eda599a67c7ead843c5c;p=lhc%2Fweb%2Fwiklou.git More descriptive sanitized paths for file repo errors --- 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 ); }