-1

I need simple php code for deleting children objects in ez publish 5, i'm trying to create cron job file and delete objects in ez publish where created date is leess then "x" hour , in my case it is 24 hour. if some have had wrote this code before, please share it me too, it would be very helpful for me.

Best regards :)

i trying  this  but not working and crack database:


#!/usr/bin/env php
<?php

include_once( 'ezpublish_legacy/kernel/classes/ezcontentobjecttreenode.php' );
include_once( 'ezpublish_legacy/kernel/classes/ezcontentobject.php' );
include_once( 'ezpublish_legacy/kernel/classes/datatypes/ezuser/ezuser.php' );
include_once( 'ezpublish_legacy/lib/ezutils/classes/ezcli.php' );
include_once( 'ezpublish_legacy/kernel/classes/ezscript.php' );

$cli =& eZCLI::instance();
$script =& eZScript::instance();

$script->startup();

$script->initialize();

/**
 * @param array $classID
 * @param int $parentNodeID
 * @param int $depth
 * @param string $login
 * @param string $password
 */
function &deleteNodes ( $classID, $parentNodeID, $depth, $login, $password )
{
    eZUser::loginUser( $login, $password );

    $deleteIDArray = array();

    $nodeArray =& eZContentObjectTreeNode::subTree(  array(
        'ClassFilterType' => 'include',
        'ClassFilterArray' => $classID,
        'Depth' => $depth,
    ), $parentNodeID
    );
    foreach ( $nodeArray as $node )
    {
        $deleteIDArray[] = $node->attribute( 'main_node_id' );
    }

    eZContentObjectTreeNode::removeSubtrees( $deleteIDArray, false );
}

deleteNodes ( array( 230 ), 336, 1, 'admin', 'publish' );

$script->shutdown();
?>
  • 2
    let me share some info with you, we don't code for free, you have a problem with your code we help you, we don't code, better hire a developer – madalinivascu Nov 06 '17 at 08:06
  • i need sample of code , i think it is not a hard for users here and i think it is help! – AnonymousGE Nov 06 '17 at 08:08
  • if you think that i need write full code for me then you are on the wrong way, i need example or links for tutorial where is explaining how it must done. – AnonymousGE Nov 06 '17 at 08:10
  • We like to see what you've tried to code first in an attempt to solve the problem. – Scuzzy Nov 06 '17 at 08:14
  • 1
    I edited my question and add sample of code what i'm trying to do but it's not working – AnonymousGE Nov 06 '17 at 08:19
  • Asking for a sample or links to a tutorial is off-topic for this site. Please see [**How do I ask a good question?**](https://stackoverflow.com/help/how-to-ask) and [**What topics can I ask about here?**](https://stackoverflow.com/help/on-topic). – Alex Howansky Nov 06 '17 at 15:09

1 Answers1

0

This question is closed, i do not get here clear answer and did it with to myself. i get only -1 for this question lol

Anonymouse
  • 19
  • 5