[Typo3-dev] $tce->process_cmdmap() causes error

Udo Gerhards Udo.Gerhards at genion.de
Thu Nov 3 12:47:40 CET 2005


Hi list,

i'm very new in developing plugins and modules for typo3. Now i decided
to build a module called "pagearchiver". If it works it should archive
pages to a given date from one pagetree to another.
The developed module works fine but i got one problem. In the function
whicht moves pages from on pagetree to another i'm using the
TCEMain-command-model to make some operations. And here the trouble
begins. The given datamap is processessed as well by TCMAIN but the
given commandmap will not work. It always causes an error when i try to
copy a page from one page to another. Here is the source-code which
sould move / copy the page inside the tree:

...
    function movePage($row)
    {
        $this->rowsaffected++;
        $data = array();
        $cmd = array();
        $overridedata = array();

       
        if ($row['tx_pagearchiver_makecopy'] == 1)
            {
            $cmd['pages'][$row['uid']] = array(
                                           'copy' => (integer)
$row['tx_pagearchiver_archivepid']   // <== just only a single pid from
the page where the site should be moved
                                            );
           
            if ($row['tx_pagearchiver_hidecopy']==1)
                $data['pages'][$row['uid']] = array(
                    'hidden' => $row['tx_pagearchiver_hidecopy']
                    );       
            }
            else
                {
                $cmd['pages'][$row['uid']]['move'] =  (integer)
$row['tx_pagearchiver_archivepid'];
                }
               
        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
        $tce->copyTree = 100;
        $tce->copyWhichTables = "*";
        $tce->stripslashes_values = 0;
        $tce->reverseOrder = 0;

                $overridedata['pages'][$row['uid']] = array(
                               'tx_pagearchiver_archivepage' => 0
                               );

        $tce->start($overridedata,array());
        $tce->process_datamap();
               
        $tce->start($data, $cmd);
        $tce->process_datamap();
        $tce->process_cmdmap();   // <==== The error causes here by
executing this command

                $overridedata['pages'][$row['uid']] = array(
                               'tx_pagearchiver_archivepage' => 1
                               );

        $tce->start($overridedata,array());
        $tce->process_datamap();
        t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
        $tce->clear_cacheCmd('pages');
    }    

... 

Does anyone know how to handle a copy-operation of pages with TCMAIN? I
found no suggestions in the tutorials and describtions around
www.typo3.org which tells me what is going wrong.

Thanks in advance

Udo Gerhards




More information about the TYPO3-dev mailing list