We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44665
    • 60 Posts
    sebastian-marinescu Reply #1, 8 years, 3 months ago
    Hi MODx-Community,

    I'm currently working on my first transport-package. I stumbled upon the issue of not being able to use uppercase characters in the package-name.

    OpenGeek wrote almost two years ago, that only
    [a-z0-9_]
    work. See the forum-post.

    But in the Package-Manager I see other packages using uppercase characters in the name.
    Also when I look into the modx_transport_packages table, I see the column package_name,
    where the more readable names are stored.

    How do I add a more readable name to my own package?

    $modx->loadClass('transport.modPackageBuilder','',false, true);
    $builder = new modPackageBuilder($modx);
    $builder->createPackage(PKG_NAME,PKG_VERSION,PKG_RELEASE);
    $builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/');
    $builder->package->name = "Better Name"; // I tried this with no success
    


    Thanks in advance for any answer.

    With kind regards,
    Sebastian

    This question has been answered by BobRay. See the first response.

    [ed. note: sebastian-marinescu last edited this post 8 years, 3 months ago.]
    • discuss.answer
      • 3749
      • 24,544 Posts
      Above the code you have:

      define('PKG_NAME', 'MyPackage');
      define('PKG_NAME_LOWER', 'mypackage');



      etc.

      BTW, during testing, if you install the package locally with "Search Locally for Packages" in Package Manager, you'll see the lowercase name (not sure why). When the package is installed through the MODX repo, though, it will show as mixed case.
        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
        • 44665
        • 60 Posts
        sebastian-marinescu Reply #3, 8 years, 3 months ago
        Quote from: BobRay at Dec 03, 2015, 10:53 PM
        BTW, during testing, if you install the package locally with "Search Locally for Packages" in Package Manager, you'll see the lowercase name (not sure why). When the package is installed through the MODX repo, though, it will show as mixed case.

        Thank you very much. This is information helped me calm it down.
        I also tested to install via a Package-Provider and you were right - it showed the Pascal-Case name smiley [ed. note: sebastian-marinescu last edited this post 8 years, 3 months ago.]
          • 3749
          • 24,544 Posts
          It drove me nuts too, until someone told me what I told you. wink
            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
            • 44665
            • 60 Posts
            sebastian-marinescu Reply #5, 8 years, 3 months ago
            Yeah laugh

            But it's a pitty it doesn't behave exactly the same in both cases. And also that this information isn't documented anywhere smiley
              • 3749
              • 24,544 Posts
              It should be easy enough to fix, but I haven't found the code yet.

              BTW, I strongly suggest that you avoid package names containing spaces, underscores, or hyphens.
                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
                • 44665
                • 60 Posts
                sebastian-marinescu Reply #7, 8 years, 3 months ago
                Quote from: BobRay at Dec 16, 2015, 04:25 AM
                It should be easy enough to fix, but I haven't found the code yet.

                BTW, I strongly suggest that you avoid package names containing spaces, underscores, or hyphens.

                Thanks for the suggestion - I already found out the empiric way laugh

                Maybe it has something to do with modPackageBuilder::createPackage? I know I've also been trying around, but hadn't got it working locally.