Hi,
How can I make an Admin object in PHP? How can I pass admin ritghts to the following function:
function execute( $par ) {
global $wgRequest;
global $wgOut;
global $wgUser;
global $wgParser;
global $wgScriptPath;
global $wgServer;
$page = isset( $par ) ? $par : $wgRequest->getText( 'page' );
$title = Title::newFromText( $page );
$article = new Article ($title);
$wgOut->setPrintable();
$wgOut->disable();
$parserOptions = ParserOptions::newFromUser( $wgUser );
$parserOptions->setEditSection( false );
$parserOptions->setTidy(true);
$wgParser->mShowToc = false;
$parserOutput = $wgParser->parse( $article->preSaveTransform( $article->getContent() ) ."\n\n",
$title, $parserOptions );
I tried to use my MW for giving PDF file to another software. I simply tried to use PDFExport for it. The external software give the appropriate URL to PdfExport.php and the PDF is ready.
If user rights is default there is no problem. After I changed the user rights (see below), there is not any content in the generated PDF file, except the navigation menu on the left-hand side of the wiki's page.
User rights: $wgGroupPermissions['*' ]['read'] = false; $wgGroupPermissions['user' ]['read'] = true; $wgWhitelistRead = array("Main Page", 'Special:PdfPrint', 'Special:Userlogin',);
How can I get the whole content of the page? Can I somehow change the USER ID and pass admin rights (first of all reading right) in the PdfExport.php? Any other solution?
Please write me soon. Regards, Gábor
How can I make an Admin object in PHP? How can I pass admin ritghts to the following function:
An admin is just a user with certain rights, there is no such thing as an admin object, just a user object, but that's not actually important. Userrights are irrelevant if you're writing php, though, since php has direct access to the database and can do anything it wants. I'm not sure what's causing your problem (I don't fully understand what you're trying to do - if I'm reading it right, the code extract you gave doesn't actually output anything), but you don't need to give php any permissions, it's able to do everything already.
mediawiki-l@lists.wikimedia.org