[Mediawiki-l] [MediaWiki-l] problem when creating new pages with random num in SpecialPage

Pranav Desai pranavadesai at gmail.com
Fri Jan 19 07:33:44 UTC 2007

Hello All,

I have a simple SpecialPage that takes in a text value from a form and
creates a page after appending a random number to the submitted name. The
problem I am seeing is that 2 pages are created with separate random numbers
even though I am calling it only once. I am not able to figure out why. Here
is my function and section of calling code.

    $newName = $inputName. rand(1111,9999);

    function createPage($name) {

        $tmp = <<<OUT
Some wikitext
            $title = Title::makeTitle(NS_MAIN, $name);
            $article = new Article( $title );
            if ($article->exists()) {
                return "$name exists";
            else {
                $article->doEdit( $tmp, $name, EDIT_NEW );
                return "created $name";

What am I missing here. The code works fine if I just use the inputName.

I would appreciate any help.


-- Pranav

More information about the MediaWiki-l mailing list