r99957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99956‎ | r99957 | r99958 >
Date:17:30, 16 October 2011
Author:dasch
Status:deferred (Comments)
Tags:
Comment:
Extension for checking the enviroment to find possible problems
This is an alpha version as an example
The statuscheck does not work at the moment
Modified paths:
  • /trunk/extensions/Diagnosis (added) (history)
  • /trunk/extensions/Diagnosis/Diagnosis.i18n.php (added) (history)
  • /trunk/extensions/Diagnosis/Diagnosis.php (added) (history)
  • /trunk/extensions/Diagnosis/SpecialDiagnosis.php (added) (history)

Diff [purge]

Index: trunk/extensions/Diagnosis/Diagnosis.i18n.php
@@ -0,0 +1,43 @@
 2+<?php
 3+
 4+/**
 5+ * Messages file for the Diagnosis extension
 6+ *
 7+ * @addtogroup Extensions
 8+ */
 9+
 10+/**
 11+ * Get all extension messages
 12+ *
 13+ * @return array
 14+ */
 15+$messages = array();
 16+$aliases = array();
 17+
 18+/* *** English *** */
 19+$aliases['en'] = array(
 20+ 'Diagnosis' => array( 'Diagnosis' ),
 21+);
 22+$messages['en'] = array(
 23+ 'diagnosis' => 'Diagnosis',
 24+ 'diagnosis-desc' => 'Extension to find possible problems and errors or security risks',
 25+);
 26+
 27+/** Message documentation (Message documentation) */
 28+$aliases['qqq'] = array(
 29+ 'Diagnosis' => array( 'Diagnosis' ),
 30+);
 31+
 32+$messages['qqq'] = array(
 33+ 'diagnosis' => 'Diagnosis',
 34+ 'diagnosis-desc' => 'Extensions description',
 35+);
 36+
 37+/* *** German (Deutsch) *** */
 38+$aliases['de'] = array(
 39+ 'Diagnosis' => array( 'Diagnose' ),
 40+);
 41+$messages['de'] = array(
 42+ 'diagnosis' => 'Diagnose',
 43+ 'diagnosis-desc' => 'Erweiterung um Probleme, Fehler oder Sicherheitsl�cken zu finden',
 44+);
\ No newline at end of file
Property changes on: trunk/extensions/Diagnosis/Diagnosis.i18n.php
___________________________________________________________________
Added: svn:eol-style
145 + native
Index: trunk/extensions/Diagnosis/Diagnosis.php
@@ -0,0 +1,28 @@
 2+<?php
 3+# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
 4+if (!defined('MEDIAWIKI')) {
 5+ echo <<<EOT
 6+To install my extension, put the following line in LocalSettings.php:
 7+require_once( "\$IP/extensions/Diagnostics/Diagnostics.php" );
 8+EOT;
 9+ exit( 1 );
 10+}
 11+
 12+$wgExtensionCredits['specialpage'][] = array(
 13+ 'path' => __FILE__,
 14+ 'name' => 'Diagnosis',
 15+ 'author' => '[http://www.dasch-tour.de DaSch]',
 16+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Diagnostics',
 17+ 'descriptionmsg' => 'diagnosis-desc',
 18+ 'version' => '0.0.1',
 19+);
 20+
 21+$dir = dirname(__FILE__) . '/';
 22+
 23+$wgAvailableRights[] = 'diagnosis-access';
 24+$wgGroupPermissions['sysop']['diagnosis-access'] = true;
 25+
 26+$wgAutoloadClasses['SpecialDiagnosis'] = $dir . 'SpecialDiagnosis.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file)
 27+$wgExtensionMessagesFiles['Diagnosis'] = $dir . 'Diagnosis.i18n.php'; # Location of a messages file (Tell MediaWiki to load this file)
 28+$wgSpecialPages['Diagnosis'] = 'SpecialDiagnosis'; # Tell MediaWiki about the new special page and its class name
 29+$wgSpecialPageGroups['Diagnosis'] = 'other';
\ No newline at end of file
Property changes on: trunk/extensions/Diagnosis/Diagnosis.php
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: trunk/extensions/Diagnosis/SpecialDiagnosis.php
@@ -0,0 +1,73 @@
 2+<?php
 3+class SpecialDiagnostics extends SpecialPage {
 4+ function __construct() {
 5+ parent::__construct( 'Diagnostics', 'diagnostics-access' );
 6+ wfLoadExtensionMessages('Diagnostics');
 7+ }
 8+
 9+ function execute( $par ) {
 10+ global $wgRequest, $wgOut, $wgShellLocale, $wgImageMagickConvertCommand ,$wgSVGConverterPath, $wgSVGConverters;
 11+
 12+ $this->setHeaders();
 13+
 14+ $wgOut->addHTML( '<table class=wikitable>' );
 15+ $wgOut->addHTML( '<tr>' );
 16+ $wgOut->addHTML( '<th>Parameter</th>' );
 17+ $wgOut->addHTML( '<th>Current Value</th>' );
 18+ $wgOut->addHTML( '<th>Expected Value</th>' );
 19+ $wgOut->addHTML( '<th>Description</th>' );
 20+ $wgOut->addHTML( '<th>Status</th>' );
 21+ $wgOut->addHTML( '</tr>' );
 22+ ### System locals ###
 23+ $wgOut->addHTML( '<tr>' );
 24+ $wgOut->addHTML( '<td>System Locals</td>' );
 25+ $sdSystemLocale = explode(" ",shell_exec('locale -a'));
 26+ $wgOut->addHTML( '<td>' );
 27+ foreach ($sdSystemLocale as $value) {
 28+ $wgOut->addHTML($value . '<br\>');
 29+ }
 30+ $wgOut->addHTML('</td>' );
 31+ $wgOut->addHTML( '<td>' . $wgShellLocale . '</td>' );
 32+ $wgOut->addHTML( '<td> To make ShellLocale work it must be installed on the system </td>' );
 33+ if ( in_array($wgShellLocale, $sdSystemLocale) ) {
 34+ $sdSystemLocaleStatus='OK';
 35+ }
 36+ else {
 37+ $sdSystemLocaleStatus='ERROR';
 38+ }
 39+ $wgOut->addHTML( '<td>' . $sdSystemLocaleStatus . '</td>' );
 40+ $wgOut->addHTML( '</tr>' );
 41+ ### ImageMagick ###
 42+ $wgOut->addHTML( '<tr>' );
 43+ $wgOut->addHTML( '<td>ImageMagick</td>' );
 44+ $sdConvertPath = shell_exec('which convert');
 45+ $wgOut->addHTML( '<td>' . $sdConvertPath . '</td>' );
 46+ $wgOut->addHTML( '<td>' . $wgImageMagickConvertCommand . '</td>' );
 47+ $wgOut->addHTML( '<td> Check if the command for converting Images is correct </td>' );
 48+ if ( $sdConvertPath === $wgImageMagickConvertCommand ) {
 49+ $sdConvertPathStatus='OK';
 50+ }
 51+ else {
 52+ $sdConvertPathStatus='ERROR';
 53+ }
 54+ $wgOut->addHTML( '<td>' . $sdConvertPathStatus . '</td>' );
 55+ $wgOut->addHTML( '</tr>' );
 56+ ### RSVG ###
 57+ $wgOut->addHTML( '<tr>' );
 58+ $wgOut->addHTML( '<td>RSVG</td>' );
 59+ $sdSVGPath = shell_exec('which rsvg');
 60+ $wgOut->addHTML( '<td>' . $sdSVGPath . '</td>' );
 61+ $wgOut->addHTML( '<td>' . $wgSVGConverterPath . '<br/>' . $wgSVGConverters['rsvg'] . '</td>' );
 62+ $wgOut->addHTML( '<td> Check if the command for converting SVG is correct </td>' );
 63+ if ( $sdSVGPath === $wgSVGConverterPath ) {
 64+ $sdSVGPathStatus='OK';
 65+ }
 66+ else {
 67+ $sdSVGPathStatus='ERROR';
 68+ }
 69+ $wgOut->addHTML( '<td>' . $sdSVGPathStatus . '</td>' );
 70+ $wgOut->addHTML( '</tr>' );
 71+ ### End Table ###
 72+ $wgOut->addHTML( '</table>' );
 73+ }
 74+}
\ No newline at end of file
Property changes on: trunk/extensions/Diagnosis/SpecialDiagnosis.php
___________________________________________________________________
Added: svn:eol-style
175 + native
Property changes on: trunk/extensions/Diagnosis
___________________________________________________________________
Added: bugtraq:number
276 + true

Follow-up revisions

RevisionCommit summaryAuthorDate
r99959fixes I though already were in r99957 and added output of PHP Extensionsdasch17:50, 16 October 2011

Comments

#Comment by Johnduhart (talk | contribs)   16:08, 17 October 2011
+                global $wgRequest, $wgOut

*screams*

Status & tagging log