jenkins-bot has submitted this change and it was merged.
Change subject: makeStaticLoader: Implement --fixdir option
......................................................................
makeStaticLoader: Implement --fixdir option
Currently when running this maintenance script it outputs
the full path to the i18n file. This was done that way because
of .docs/generate.sh (which pipes it to php through stdin).
This however means that currently the output is not suitable
for pasting into demo and test index files (as the path should
be relative for those).
The --fixdir option will function as toggle between a fixed
path to the directory on disk, or a dynamic resolution at
run-time. The default is the latter. generate.sh passes --fixdir.
Change-Id: Idebca553587aaff9b31255d884461f4a51e70afd
---
M .docs/generate.sh
M maintenance/makeStaticLoader.php
2 files changed, 11 insertions(+), 3 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.docs/generate.sh b/.docs/generate.sh
index e34e549..646a73c 100755
--- a/.docs/generate.sh
+++ b/.docs/generate.sh
@@ -6,10 +6,10 @@
do
if [[ "$l" == "{{VE-LOAD-HEAD}}" ]]
then
- php ../maintenance/makeStaticLoader.php --section=head
--ve-path=../modules/ $*
+ php ../maintenance/makeStaticLoader.php --fixdir
--section=head --ve-path=../modules/ $*
elif [[ "$l" == "{{VE-LOAD-BODY}}" ]]
then
- php ../maintenance/makeStaticLoader.php --section=body
--ve-path=../modules/ $*
+ php ../maintenance/makeStaticLoader.php --fixdir
--section=body --ve-path=../modules/ $*
else
echo "$l"
fi
diff --git a/maintenance/makeStaticLoader.php b/maintenance/makeStaticLoader.php
index d05377b..f880278 100644
--- a/maintenance/makeStaticLoader.php
+++ b/maintenance/makeStaticLoader.php
@@ -13,6 +13,8 @@
$this->addOption( 'target', 'Which target to use
("demo" or "test"). Default: false', false, true );
$this->addOption( 'indent', 'Indentation prefix to use
(number of tabs or a string)', false, true );
$this->addOption( 've-path', 'Override path to
"/modules/". Default by --target', false, true );
+ $this->addOption( 'fixdir', 'Embed the absolute path in
require() statements. Defaults to relative path. '
+ . '(use this if you evaluate the resulting
script in php-STDIN instead of from a file)', false, true );
$this->addOption( 'section', 'head, body or both',
false, true );
}
@@ -49,6 +51,12 @@
),
);
+ // If we're running this script from STDIN,
+ // hardcode the full path
+ $i18nScript = $this->getOption( 'fixdir' ) ?
+ dirname( __DIR__ ) . '/VisualEditor.i18n.php' :
+ $vePath . '/../VisualEditor.i18n.php';
+
// Customized version to init standalone instead of mediawiki
platform.
$wgResourceModules['ext.visualEditor.base#standalone-init'] =
array(
'styles' => array(
@@ -63,7 +71,7 @@
</script>',
'bodyAdd' => '<script>
<?php
- require( ' . var_export( dirname( __DIR__ ) .
'/VisualEditor.i18n.php', true ) . ' );
+ require( ' . var_export( $i18nScript, true ) . ' );
echo \'ve.init.platform.addMessages( \' . json_encode(
$messages[\'en\'] ) . \');\' . "\n";
?>
ve.init.platform.setModulesUrl( \'' . $vePath . '\' );
--
To view, visit https://gerrit.wikimedia.org/r/61398
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idebca553587aaff9b31255d884461f4a51e70afd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits