Yaron Koren has uploaded a new change for review.
https://gerrit.wikimedia.org/r/53130
Change subject: {{!}} hack template is now generated as well, if it's needed
and doesn't exist
......................................................................
{{!}} hack template is now generated as well, if it's needed and doesn't exist
Change-Id: I31af65fbeebacb21119ec68388af5435fada9dfa
---
M includes/SF_PageSchemas.php
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms
refs/changes/30/53130/1
diff --git a/includes/SF_PageSchemas.php b/includes/SF_PageSchemas.php
index 50082fa..49806f4 100644
--- a/includes/SF_PageSchemas.php
+++ b/includes/SF_PageSchemas.php
@@ -443,8 +443,10 @@
$form_templates = array();
$jobs = array();
+ $templateHackUsed = false;
+
+ // Generate every specified template
foreach ( $psTemplates as $psTemplate ) {
- // Generate every specified template
$templateName = $psTemplate->getName();
$templateTitle = Title::makeTitleSafe( NS_TEMPLATE,
$templateName );
$fullTemplateName = PageSchemas::titleString(
$templateTitle );
@@ -477,6 +479,9 @@
$params['user_id'] = $wgUser->getId();
$params['page_text'] = $templateText;
$jobs[] = new PSCreatePageJob( $templateTitle,
$params );
+ if ( strpos( $templateText, '{{!}}' ) > 0 ) {
+ $templateHackUsed = true;
+ }
}
$templateValues = self::getTemplateValues( $psTemplate
);
@@ -497,6 +502,18 @@
);
$form_templates[] = $form_template;
}
+
+ // Create the "!" hack template, if it's necessary
+ if ( $templateHackUsed ) {
+ $templateTitle = Title::makeTitleSafe( NS_TEMPLATE, '!'
);
+ if ( ! $templateTitle->exists() ) {
+ $params = array();
+ $params['user_id'] = $wgUser->getId();
+ $params['page_text'] = '|';
+ $jobs[] = new PSCreatePageJob( $templateTitle,
$params );
+ }
+ }
+
Job::batchInsert( $jobs );
// Create form, if it's specified.
--
To view, visit https://gerrit.wikimedia.org/r/53130
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I31af65fbeebacb21119ec68388af5435fada9dfa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits