Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240301

Change subject: [WIP] resourceloader: Placeholderize all the things
......................................................................

[WIP] resourceloader: Placeholderize all the things

Change-Id: I173a9820b3067c4a6598a4c8d77e239797d2659c
---
M includes/resourceloader/ResourceLoaderModule.php
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/240301/1

diff --git a/includes/resourceloader/ResourceLoaderModule.php 
b/includes/resourceloader/ResourceLoaderModule.php
index 36423e2..0c0f5ec 100644
--- a/includes/resourceloader/ResourceLoaderModule.php
+++ b/includes/resourceloader/ResourceLoaderModule.php
@@ -438,6 +438,30 @@
                }
        }
 
+       public static function placeholderize( Array $filePaths ) {
+               global $IP, $wgStyleDirectory, $wgExtensionDirectory;
+               $placeholders = array(
+                       array( 'extDir', $wgExtensionDirectory ),
+                       array( 'styleDir', $wgStyleDirectory ),
+                       array( 'IP', $IP ),
+               );
+               return array_map( function ( $path ) use ( $placeholders ) {
+                       foreach ( $placeholders as $placeholder ) {
+                               if ( strpos( $path, $placeholder[0] ) === 0 ) {
+                                       return strtr( $path, array(
+                                               $placeholder[1] => 
"/:{$placeholder[0]}"
+                                       ) );
+                               }
+                       }
+                       return $path;
+               }, $filePaths );
+
+       }
+
+       protected function unplaceholderize( Array $filePaths ) {
+               global $IP;
+       }
+
        /**
         * Get the last modification timestamp of the messages in this module 
for a given language.
         * @param string $lang Language code

-- 
To view, visit https://gerrit.wikimedia.org/r/240301
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I173a9820b3067c4a6598a4c8d77e239797d2659c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to