We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8895
    • 76 Posts
    hi fellow modx fans!

    im making a snippet/module backup and restore module for modx 0.9.6

    ive got my backup running smoothly and im pleased with that, what it does is to backup multiple generations of all the modules and snippets into separate tables - now i started coding the restore module (separately to avoid any interaction with the backup script) but i get some strange results huh

    i have a form to choose wheather to restore a snippet or module:
    <form enctype="multipart/form-data" action="" method="POST">
    	<input name="mod" type="checkbox" /> Modules
    	<input name="snip" type="checkbox" /> Snippets
    	<input type="submit" name="submit" value="Show" />
    </form>
    


    when submitted a list of all the backups shows as it should.
    db query for the modules:
    $modx->db->select("backup_id, timestamp, id, name", "backup_resources_modules", "id >= 0 ORDER BY backup_id DESC");
    


    take note i dont even select the actual code, the list shows nicely - in the list i have a further form to actually restore the chosen module:
    <form enctype="multipart/form-data" action="" method="POST">
    	<input name="backup_id" type="hidden" value="'.$rows[$row][backup_id].'" />
    	<input name="id" type="hidden" value="'.$rows[$row][id].'" />
    	<input name="restore" type="hidden" value="modules" />
    	<input type="submit" name="submit" value="Restore" />
    </form>
    


    the funny thing now is, when i submit this form (even though its action is not catched) the actual module is shown, i can even try actually catching this post, but it doesnt get caught - any idea why this happenes? undecided


    the next part, restoring the snippets...
    the first form matched the one shown above, the db query looks like this:
    $modx->db->select("backup_id, timestamp, id, name", "backup_resources_snippets", "id >= 0 ORDER BY backup_id DESC");
    


    the list again gets shown nicely cool the form for the position here looks like this:
    <form enctype="multipart/form-data" action="" method="POST">
    	<input name="backup_id" type="hidden" value="'.$rows[$row][backup_id].'" />
    	<input name="id" type="hidden" value="'.$rows[$row][id].'" />
    	<input name="restore" type="hidden" value="snippets" />
    	<input type="submit" name="submit" value="Restore" />
    </form>
    


    but here when i submit i get a message box telling me that the id X does not exist huh

    can someone help me out here?? im starting to flip, already spent 2 days on this huh