We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40029
    • 52 Posts
    Hello,

    News:

    The project, Revo graphic abstraction (which I discuss a "post" back) continues to track and we're playing a lot with MODx, and from our tables are leaving many "extras", especially: control panels apache. safety and inspection modules with nmap. Virtualmin integration. webmail. and other interesting things, though we know that the project is going beyond a simple CMS, serves us this way. And that our customers can control all these web services, from a single panel.

    For the development of almost all the modules, we are doing some parallel developments to make installable versions for the community, although this modules not specifically designed for web hosting, will be useful for managers of servers, this will be a long year, but very productive.

    Questions:

    1) We are looking for how to make a "private repository" for extras, and if there is some official documentation for proper use.
    2) Can we use modules and "core code" to develop some "extra"?
    especially for error handling and logger.

    Regards.
      Developer of RTOS and Drivers
      Specializes in portability of BSD/Linux
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Core code should never be modified. Use plugins and Custom Manager Pages to add functionality.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40029
        • 52 Posts
        Thanks for your prompt reply.

        My English gets worse over the years, or never was good.

        I was wondering if you can reuse the core code for acess to the error handling and logger, in our "extras".


        Quote from: sottwell at Jul 27, 2012, 12:54 PM
        Core code should never be modified...
        OPSS! This is sharepoint? I thought this was MODx smiley


        Also to L.Torvalds did not like the core team of Android, modify the Linux kernel, but was modified and I think it went very well right?

        Regards.
          Developer of RTOS and Drivers
          Specializes in portability of BSD/Linux
          • 3749
          • 24,544 Posts
          You're strongly discouraged from modifying the core code and it's very seldom necessary because MODX is designed to be extended by creating plugins that hook into MODX system events, and by creating custom snippets, template variables, custom resource classes, and Custom Manager Pages.

          Modifying the core code usually means that your extras will break when the user upgrades MODX (and new versions come out every few months).

          An extra with modified core files will never be approved for the MODX repository (though if the changes are good, they may ultimately be incorporated into the core).

          All that said, MODX is Open Source and you can do whatever you like with it as long as you conform to the GPL license.

          I don't think there's any way at present to have your own repository that could be accessed from Package Manager.

          If you create MODX Transport Packages for your extras, you can let users download the packages to their MODX core/packages directory. They can then use "Search Locally for Packages" in Package Manager and Package Manager will install and uninstall the extras for them. In that case, all you'd need for a private "repository" is a password-protected page with links to the Transport Package .zip files


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 40029
            • 52 Posts
            Quote from: BobRay at Jul 28, 2012, 12:53 AM
            You're strongly discouraged from modifying the core code and it's very seldom necessary because MODX is designed to be extended by creating plugins that hook into MODX system events, and by creating custom snippets, template variables, custom resource classes, and Custom Manager Pages.

            Modifying the core code usually means that your extras will break when the user upgrades MODX (and new versions come out every few months).

            An extra with modified core files will never be approved for the MODX repository (though if the changes are good, they may ultimately be incorporated into the core).

            I totally agree with you, we are NOT doing a fork of "MODx"

            We are creating panels of server management and industrial embedded devices that our group of companies manufactures, so we need to create many panels of administration for our clients and also integrate security and administration server account, telemetry, SNMP, GPIO remote monitoring and many more things.

            And because we already used "MODx" in other service industries, our group of companies develops, we decided to focus on developing within MODx, but taking advantage of much work done with jQuery, mootools and ZK, and these our " extra "tend not to use Extjs, Ext we like but we have a lot of work done and other graphics frameworks and other lenguages, and costs us less work, make abstraction of the core of MODx.
            We need all our work together in a single content management system and we have opted for "MODx".

            For this in another post asking if it was correct to use the core of "Revo" for new projects, or wait for the release of "cloud".
            We want to keep the core unchanged.


            In my 2 previous posts, I wondered if we could use some pieces of kernel code, within our "extra".

            example: all our "extra" make the generation and reading of individual logs files, and to do this we use the "log method" in the "class xpdo." pointing to our files.

            We want to keep the same "log format" of MODx.
            To read our log file, we use a replica of the core code, this code:

                public function process(array $scriptProperties = array()) {
                    
                    
                    $f = $this->modx->getOption(xPDO::OPT_CACHE_PATH).'logs/error.log';
                    $this->logArray['name'] = $f;
                    if (file_exists($f)) {
                        $this->logArray['size'] = round(@filesize($f) / 1000 / 1000,2);
                        if ($this->logArray['size'] > 1) {
                            $this->logArray['log'] = '';
                            $this->logArray['tooLarge'] = true;
                            $this->logArray['size'] .= ' MiB';
                        } else {
                            $this->logArray['log'] = @file_get_contents($f);
                            $this->logArray['tooLarge'] = false;
                        }
                    }
                }
            


            and I wondered if we develop some extra for the community, you can use this code in the "extra" or it goes against the ethics package MODx?




            All that said, MODX is Open Source and you can do whatever you like with it as long as you conform to the GPL license.
            Mine was just a funny phrase. that this ought: not to touch the core.



            I don't think there's any way at present to have your own repository that could be accessed from Package Manager.

            If you create MODX Transport Packages for your extras, you can let users download the packages to their MODX core/packages directory. They can then use "Search Locally for Packages" in Package Manager and Package Manager will install and uninstall the extras for them. In that case, all you'd need for a private "repository" is a password-protected page with links to the Transport Package .zip files
            Of course man! but we do like to have our enterprise repository, and not moving packages around the servers or computers for development.
            We are currently using our gitorious repos, but it would be great being able to take the package manager.

            Regards. [ed. note: rtoskit last edited this post 14 years, 2 months ago.]
              Developer of RTOS and Drivers
              Specializes in portability of BSD/Linux
              • 3749
              • 24,544 Posts
              Can't you just call that public function?

              You can set the log target to anything you want with $modx->setLogTarget();

              If that won't work, you'll have to get a more "official" answer than I can give you on "borrowing" the core code for your extra.


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                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
                • 40029
                • 52 Posts
                Quote from: BobRay at Jul 28, 2012, 06:44 PM
                Can't you just call that public function?

                You can set the log target to anything you want with $modx->setLogTarget();
                ...

                Thanks for reply Bob, yes, is correct use of the method "setTarget",before calling the log method to write a log file.

                We do not have any problem with writing "logs" with the methods of the core, and actually we use this methods (and we love these methods), even though there not used the setTarget.

                We simply took a log level, we do our things in the corresponding thread, as fast as we can without "if" or "switch" with pure "struct indexing"
                and then return the correct level to the log, without altering its target.

                and this is a piece of our code to write logs:

                $log_hashtref[secSYS::DENY]  = array(&$xpdoThread,secSYS::LOG_LEVEL_DENY,'sec_deny.log','deny access');
                $log_hashtref[secSYS::STUDY] = array(&$modxThread,xPDO::LOG_LEVEL_WARN,'sec_activity.log','in first scanning');
                $log_hashtref[secSYS::SCAN]  = array(&$modxThread,xPDO::LOG_LEVEL_INFO,'sec_activity.log','in scanning');
                
                secSYS::regHeuristic(&$tcp_robot,$inr=secSYS::scanAgent(&$tcp_robot));
                $savell = $log_hashtref[$inr][LOG_CLASS_PARENT]->getLogLevel(); 
                
                $log_hashtref[$inr][LOG_CLASS_PARENT]->setLogLevel($log_hashtref[$inr][LOG_LEVEL]); 
                
                $log_hashtref[$inr][LOG_CLASS_PARENT]->log($log_hashtref[$inr][LOG_LEVEL], 
                  "TCP robot: {$tcp_robot[sHandle::IDENTITY]}-{$tcp_robot[sHandle::NAME]}-{$tcp_robot[sHandle::AGENT]} 
                              -> {$log_hashtref[$inr][LOG_MSG]} ", 
                                 array('target'=>'FILE', 
                                       'options' => array('filename' => $log_hashtref[$inr][LOG_NAME],
                                       'filepath' => $log_path )));
                                
                $log_hashtref[$inr][LOG_CLASS_PARENT]->setLogLevel($savell);     
                
                



                our request is:

                For reading our log file we can make a replica of the action "Error log" present in the menu "Reports"?

                Sincerely wanted to have an official reply, if permitted or not, include the code "custom view log file" in an "extra" for the community

                Quote from: BobRay at Jul 28, 2012, 06:44 PM


                If that won't work, you'll have to get a more "official" answer than I can give you on "borrowing" the core code for your extra.

                ...
                MODX info for everyone: http://bobsguides.com/modx.html


                How can one get an official reply?


                Regards.
                  Developer of RTOS and Drivers
                  Specializes in portability of BSD/Linux
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I'm not sure that I understand the problem here. You can do anything you want with your MODx; it's licensed under the GPL.

                  Since the code is OOP, why can't you just create your own class to override or extend the base MODx class you want to modify? Then your add-on would use your class, and the MODx core would remain unmodified. [ed. note: sottwell last edited this post 14 years, 2 months ago.]
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 40029
                    • 52 Posts
                    Thanks for reply sottwel,

                    I think you just not understood us in our first post

                    We take our work very seriously, both as an effort of time and effort to make them economical, whether open source or not.
                    And for this, we asked what can do or cannot do, and we will keep asking.

                    Especially, I am the driving force to promote "extra" to the MODx community and I want to be sure that something we do is politically correct, we want to be part of community development and not just a indipendent developers.

                    We elected to work with MODx.
                    And if MODx, you must do the loop "for", with the variable "$i", we're going to continue with the variable '$i'.

                    is your answer, an official response?

                    Regards.
                      Developer of RTOS and Drivers
                      Specializes in portability of BSD/Linux
                      • 40029
                      • 52 Posts
                      Ops! you change the content when I was giving an answer smiley

                      Quote from: sottwell at Jul 29, 2012, 08:56 AM


                      Since the code is OOP, why can't you just create your own class to override or extend the base MODx class you want to modify? Then your add-on would use your class, and the MODx core would remain unmodified.

                      This is a great answer, and is a response of a good programmer. my congratulations.

                      Sin, which is not what we want to do.

                      We must not modify core, We want grab some pieces of the core and use within our "extra"

                      We not want to use other methods, to read log files, we use the same strategy currently used in the menu MODx, for rendering action "Error log".

                      but instead of showing "error.log" we will show the log files of our "extra"

                      Regards.
                        Developer of RTOS and Drivers
                        Specializes in portability of BSD/Linux