protected function __construct($filename, $options) { global $wgServer, $wgScriptPath, $wgVersion; $this->options = $options; // set up constants $this->R_DTS = date('r'); $this->R_VER = '0.14'; $this->R_EXT = getcwd() . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR . 'R' . DIRECTORY_SEPARATOR; $this->R_URL = $wgServer . $wgScriptPath . DIRECTORY_SEPARATOR . 'Rfiles' . DIRECTORY_SEPARATOR; $this->R_CGI = $this->R_URL . 'Rcgi.php'; $this->R_LOG = R_DIR . 'ExtR.log'; $this->R_SOP = '<!--- Start of program --->'; $this->R_EOP = '<!--- End of program --->'; $this->R_HASHMTD = ExtR::hashmethod(); $this->JQ_CSS = $this->jQueryCSS($options); $this->JQ_THEME = $this->jQueryTheme($options); // setup credits $this->creditExtension = array('path' => __FILE__, 'name' => 'R extension', 'author' => 'Sigbert Klinke, Markus Cozowicz, Alex Browne, Michael Cassin', 'version' => 'v' . $this->R_VER, 'url' => 'http://mars.wiwi.hu-berlin.de/mediawiki/sk/index.php/R_Plugin_for_MediaWiki', 'description' => 'This extension allows to embed output of R and octave (graphics/text) into wiki pages'); $this->creditSpecialPage = array('path' => __FILE__, 'name' => 'R extension', 'author' => 'Sigbert Klinke, Markus Cozowicz, Alex Browne, Michael Cassin', 'version' => 'v' . $this->R_VER, 'url' => 'http://mars.wiwi.hu-berlin.de/mediawiki/sk/index.php/R_Plugin_for_MediaWiki', 'description' => 'Generates a [[Special:R|Special Page]] for information used by the extension.'); // setup ressources $this->jQueryUI = array('scripts' => 'modules/ext.R.jQueryUI.js', 'styles' => $this->JQ_CSS, 'dependencies' => array('jquery.ui.slider', 'jquery.ui.dialog'), 'localBasePath' => __DIR__, 'remoteExtPath' => 'R'); $this->jQueryVersion = array('scripts' => 'modules/ext.R.jQueryVersion.js', 'dependencies' => 'jquery.ui.slider', 'localBasePath' => __DIR__, 'remoteExtPath' => 'R'); // setup engines try { $this->setupEngines($options); if (count($this->engine) == 0) { throw new Exception('ExtR.php: no computing engine found'); } } catch (exception $e) { $this->exception_log($e); } // setup files if (!file_exists(R_DIR . 'Rcgi.php')) { system("cp -f " . $this->R_EXT . 'Rcgi.php ' . R_DIR); } // save instance file_put_contents($filename, serialize($this)); // take care of logfile unlink($this->R_LOG); $this->extension_log('OS : ' . php_uname()); $this->extension_log('MW : ' . $wgVersion); $this->extension_log('PHP: ' . phpversion()); $lines = explode("\n", `mysql --version`); $this->extension_log('SQL: ' . $lines[0]); $lines = explode("\n", `convert --version`); $this->extension_log('IM : ' . $lines[0]); $this->extension_log('SH : ' . $this->getVersion('extensions/SyntaxHighlight_GeSHi/geshi/geshi.php', "/'GESHI_VERSION',\\s*'(.*?)'/")); $this->extension_log('VER: ' . $this->creditExtension['version']); foreach ($this->engine as $eng) { $this->extension_log('ENG: ' . $eng->desc); } }
'engine' => 'M', 'class' => 'MEngine') ); */ // example using two R engines: first system default, second locally installed /* $wgROptions['engines'] = array ( array('cmd' => 'R', 'forbidden' => 'FC_RAL', 'tag' => 'R', 'category' => 'R', 'engine' => 'R', 'class' => 'REngine'), array('cmd' => '/var/www/mediawiki/extension/R/R-2.15.3/bin/R', 'forbidden' => 'FC_RAL', 'tag' => 'R', 'category' => 'R2', 'engine' => 'R2153', 'class' => 'REngine') ); */ $extr = ExtR::getInstance(R_OBJ, $wgROptions); if (defined('MEDIAWIKI')) { // set up all MW stuff $wgAvailableRights[] = 'see-specialr'; $wgGroupPermissions['sysop']['see-specialr'] = true; $wgExtensionCredits['parserhook'][] = $extr->creditExtension; $wgExtensionCredits['specialpage'][] = $extr->creditSpecialPage; $wgHooks['ParserFirstCallInit'][] = 'ExtR::wfRParse'; $wgSpecialPageGroups['R'] = 'other'; $wgSpecialPages['R'] = 'SpecialR'; if ($extr->JQ_CSS) { // jquery is available $wgResourceModules['ext.R.jQueryUI'] = $extr->jQueryUI; $wgResourceModules['ext.R.jQueryVersion'] = $extr->jQueryVersion; } }