if ($assignmentList[$i]["parent_node"] != $exclusiveParentID) {
                    $tempAssignID = $assignmentList[$i]["id"];
                    $cli->notice('Node assignment [ id: ' . $tempAssignID . ' ] for contentobject [ id: ' . $assignmentList[$i]["contentobject_id"] . '] is duplicated thus will be removed.');
                    $sql = "DELETE FROM eznode_assignment WHERE id = " . $tempAssignID;
                    $result = $db->query($sql);
                    if ($result === false) {
                        $cli->notice('Node assignment [ id: ' . $tempAssignID . ' ] ' . 'could not be removed. Please restore your database from backup and try again.');
                        return;
                    }
                    $deletedCount++;
                }
            }
        }
        if ($deletedCount != 0) {
            $cli->output($deletedCount . ' node assignments have been deleted.');
        } else {
            $cli->output('None of available node assignments has been deleted.');
        }
    }
}
require 'autoload.php';
$script = eZScript::instance(array('description' => "eZ Publish node assignment update script. " . "This script will clean up unused node assignment entries because of bug 15478: " . "node assignment is not removed when removing node from child list", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("", "", array("-q" => "Quiet mode"));
$script->initialize();
// execlude node whose parent_node = 1
$cli = eZCLI::instance();
$cli->output("Start.");
updateNodeAssignment::execute(1);
$cli->output("Done.");
$script->shutdown();
Exemplo n.º 2
0
                    $sql = "DELETE FROM eznode_assignment WHERE id = " . $tempAssignID;
                    $result = $db->query($sql);
                    if ($result === false) {
                        $cli->notice('Node assignment [ id: ' . $tempAssignID . ' ] ' . 'could not be removed. Please restore your database from backup and try again.');
                        return;
                    }
                    $deletedCount++;
                }
            }
        }
        if (!$quiet) {
            if ($deletedCount != 0) {
                $cli->notice($deletedCount . ' node assignments have been deleted.');
            } else {
                $cli->notice('None of available node assignments has been deleted.');
            }
        }
    }
}
require 'autoload.php';
$script = eZScript::instance(array('description' => "eZ Publish node assignment update script. " . "This script will clean up unused node assignment entries because of bug 15478: " . "node assignment is not removed when removing node from child list", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("", "", array("-q" => "Quiet mode"));
$script->initialize();
$quiet = $script->isQuiet();
// execlude node whose parent_node = 1
$cli = eZCLI::instance();
$cli->notice("Start.");
updateNodeAssignment::execute($quiet, 1);
$cli->notice("Done.");
$script->shutdown();