r42762 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42761‎ | r42762 | r42763 >
Date:08:45, 29 October 2008
Author:tomasz
Status:old
Tags:
Comment:
initial stub for template generation
Modified paths:
  • /branches/CentralNotice-SpecialPage-Integration/rebuildTemplates.php (added) (history)

Diff [purge]

Index: branches/CentralNotice-SpecialPage-Integration/rebuildTemplates.php
@@ -0,0 +1,41 @@
 2+<?php error_reporting(E_ALL);
 3+
 4+require_once dirname( dirname( dirname( __FILE__ ) ) ) . "/maintenance/commandLine.inc";
 5+
 6+if( !class_exists( 'CentralNotice' ) ) {
 7+ require dirname( __FILE__ ) . '/SpecialCentralNotice.php';
 8+}
 9+
 10+if( isset( $options['help'] ) ) {
 11+ echo "Rebuilds templates for all notices in DB.\n";
 12+ echo "Usage:\n";
 13+ echo " php extensions/CentralNotice/rebuildTemplates\n";
 14+} else {
 15+ echo "Rebuilding templates ...\n";
 16+ $notice = efSelectNotice( 'central_notice_campaign' );
 17+ $templates = array();
 18+ $templates = CentralNotice::getTemplatesForNotice( $notice );
 19+
 20+
 21+ $script_header = <<<END
 22+<style type="text/css">
 23+END;
 24+ $script_footer = <<<END
 25+</style>
 26+END;
 27+
 28+ $css_filename = 'tomas.css';
 29+ $css = fopen("$css_filename", "r");
 30+ $css_body = fread($css, filesize($css_filename));
 31+ fclose ( $css );
 32+
 33+ foreach( $templates as $template => $weight) {
 34+ $fh = fopen("js/centralnotice-$template-en.js", "w");
 35+ fwrite( $fh, $script_header );
 36+ fwrite( $fh, $css_body );
 37+ fwrite( $fh, $script_footer );
 38+ fwrite( $fh, wfMsg( "Template:$template" ));
 39+ fwrite( $fh, wfMsg( "Template:$template/en" ));
 40+ fclose ( $fh );
 41+ }
 42+}
Property changes on: branches/CentralNotice-SpecialPage-Integration/rebuildTemplates.php
___________________________________________________________________
Added: svn:executable
143 + *

Status & tagging log