View Revisions: Note 2738

Summary 1194: The power of Commandr
Revision 2015-04-29 10:53 by Guest
Note The power of Commandr

Commandr, The built-in Command-Line Environment in Composr can be used for
performing quick tasks which can be otherwise more time consuming from a GUI
alternative,
Commandr can be accessed from the 'tools' section in Admin-zone,
In this tutorial we will show you some of the quick tasks which can be
performed efficiently using Commandr

1) Quick DB Querying -
    Just like you'd run a query from system command line you can use Commandr
to achieve the same result, below is an example,
screenshot1: Commandr1
    @SELECT id FROM cms_f_members WHERE m_username='admin';

    Nothing different from a normal SQL query, go ahead and try a SQL query
of your own in Commandr
     
      2) Quick function search-
    It can get quite hectic to search for a particular function in a big
application where there are probably thousands of functions in use,
Commandr comes with a built-in command feature to make your job easy,
you can simply use the command find_function which accepts one string
parameter name of the function

    eg: find_function require_code //will display the require_code function
info

    You can also check out the find_codes command which is similar to
find_function, it can help you to quickly search for a code or part of code
in the source files,
 
      3) Open page links on the go -
    You might often want to quickly test a newly modified page link or just
any random page but that'd mean you have to open a new tab window and then
manually enter the whole URL, Commandr comes with a powerful command feature
call , which can open up a page for you on the go, just in a single line
and a page name as the only parameter,

    eg: call cms //opens up the start page for cms in a new window
        

     
     4) Upgrade your database with a single line of code-
    Upgrading the database is important to keep up with the latest updates and security features, but this task can be time consuming. Commandr comes with a buil in command for doing this task efficiently and in a single line of code, the database_upgrade command,
    eg: database_upgrade
    As you might have guessed the command takes no parameters
    
     5) Administration Tools-
    Apart from the support for native command line commands, Commandr can also help you do some basic administrative tasks in the system, here are some useful commands,
    a) whois – This command can be used to quickly find out a user's details such as his/her member ID, Username, and IP address, this command takes either a username or the member ID of the user as Identifying information
               eg: whois 2 //2 is the member ID
    b) ban_member – You can use this command in Composr Forums to ban a specific member using his/her username or password
                  eg: ban_member johnDoe
    c) give – This command is useful to give points to a member, command takes 3 parameters, Member Id/Username, Number of points, and Reason for the gift points respectively, you can also send it anonymously using the -a flag, usage is show below,
            eg: give -a 2 20 'free points on new registration' //anonymous gift using -a flag
    d) passwd – This command works pretty much like the native linux command of the same name, it will help you change the password of a forum member using his/her username or Member ID,
            eg: passwd -u johnDoe newpassword

       
       
     6) Some other useful commands -
      a) cpdir : Use this command to quickly copy a directory to a different place, it performs a recursive copy of the enitre direcory,
        eg: cpdir /path/to/mydir /path/to/new/mydir //directory mydir will be copied to new directory
      b) directory_sizes: This command can come handy to quickly find out
the size of any directory within the Composr
system, it will output a nice
formatted list of all the directories for you, go ahead and try it
screenshot2:Commandr2
      c) mysql_table_sizes: This command is similar to directory_sizes, it
will output a tabular list of all the
database tables within Composr with their
respective size
     d) clear_cache: Caching in an important functionality in an application to remember the data for reuse however while testing new changes you might want to clear the already cached values, you can use clear_cache to clear all the caches immediately or even better only delete specific caches by passing A comma-separated list of the caches to clear as parameter,
  eg: clear_caches comcode_pages,templates
 
       5) Power of PHP -
    You can run almost any PHP code or function from Commandr, this can be
useful for quickly testing small code snippets or functions, below are some
simple examples,

    :echo file_get_contents('/proc/cpuinfo'); //This shows info about the
server's CPU
screenshot3:Commandr3
    :echo shell_exec('uptime'); //This shows the server CPU load, and works
on Linux and Mac servers
    
    Please note that the leading ':' is needed for Commandr to identify that
the input's going to be something in PHP

    Apart from the above commands, there are many other native Linux
commands available in Commandr like, grep, cp or mv. You can explore
more using the command 'commands' , which will list all the available
commands within Commandr.
You can also find help information about any command by simply using the -h or help flag like this, grep -h or help grep,

Revision 2015-04-29 10:33 by Guest
Note The power of Commandr

Commandr, The built-in Command-Line Environment in Composr can be used for
performing quick tasks which can be otherwise more time consuming from a GUI
alternative,
Commandr can be accessed from the 'tools' section in Admin-zone,
In this tutorial we will show you some of the quick tasks which can be
performed efficiently using Commandr

1) Quick DB Querying -
    Just like you'd run a query from system command line you can use Commandr
to achieve the same result, below is an example,

    @SELECT id FROM cms_f_members WHERE m_username='admin';

    Nothing different from a normal SQL query, go ahead and try a SQL query
of your own in Commandr
     
      2) Quick function search-
    It can get quite hectic to search for a particular function in a big
application where there are probably thousands of functions in use,
Commandr comes with a built-in command feature to make your job easy,
you can simply use the command find_function which accepts one string
parameter name of the function

    eg: find_function require_code //will display the require_code function
info

    You can also check out the find_codes command which is similar to
find_function, it can help you to quickly search for a code or part of code
in the source files,
 
      3) Open page links on the go -
    You might often want to quickly test a newly modified page link or just
any random page but that'd mean you have to open a new tab window and then
manually enter the whole URL, Commandr comes with a powerful command feature
call , which can open up a page for you on the go, just in a single line
and a page name as the only parameter,

    eg: call cms //opens up the start page for cms in a new window
        

     
     4) Upgrade your database with a single line of code-
    Upgrading the database is important to keep up with the latest updates and security features, but this task can be time consuming. Commandr comes with a buil in command for doing this task efficiently and in a single line of code, the database_upgrade command,
    eg: database_upgrade
    As you might have guessed the command takes no parameters
    
     5) Administration Tools-
    Apart from the support for native command line commands, Commandr can also help you do some basic administrative tasks in the system, here are some useful commands,
    a) whois – This command can be used to quickly find out a user's details such as his/her member ID, Username, and IP address, this command takes either a username or the member ID of the user as Identifying information
               eg: whois 2 //2 is the member ID
    b) ban_member – You can use this command in Composr Forums to ban a specific member using his/her username or password
                  eg: ban_member johnDoe
    c) give – This command is useful to give points to a member, command takes 3 parameters, Member Id/Username, Number of points, and Reason for the gift points respectively, you can also send it anonymously using the -a flag, usage is show below,
            eg: give -a 2 20 'free points on new registration' //anonymous gift using -a flag
    d) passwd – This command works pretty much like the native linux command of the same name, it will help you change the password of a forum member using his/her username or Member ID,
            eg: passwd -u johnDoe newpassword

       
       
     6) Some other useful commands -
      a) cpdir : Use this command to quickly copy a directory to a different place, it performs a recursive copy of the enitre direcory,
        eg: cpdir /path/to/mydir /path/to/new/mydir //directory mydir will be copied to new directory
      b) directory_sizes: This command can come handy to quickly find out
the size of any directory within the Composr
system, it will output a nice
formatted list of all the directories for you, go ahead and try it
      c) mysql_table_sizes: This command is similar to directory_sizes, it
will output a tabular list of all the
database tables within Composr with their
respective size
     d) clear_cache: Caching in an important functionality in an application to remember the data for reuse however while testing new changes you might want to clear the already cached values, you can use clear_cache to clear all the caches immediately or even better only delete specific caches by passing A comma-separated list of the caches to clear as parameter,
  eg: clear_caches comcode_pages,templates
 
       5) Power of PHP -
    You can run almost any PHP code or function from Commandr, this can be
useful for quickly testing small code snippets or functions, below are some
simple examples,

    :echo file_get_contents('/proc/cpuinfo'); //This shows info about the
server's CPU

    :echo shell_exec('uptime'); //This shows the server CPU load, and works
on Linux and Mac servers
    
    Please note that the leading ':' is needed for Commandr to identify that
the input's going to be something in PHP

    Apart from the above commands, there are many other native Linux
commands available in Commandr like, grep, cp or mv. You can explore
more using the command 'commands' , which will list all the available
commands within Commandr.
You can also find help information about any command by simply using the -h or help flag like this, grep -h or help grep.

Revision 2015-04-29 07:44 by Guest
Note The power of Commandr

Commandr, The built-in Command-Line Environment in Composr can be used for
performing quick tasks which can be otherwise more time consuming from a GUI
alternative,
Commandr can be accessed from the 'tools' section in Admin-zone,
In this tutorial we will show you some of the quick tasks which can be
performed efficiently using Commandr

1) Quick DB Querying -
    Just like you'd run a query from system command line you can use Commandr
to achieve the same result, below is an example,

    @SELECT id FROM cms_f_members WHERE m_username='admin';

    Nothing different from a normal SQL query, go ahead and try a SQL query
of your own in Commandr
     
      2) Quick function search-
    It can get quite hectic to search for a particular function in a big
application where there are probably thousands of functions in use,
Commandr comes with a built-in command feature to make your job easy,
you can simply use the command find_function which accepts one string
parameter name of the function

    eg: find_function require_code //will display the require_code function
info

    You can also check out the find_codes command which is similar to
find_function, it can help you to quickly search for a code or part of code
in the source files,
 
      3) Open page links on the go -
    You might often want to quickly test a newly modified page link or just
any random page but that'd mean you have to open a new tab window and then
manually enter the whole URL, Commandr comes with a powerful command feature
call , which can open up a page for you on the go, just in a single line
and a page name as the only parameter,

    eg: call cms //opens up the start page for cms in a new window
        


      4) Some other useful commands -
      a) clear_caches : Use this command to quickly clear the cache memory
      b) directory_sizes: This command can come handy to quickly find out
the size of any directory within the Composr
system, it will output a nice
formatted list of all the directories for you, go ahead and try it
      c) mysql_table_sizes: This command is similar to directory_sizes, it
will output a tabular list of all the
database tables within Composr with their
respective size
 
       5) Power of PHP -
    You can run almost any PHP code or function from Commandr, this can be
useful for quickly testing small code snippets or functions, below are some
simple examples,

    :echo file_get_contents('/proc/cpuinfo'); //This shows info about the
server's CPU

    :echo shell_exec('uptime'); //This shows the server CPU load, and works
on Linux and Mac servers
    
    Please note that the leading ':' is needed for Commandr to identify that
the input's going to be something in PHP

    Apart from the above commands, there are many other native Linux
commands available in Commandr like, grep, cp or mv. You can explore
more using the command 'commands' , which will list all the available
commands within Commandr.