예제 #1
0
 function test_parameters()
 {
     saveWikiText('test:links', '[[wiki:syntax?do=export_raw]] [[:web:scripts:add_vhost.sh?do=export_raw]]', 'Init tests');
     idx_addPage('test:links');
     $this->assertEquals(array('test:links'), ft_backlinks('wiki:syntax'));
     $this->assertEquals(array('test:links'), ft_backlinks('web:scripts:add_vhost.sh'));
 }
예제 #2
0
 function handle_start(&$event, $param)
 {
     global $ID;
     global $ACT;
     global $INFO;
     if ($ACT != 'show') {
         return;
     }
     if (!$INFO['exists']) {
         return;
     }
     # don't try to read an article that doesn't exist
     $all = rtrim(rawWiki($ID));
     $inner = substr($all, 2, -2);
     if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
         if (!strpos($inner, '://') === false) {
             $url = $inner;
             # link is URL already
         } else {
             msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
             $url = html_wikilink($inner, $name = null, $search = '');
             $url = substr($url, strpos($url, '"') + 1);
             $url = substr($url, 0, strpos($url, '"'));
         }
         idx_addPage($ID);
         # ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
         send_redirect($url);
     }
 }
예제 #3
0
 public function test_media_in_deleted_pages()
 {
     saveWikiText('test:internalmedia_usage', '{{internalmedia.png}} {{..:internal media.png}}', 'Test initialization');
     idx_addPage('test:internalmedia_usage');
     saveWikiText('test:internalmedia_usage', '', 'Deleted');
     $this->assertEquals(array(), ft_mediause('internal_media.png'));
     $this->assertEquals(array(), ft_mediause('test:internalmedia.png'));
 }
예제 #4
0
function _index($id)
{
    global $CLEAR;
    global $QUIET;
    _quietecho("{$id}... ");
    idx_addPage($id, !$QUIET, $CLEAR);
    _quietecho("done.\n");
}
예제 #5
0
 public function setUp()
 {
     parent::setUp();
     saveWikiText('testpage', 'Foo bar baz.', 'Test initialization');
     saveWikiText('notfound', 'Foon barn bazn.', 'Test initialization');
     idx_addPage('testpage');
     idx_addPage('notfound');
 }
 public function setUp()
 {
     parent::setUp();
     saveWikiText('syntax', 'dummy', 'test');
     // make sure the search index is initialized
     idx_addPage('wiki:syntax');
     idx_addPage('syntax');
     idx_addPage('wiki:welcome');
     idx_addPage('wiki:dokuwiki');
 }
예제 #7
0
    public function test_media_in_footnotes() {
        saveWikiText('test:media_footnotes', '(({{footnote.png?20x50}} [[foonote|{{:footlink.png}}]]))', 'Test initialization');
        idx_addPage('test:media_footnotes');

        $query = array('test:footnote.png', 'footlink.png');
        $this->assertEquals(array(
            'test:footnote.png' => array('test:media_footnotes'),
            'footlink.png' => array('test:media_footnotes')
        ), idx_get_indexer()->lookupKey('relation_media', $query));
    }
 public function setUp()
 {
     $this->pluginsEnabled[] = 'tag';
     parent::setUp();
     saveWikiText('tagged_page', '{{tag>mytag test2tag}}', 'Test');
     saveWikiText('negative_page', '{{tag>negative_tag mytag}}', 'Test setup');
     saveWikiText('third_page', '{{tag>third_tag}}', 'Test setup');
     idx_addPage('tagged_page');
     idx_addPage('negative_page');
     idx_addPage('third_page');
 }
 /**
  * @covers helper_plugin_move_plan::findAffectedPages
  * @uses Doku_Indexer
  */
 public function test_affectedPagesNS_Media()
 {
     saveWikiText('oldns:start', '{{oldnsimage_missing.png}}', 'setup');
     idx_addPage('oldns:start');
     /** @var helper_plugin_move_plan $plan */
     $plan = plugin_load('helper', 'move_plan');
     $this->assertFalse($plan->inProgress());
     $plan->addMediaNamespaceMove('oldns', 'newns');
     $plan->commit();
     $affected_file = file(TMP_DIR . '/data/meta/__move_affected');
     $this->assertSame('oldns:start', trim($affected_file[0]));
 }
예제 #10
0
 /**
  * @covers action_plugin_move_rename::renameOkay
  */
 function test_renameOkay()
 {
     global $conf;
     global $USERINFO;
     $conf['superuser'] = '******';
     $_SERVER['REMOTE_USER'] = '******';
     $USERINFO['grps'] = array('admin', 'user');
     saveWikiText('wiki:foo:start', '[[..:..:one_ns_up:]]', 'Test setup');
     idx_addPage('wiki:foo:start');
     $move_rename = new action_plugin_move_rename();
     $this->assertTrue($move_rename->renameOkay('wiki:foo:start'));
 }
 public function setUp()
 {
     $this->pluginsEnabled[] = 'include';
     parent::setUp();
     $this->helper = plugin_load('helper', 'include');
     saveWikiText('included', 'Example content with link [[#jump]]', 'Test setup');
     idx_addPage('test:included');
     saveWikiText('test:includefull', '{{page>..:included}}', 'Test setup');
     idx_addPage('test:includefull');
     saveWikiText('test:includefirst', '{{page>..:included&firstseconly}}', 'Test setup');
     idx_addPage('test:includefirst');
 }
예제 #12
0
 public function setUp()
 {
     global $conf;
     $this->pluginsEnabled[] = 'tag';
     parent::setUp();
     $conf['plugin']['tag']['sortkey'] = 'ns';
     $this->helper = plugin_load('helper', 'tag');
     foreach ($this->pages as $page) {
         saveWikiText($page, '{{tag>mytag}}', 'Test');
         idx_addPage($page);
     }
 }
 public function test_rename()
 {
     /** @var $move helper_plugin_move_op */
     $move = plugin_load('helper', 'move_op');
     if (!$move) {
         return;
     }
     // disable the test when move is not installed
     saveWikiText('editx', 'Page to rename', 'Testcase create');
     saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
     idx_addPage('editx');
     idx_addPage('links');
     $this->assertTrue($move->movePage('editx', 'test:edit'));
     $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
 }
    public function setUp()
    {
        $this->pluginsEnabled[] = 'include';
        parent::setUp();
        $this->helper = plugin_load('helper', 'include');
        saveWikiText('wiki:included', <<<EOF
  * [[test|{{dokuwiki.png}}]]
  * [[#test|{{dokuwiki.png?w=200}}]]
  * [[doku>test|{{dokuwiki.png?w=300}}]]
  * [[test|{{https://www.dokuwiki.org/lib/tpl/dokuwiki/images/logo.png}}]]
EOF
, 'Test setup');
        idx_addPage('wiki:included');
        saveWikiText('test:include', '{{page>..:wiki:included}}', 'Test setup');
        idx_addPage('test:include');
    }
예제 #15
0
function _index($id)
{
    global $INDEXER;
    global $CLEAR;
    global $QUIET;
    // if not cleared only update changed and new files
    if ($CLEAR) {
        $idxtag = metaFN($id, '.indexed');
        if (@file_exists($idxtag)) {
            @unlink($idxtag);
        }
    }
    _quietecho("{$id}... ");
    idx_addPage($id, !$QUIET);
    _quietecho("done.\n");
}
 public function test_move_wiki_namespace()
 {
     $this->markTestSkipped('This test is failing.');
     global $AUTH_ACL;
     $AUTH_ACL[] = "wiki:*\t@ALL\t16";
     idx_addPage('wiki:dokuwiki');
     idx_addPage('wiki:syntax');
     /** @var helper_plugin_move $move  */
     $move = plugin_load('helper', 'move');
     $opts = array('ns' => 'wiki', 'newns' => 'foo', 'contenttomove' => 'both');
     $this->assertSame(3, $move->start_namespace_move($opts));
     $this->assertSame(1, $move->continue_namespace_move());
     $this->assertSame(0, $move->continue_namespace_move());
     $this->assertFileExists(wikiFN('foo:dokuwiki'));
     $this->assertFileNotExists(wikiFN('wiki:syntax'));
     $this->assertFileExists(mediaFN('foo:dokuwiki-128.png'));
 }
예제 #17
0
    public function test_rename() {
        global $ID;
        /** @var $pagemove helper_plugin_pagemove */
        $pagemove = plugin_load('helper', 'pagemove');
        if (!$pagemove) return; // disable the test when pagemove is not installed
        saveWikiText('editx', 'Page to rename', 'Testcase create');
        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
        idx_addPage('editx');
        idx_addPage('links');

        $ID = 'editx';
        $opts['ns']      = '';
        $opts['newname'] = 'edit';
        $opts['newns']   = 'test';
        $pagemove->move_page($opts);
        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
    }
예제 #18
0
 function test_topic_tag()
 {
     saveWikiText('tagged_page', '{{tag>mytag test2tag}}', 'Test');
     saveWikiText('topic_page', '{{topic>mytag}}' . DOKU_LF . DOKU_LF . '{{tag>topictag mytag}}' . DOKU_LF, 'Test');
     idx_addPage('topic_page');
     idx_addPage('tagged_page');
     $this->assertContains('tag:topictag', p_wiki_xhtml('topic_page'), 'Page with tag syntax doesn\'t contain tag output');
     $this->assertNotContains('tag:test2tag', p_wiki_xhtml('topic_page'), 'Page with tag and topic syntax tag which is listed in a page that is listed in the topic syntax but not on the page itself');
     $this->assertContains('topic_page', p_wiki_xhtml('topic_page'), 'Page with topic and tag syntax doesn\'t list itself in the topic syntax');
     $this->assertContains('tagged_page', p_wiki_xhtml('topic_page'), 'Page with topic syntax doesn\'t list matching page');
     $this->assertContains('tag:mytag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax doesn\'t contain tag output');
     $this->assertContains('tag:test2tag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax doesn\'t contain tag output');
     $this->assertNotContains('tag:topictag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax contains tag from a page in which it is listed in the topic syntax');
     saveWikiText('tagged_page', '{{tag>test2tag}}', 'Deleted mytag');
     $this->assertNotContains('tagged_page', p_wiki_xhtml('topic_page'), 'Page that no longer contains the tag is still listed in the topic syntax (caching problems?)');
     $this->assertNotContains('tag:mytag', p_wiki_xhtml('tagged_page'), 'Removed tag is still listed in XHTML output');
 }
예제 #19
0
 public function test_safeindex()
 {
     global $conf;
     global $AUTH_ACL;
     $conf['superuser'] = '******';
     $conf['useacl'] = 1;
     $AUTH_ACL = array('*           @ALL           0', '*           @user          8', 'public      @ALL           1');
     $_SERVER['REMOTE_USER'] = '******';
     saveWikiText('parent', "{{page>child}}\n\n[[public_link]]\n\n{{page>public}}", 'Test parent created');
     saveWikiText('child', "[[foo:private]]", 'Test child created');
     saveWikiText('public', "[[foo:public]]", 'Public page created');
     idx_addPage('parent');
     idx_addPage('child');
     idx_addPage('public');
     $this->assertEquals(array('parent', 'public'), ft_backlinks('foo:public'));
     $this->assertEquals(array('child'), ft_backlinks('foo:private'));
     $this->assertEquals(array('parent'), ft_backlinks('public_link'));
 }
 /**
  * @group slow
  */
 public function test_moveSingleMedia_colonstart()
 {
     global $AUTH_ACL;
     $AUTH_ACL[] = "wiki:*\t@ALL\t16";
     $AUTH_ACL[] = "foobar:*\t@ALL\t8";
     $filepath = DOKU_TMP_DATA . 'media/wiki/testimage.png';
     io_makeFileDir($filepath);
     io_saveFile($filepath, '');
     saveWikiText('wiki:movetest', '{{:wiki:testimage.png?200}}', 'Test initialized');
     idx_addPage('wiki:movetest');
     $src = 'wiki:testimage.png';
     $dst = 'foobar:logo_2.png';
     /** @var helper_plugin_move_op $move */
     $move = plugin_load('helper', 'move_op');
     $this->assertTrue($move->moveMedia($src, $dst));
     $this->assertTrue(@file_exists(mediaFn('foobar:logo_2.png')));
     $this->assertEquals('{{:foobar:logo_2.png?200}}', rawWiki('wiki:movetest'));
 }
예제 #21
0
 function test_meta_rename_to_existing_value()
 {
     $this->indexer->addMetaKeys($this->old_id, array('mkey' => array('old_value', 'new_value')));
     saveWikiText('newvalue', 'Test page', '');
     idx_addPage('newvalue');
     $this->indexer->addMetaKeys('newvalue', array('mkey' => array('new_value')));
     saveWikiText('oldvalue', 'Test page', '');
     idx_addPage('oldvalue');
     $this->indexer->addMetaKeys('oldvalue', array('mkey' => array('old_value')));
     $this->assertTrue($this->indexer->renameMetaValue('mkey', 'old_value', 'new_value'), 'Meta value rename to existing value failed');
     $query = 'old_value';
     $this->assertEquals(array(), $this->indexer->lookupKey('mkey', $query), 'Page can still be found under old value.');
     $query = 'new_value';
     $result = $this->indexer->lookupKey('mkey', $query);
     $this->assertContains($this->old_id, $result, 'Page with both values can\'t be found anymore');
     $this->assertContains('newvalue', $result, 'Page with new value can\'t be found anymore');
     $this->assertContains('oldvalue', $result, 'Page with only the old value can\'t be found anymore');
 }
 /**
  * @group slow
  */
 function test_cache_handling()
 {
     $testid = 'wiki:bar:test';
     saveWikiText($testid, '[[wiki:foo:]]', 'Test setup');
     idx_addPage($testid);
     saveWikiText('wiki:foo:start', 'bar', 'Test setup');
     idx_addPage('wiki:foo:start');
     sleep(1);
     // wait in order to make sure that conditions with < give the right result.
     p_wiki_xhtml($testid);
     // populate cache
     $cache = new cache_renderer($testid, wikiFN($testid), 'xhtml');
     $this->assertTrue($cache->useCache());
     /** @var helper_plugin_move_op $move */
     $move = plugin_load('helper', 'move_op');
     $this->assertTrue($move->movePage('wiki:foo:start', 'wiki:foo2:start'));
     $cache = new cache_renderer($testid, wikiFN($testid), 'xhtml');
     $this->assertFalse($cache->useCache());
 }
 /**
  * @dataProvider dataPages
  */
 public function test_PageDeleteSuccessful($id, $new_id, $pages)
 {
     $GLOBALS['INPUT']->server->set('REMOTE_USER', 'testuser');
     foreach ($pages as $page) {
         saveWikiText($page['id'], $page['content'], $page['summary']);
         idx_addPage($page['id']);
     }
     $json = $this->doCall($id, $new_id, 'testuser');
     $this->assertInstanceOf('\\stdClass', $json);
     $this->assertObjectHasAttribute('error', $json);
     $this->assertFalse($json->error);
     //check page deleted
     $this->assertFalse(file_exists(wikiFN($id)));
     //check foreign pages
     foreach ($pages as $page) {
         if ($page['id'] == $id) {
             continue;
             // skip main. it was deleted
         }
         $this->assertEquals(!empty($page['new_content']) ? $page['new_content'] : $page['content'], rawWiki($page['id']));
     }
 }
예제 #24
0
    public function test_moveSingleMedia() {
        global $AUTH_ACL;

        $AUTH_ACL[] = "wiki:*\t@ALL\t16";
        $AUTH_ACL[] = "foobar:*\t@ALL\t8";

        saveWikiText('wiki:movetest', '{{wiki:dokuwiki-128.png?200}}', 'Test initialized');
        idx_addPage('wiki:movetest');

        $opts = array();
        $opts['ns'] = 'wiki';
        $opts['name'] = 'dokuwiki-128.png';
        $opts['newns'] = 'foobar';
        $opts['newname'] = 'logo.png';

        /** @var helper_plugin_move $move */
        $move = plugin_load('helper', 'move');
        $this->assertTrue($move->move_media($opts));

        $this->assertTrue(@file_exists(mediaFn('foobar:logo.png')));

        $this->assertEquals('{{foobar:logo.png?200}}', rawWiki('wiki:movetest'));
    }
예제 #25
0
/**
 * Runs the indexer for the current page
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function runIndexer()
{
    global $ID;
    global $conf;
    print "runIndexer(): started" . NL;
    if (!$ID) {
        return false;
    }
    // do the work
    return idx_addPage($ID, true);
}
예제 #26
0
 /**
  * Save a wiki page
  *
  * @author Michael Klier <*****@*****.**>
  */
 function putPage($id, $text, $params)
 {
     global $TEXT;
     global $lang;
     $id = $this->resolvePageId($id);
     $TEXT = cleanText($text);
     $sum = $params['sum'];
     $minor = $params['minor'];
     if (empty($id)) {
         throw new RemoteException('Empty page ID', 131);
     }
     if (!page_exists($id) && trim($TEXT) == '') {
         throw new RemoteException('Refusing to write an empty new wiki page', 132);
     }
     if (auth_quickaclcheck($id) < AUTH_EDIT) {
         throw new RemoteAccessDeniedException('You are not allowed to edit this page', 112);
     }
     // Check, if page is locked
     if (checklock($id)) {
         throw new RemoteException('The page is currently locked', 133);
     }
     // SPAM check
     if (checkwordblock()) {
         throw new RemoteException('Positive wordblock check', 134);
     }
     // autoset summary on new pages
     if (!page_exists($id) && empty($sum)) {
         $sum = $lang['created'];
     }
     // autoset summary on deleted pages
     if (page_exists($id) && empty($TEXT) && empty($sum)) {
         $sum = $lang['deleted'];
     }
     lock($id);
     saveWikiText($id, $TEXT, $sum, $minor);
     unlock($id);
     // run the indexer if page wasn't indexed yet
     idx_addPage($id);
     return 0;
 }
예제 #27
0
 /**
  * Save a wiki page
  *
  * @author Michael Klier <*****@*****.**>
  */
 function putPage($id, $text, $params)
 {
     global $TEXT;
     global $lang;
     global $conf;
     $id = cleanID($id);
     $TEXT = cleanText($text);
     $sum = $params['sum'];
     $minor = $params['minor'];
     if (empty($id)) {
         return new IXR_Error(1, 'Empty page ID');
     }
     if (!page_exists($id) && trim($TEXT) == '') {
         return new IXR_ERROR(1, 'Refusing to write an empty new wiki page');
     }
     if (auth_quickaclcheck($id) < AUTH_EDIT) {
         return new IXR_Error(1, 'You are not allowed to edit this page');
     }
     // Check, if page is locked
     if (checklock($id)) {
         return new IXR_Error(1, 'The page is currently locked');
     }
     // SPAM check
     if (checkwordblock()) {
         return new IXR_Error(1, 'Positive wordblock check');
     }
     // autoset summary on new pages
     if (!page_exists($id) && empty($sum)) {
         $sum = $lang['created'];
     }
     // autoset summary on deleted pages
     if (page_exists($id) && empty($TEXT) && empty($sum)) {
         $sum = $lang['deleted'];
     }
     lock($id);
     saveWikiText($id, $TEXT, $sum, $minor);
     unlock($id);
     // run the indexer if page wasn't indexed yet
     if (!@file_exists(metaFN($id, '.indexed'))) {
         // try to aquire a lock
         $lock = $conf['lockdir'] . '/_indexer.lock';
         while (!@mkdir($lock, $conf['dmode'])) {
             usleep(50);
             if (time() - @filemtime($lock) > 60 * 5) {
                 // looks like a stale lock - remove it
                 @rmdir($lock);
             } else {
                 return false;
             }
         }
         if ($conf['dperm']) {
             chmod($lock, $conf['dperm']);
         }
         // do the work
         idx_addPage($id);
         // we're finished - save and free lock
         io_saveFile(metaFN($id, '.indexed'), INDEXER_VERSION);
         @rmdir($lock);
     }
     return 0;
 }
예제 #28
0
 /**
  * Index the given page
  *
  * @param string $id
  */
 function index($id) {
     $this->quietecho("$id... ");
     idx_addPage($id, !$this->quiet, $this->force);
     $this->quietecho("done.\n");
 }
예제 #29
0
파일: indexer.php 프로젝트: lorea/Hydra-dev
/**
 * Runs the indexer for the current page
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function runIndexer()
{
    global $ID;
    global $conf;
    print "runIndexer(): started" . NL;
    // Move index files (if needed)
    // Uses the importoldindex plugin to upgrade the index automatically.
    // FIXME: Remove this from runIndexer when it is no longer needed.
    if (@file_exists($conf['cachedir'] . '/page.idx') && (!@file_exists($conf['indexdir'] . '/page.idx') || !filesize($conf['indexdir'] . '/page.idx')) && !@file_exists($conf['indexdir'] . '/index_importing')) {
        echo "trigger TEMPORARY_INDEX_UPGRADE_EVENT\n";
        $tmp = array();
        // no event data
        trigger_event('TEMPORARY_INDEX_UPGRADE_EVENT', $tmp);
    }
    if (!$ID) {
        return false;
    }
    // check if indexing needed
    $idxtag = metaFN($ID, '.indexed');
    if (@file_exists($idxtag)) {
        if (io_readFile($idxtag) >= INDEXER_VERSION) {
            $last = @filemtime($idxtag);
            if ($last > @filemtime(wikiFN($ID))) {
                print "runIndexer(): index for {$ID} up to date" . NL;
                return false;
            }
        }
    }
    // try to aquire a lock
    $lock = $conf['lockdir'] . '/_indexer.lock';
    while (!@mkdir($lock, $conf['dmode'])) {
        usleep(50);
        if (time() - @filemtime($lock) > 60 * 5) {
            // looks like a stale lock - remove it
            @rmdir($lock);
            print "runIndexer(): stale lock removed" . NL;
        } else {
            print "runIndexer(): indexer locked" . NL;
            return false;
        }
    }
    if ($conf['dperm']) {
        chmod($lock, $conf['dperm']);
    }
    require_once DOKU_INC . 'inc/indexer.php';
    // upgrade to version 2
    if (!@file_exists($conf['indexdir'] . '/pageword.idx')) {
        idx_upgradePageWords();
    }
    // do the work
    idx_addPage($ID);
    // we're finished - save and free lock
    io_saveFile(metaFN($ID, '.indexed'), INDEXER_VERSION);
    @rmdir($lock);
    print "runIndexer(): finished" . NL;
    return true;
}
예제 #30
0
 /**
  * Save a wiki page
  *
  * @author Michael Klier <*****@*****.**>
  */
 function putPage($id, $text, $params)
 {
     global $TEXT;
     global $lang;
     global $conf;
     $id = cleanID($id);
     $TEXT = cleanText($text);
     $sum = $params['sum'];
     $minor = $params['minor'];
     if (empty($id)) {
         return new IXR_Error(1, 'Empty page ID');
     }
     if (!page_exists($id) && trim($TEXT) == '') {
         return new IXR_ERROR(1, 'Refusing to write an empty new wiki page');
     }
     if (auth_quickaclcheck($id) < AUTH_EDIT) {
         return new IXR_Error(1, 'You are not allowed to edit this page');
     }
     // Check, if page is locked
     if (checklock($id)) {
         return new IXR_Error(1, 'The page is currently locked');
     }
     // SPAM check
     if (checkwordblock()) {
         return new IXR_Error(1, 'Positive wordblock check');
     }
     // autoset summary on new pages
     if (!page_exists($id) && empty($sum)) {
         $sum = $lang['created'];
     }
     // autoset summary on deleted pages
     if (page_exists($id) && empty($TEXT) && empty($sum)) {
         $sum = $lang['deleted'];
     }
     lock($id);
     saveWikiText($id, $TEXT, $sum, $minor);
     unlock($id);
     // run the indexer if page wasn't indexed yet
     idx_addPage($id);
     return 0;
 }