We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I’m trying to get a new package out for SPForm, but the install script (php resolver) isn’t working. It looks like this is the problem code and that XPDO_TRANSPORT_PACKAGE_ACTION is not a recognized option. Does it have a new name or is there a new way of determining the action?

    switch($options[XPDO_TRANSPORT_PACKAGE_ACTION]) {
    
    }
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 26903
      • 1,336 Posts
      These older style constants have been reimplemented as class constants in the transition to to PHP 5, so we now have this for example :-
      xPDOTransport::PRESERVE_KEYS
      so your constant above is probably
      xPDOTransport::PACKAGE_ACTION
      now.
        Use MODx, or the cat gets it!
        • 3749
        • 24,544 Posts
        Thanks, I think that did it.

        Anything else that needs changing besides the constants?
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 26903
          • 1,336 Posts
          As far as I can recall no, I did these constant changes to the build script for provisioner, other than that it seemed Ok.
            Use MODx, or the cat gets it!
            • 28215
            • 4,149 Posts
            The only breaking changes are the class constants. You’ll just need to rebuild your package with a beta5+ Revo install.
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 3749
              • 24,544 Posts
              I’ve got the install working, but uninstall leaves all snippets and chunks untouched (everything else is removed properly).

              Not sure where to look -- there are no errors in the uninstall script or the error log.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: BobRay at Jan 13, 2010, 11:13 AM

                I’ve got the install working, but uninstall leaves all snippets and chunks untouched (everything else is removed properly).

                Not sure where to look -- there are no errors in the uninstall script or the error log.
                That’s expected if they existed before the installation was executed; this is what the preserve/remove/restore options are for when uninstall is selected.
                  • 3749
                  • 24,544 Posts
                  Quote from: OpenGeek at Jan 13, 2010, 11:16 AM

                  Quote from: BobRay at Jan 13, 2010, 11:13 AM

                  I’ve got the install working, but uninstall leaves all snippets and chunks untouched (everything else is removed properly).

                  Not sure where to look -- there are no errors in the uninstall script or the error log.
                  That’s expected if they existed before the installation was executed; this is what the preserve/remove/restore options are for when uninstall is selected.

                  No, I made sure everything was gone before the install and then removed the package and verified that all package files were gone. There’s no mention of snippets or chunks in the console during uninstall.

                  I did get these errors during the install:

                  Workspace environment initiated, now installing package...

                  Attempting to preserve files at C:/xampp/htdocs/test2/assets/components/ into archive C:/xampp/htdocs/test2/core/packages/spform-3.0.9-beta1/modCategory/4ac7532ba6974986349ace7ade3f2f7a.0.preserved.zip

                  Error packing C:/xampp/htdocs/test2/assets/components/spform to C:/xampp/htdocs/test2/core/packages/spform-3.0.9-beta1/modCategory/4ac7532ba6974986349ace7ade3f2f7a.0.preserved.zipPCLZIP_ERR_MISSING_FILE (-4) : File ’/xampp/htdocs/test2/assets/components/spform’ does not exists

                  Attempting to preserve files at C:/xampp/htdocs/test2/core/components/ into archive C:/xampp/htdocs/test2/core/packages/spform-3.0.9-beta1/modCategory/4ac7532ba6974986349ace7ade3f2f7a.1.preserved.zip

                  Error packing C:/xampp/htdocs/test2/core/components/spform to C:/xampp/htdocs/test2/core/packages/spform-3.0.9-beta1/modCategory/4ac7532ba6974986349ace7ade3f2f7a.1.preserved.zipPCLZIP_ERR_MISSING_FILE (-4) : File ’/xampp/htdocs/test2/core/components/spform’ does not exists
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 3749
                    • 24,544 Posts
                    This has me stumped.

                    If I install and uninstall Wayfinder, it removes the snippet and the console shows:

                    Removed modSnippet instance with primary key 16


                    If I install and uninstall SPForm, no snippets or chunks are removed and there are no "Removed" messages for them in the console.

                    I don’t see any differences in the build.transport scripts other than the fact that the SPForm snippets and chunks are in a category:

                    /* create category */
                    $attr = array(
                        xPDOTransport::UNIQUE_KEY => 'category',
                        xPDOTransport::PRESERVE_KEYS => false,
                        xPDOTransport::UPDATE_OBJECT => true,
                        xPDOTransport::RELATED_OBJECTS => true,
                        xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
                            'Snippets' => array (
                                xPDOTransport::PRESERVE_KEYS => false,
                                xPDOTransport::UPDATE_OBJECT => true,
                                xPDOTransport::UNIQUE_KEY => 'name',
                            ),
                            'Chunks' => array (
                                xPDOTransport::PRESERVE_KEYS => false,
                                xPDOTransport::UPDATE_OBJECT => true,
                                xPDOTransport::UNIQUE_KEY => 'name',
                            ),
                        )
                    );
                    $categoryObject= $modx->newObject('modCategory');
                    $categoryObject->set('id',1);
                    $categoryObject->set('category','SPForm');
                    
                    /* add snippets to category */
                    $snippets = require_once $sources['data'].'transport.snippets.php';
                    $categoryObject->addMany($snippets);
                    
                    /* add chunks to category */
                    $chunks = require_once $sources['data'].'transport.chunks.php';
                    $categoryObject->addMany($chunks);
                    
                    /* build category */
                    $vehicle = $builder->createVehicle($categoryObject,$attr);
                    $vehicle->resolve('file',array(
                        'source' => $sources['source_assets'],
                        'target' => "return MODX_ASSETS_PATH . 'components/';",
                    ));
                    $vehicle->resolve('file',array(
                        'source' => $sources['source_core'],
                        'target' => "return MODX_CORE_PATH . 'components/';",
                    ));
                    $builder->putVehicle($vehicle);
                    
                    /* done setting category/snippets/chunks */


                    Here’s the code of transport.snippets.php:

                    $snippets = array();
                    
                    $snippets[1]= $modx->newObject('modSnippet');
                    $snippets[1]->fromArray(array(
                        'id' => 1,
                        'name' => 'SPForm',
                        'description' => 'SPForm '.$package_version.'-'.$package_release
                                .' -  Creates a contact form for your site',
                    ),'',true,true);
                    $snippets[1]->setContent(file_get_contents($sources['source_core'] . '/spform.inc.php'));
                    $properties = include $sources['data'].'properties.spform.php';
                    $snippets[1]->setProperties($properties);
                    unset($properties);
                    
                    
                    $snippets[2]= $modx->newObject('modSnippet');
                    $snippets[2]->fromArray(array(
                        'id' => 2,
                        'name' => 'SPFResponse',
                        'description' => 'SPForm "Thank You" page',
                    ),'',true,true);
                    $snippets[2]->setContent(file_get_contents($sources['source_core'] . '/spfresponse.inc.php'));
                    $properties = include $sources['data'].'properties.spfresponse.php';
                    $snippets[2]->setProperties($properties);
                    unset($properties);
                    
                    return $snippets;


                    On uninstall, the category is removed but the snippets and chunks are not. Is there some change I can make to build.transport.php that will cause them to be removed automatically on uninstall (or is this a bug)?
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 28215
                      • 4,149 Posts
                      BobRay,

                      Is this in SVN? If so, I can take a look at it.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com