Frontend User Roles Manager Bugs fixes – for OctoberCMS Shahiem Seymor

Error: Trigger action is not specified

Fix Error: Trigger action is not specified as per
the above need to be added to the button

Yaml / configuration file not found error

Found some bugs in:

  1. /plugins/shahiemseymor/roles/controllers/groups/config_form.yaml
  2. /plugins/shahiemseymor/roles/controllers/groups/config_list.yaml
  3. /plugins/shahiemseymor/roles/controllers/permissions/config_form.yaml
  4. /plugins/shahiemseymor/roles/controllers/permissions/config_list.yaml

Instead of full paths to the config files with ~ or @ you can change it to $/shahiemseymor/roles/controllers/groups/config_form.yaml etc. In the last builds (347, 348) of October I’m getting errors because you used @ in /plugins/shahiemseymor/roles/controllers/groups/config_list.yaml


Linux find command find all symlinks in an folder

find . -type l -ls

Expanding upon this answer, here are a couple more symbolic link related find commands:

Find symbolic links to a specific target

find . -lname link_target

Note that link_target may contain wildcard characters.

Find broken symbolic links

find -L . -type l -ls

The -L option instructs find to follow symbolic links, unless when broken.

Find & replace broken symbolic links

find -L . -type l -delete -exec ln -s new_target {} \;

More find examples

More find examples can be found here:


Add Multiple shared IPs in WHM manually

You can’t add shared root IP from WHM but you can add it via ssh manually.


Step One: Create a /var/cpanel/mainips/ directory if there isn’t any:

# mkdir /var/cpanel/mainips/

Step Two: Create a /var/cpanel/mainips/root file, with all the Ips as folllows

Add new line as additional shared IP in WHM

verify from WHM>>Home>>IP Functions>>Show/Edit Reserved IPs




Find out which path phpmyadmin is installed on linux web server

You need to look in the configuration file to see where it is set up.

Something like this will find it

find /etc/httpd/ -print0 | xargs -0 grep phpmyadmin

Which will return something like this

/etc/httpd/conf.d/http.conf:    Alias /phpmyadmin /usr/local/share/phpmyadmin

Or look for the folder itself

locate phpmyadmin


find / -type d -name "phpmyadmin" -print



Date calculators – Date to Date Calculator, Business Date Calculator and more

This website ( comes with a lot of date time calculators handy:

Date and Time Calculators

Date to Date Calculator

Find out how many days, months and years there are between any two dates.

Date Calculator

Add or subtract any number of days to/from a start date.

Time Duration Calculator

Find the precise duration between two dates and times — down to the second.

Time Calculator

Add or subtract days, hours, minutes, and seconds to/from a start date and time.

Business Date to Date Calc.

Exclude holidays and weekend days from your date-to-date calculation.

Business Date Calculator

Add or subtract days, excluding holidays and weekend days.


Astronomical Sun & Moon Calculators

Sun Calculator

Sunrise & Sunset

Day length, azimuth, distance etc.

Eclipse Calculator

With 2 speed animation! Local times for Solar and Lunar Eclipses and what it will look like.

Astrononmical Seasons Calculator

Equinoxes and Solstices mark the beginning of a new astronomical sesason. Local dates and times.

Moon Calculator

Moonrise & Moonset

Direction, illumination percentage etc.

Moon Phases

New Moon, 1st Quarter, Full Moon, and 3rd Quarter. Local times worldwide.

Day and Night World Map

LIVE Map: Showing the Sun’s and Moon’s position in the sky with daylight and night time.

Week Calculators

Search Time Icon

Weekday Calculator

Find out the day of the week for a date of your choice.

Or learn to do this calculation in your head.

Week Number Calculator

Calculate the week number for a date or locate any week number on a calendar.

Time & Distance

Time Zone Converter

Find the time difference between two cities.

Distance Calculator

How far is it?

Travel Time Calculator

Time zone conversions for your flight.

International Dialing Codes

Which country & area codes do I have to dial?



Get sizes of all databases in phpMyAdmin

If you logged in as root account you’ll be able to see the default information_schema database, and the data was included in “TABLES” table.

In order to more readable stats, you can run the following command, this will output the formatted result:

SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema;


Get database size in phpMyAdmin

use find command to locate dated modified files

# find file in given date range

find . -type f -newermt "2016-12-10 00:00:00" ! -newermt "2017-02-25 18:50:00"

# find file modified in the pass 75 days

find . -mtime -75


My custom logging class for PHP

// based on log class from
class SysLog {
 const DEFAULT_LOG_PATH = '/var/log/httpd/mylog.log';
 // declare log file and file pointer as private properties
 private $log_file;
 private $fp;
 public $clientIp;
 // the altLogPath could be set after instance has been created
 public $altLogPath;
 // set log file (path and name)
 public $internalIpOnly;

 * Whether to use proxy addresses or not.
 * As default this setting is disabled - IP address is mostly needed to increase
 * security. HTTP_* are not reliable since can easily be spoofed. It can be enabled
 * just for more flexibility, but if user uses proxy to connect to trusted services
 * it's his/her own risk, only reliable field for IP address is $_SERVER['REMOTE_ADDR'].
 * @var bool
 protected $useProxy = false;

 * List of trusted proxy IP addresses
 * @var array
 protected $trustedProxies = array();

 * HTTP header to introspect for proxies
 * @var string
 protected $proxyHeader = 'HTTP_X_FORWARDED_FOR';

 function SysLog()
 $this->clientIp = $this->getIpAddress();
 public function lfile($path = null) {
 $this->log_file = $path;
 // write message to the log file
 public function lwrite($message) {
 // if file pointer doesn't exist, then open log file
 if (!is_resource($this->fp)) {
 // define script name
 // for PHP 5.2.0+
 // $script_name = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME);
 // for PHP version <= 5.2.0
 $script_name = basename($_SERVER['PHP_SELF']);
 // $script_name = substr($script_name, 0, -4); // php extension and dot are not needed
 $script_name = getcwd() . DIRECTORY_SEPARATOR . $script_name;
 // define current time and suppress E_WARNING if using the system TZ settings
 // (don't forget to set the INI setting date.timezone)
 $time = @date('[d/M/Y:H:i:s]');
 // write current time, script name and message to the log file
 fwrite($this->fp, "$time ($script_name) \n$message" . PHP_EOL);
 // short name for lwrite
 public function log($message) {
 // takes arrays and objects as params
 public function logdump($someObj) {
 $this->log(print_r($someObj, true));
 // close log file (it's always a good idea to close a file when you're done with it)
 public function lclose() {
 // open log file (private method)
 private function lopen() {
 // in case of Windows set default log file
 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
 $log_file_default = 'c:/php/logfile.txt';
 } elseif(isset($this->altLogPath)) {
 // alternative log path could be set, require full path;
 $log_file_default = $this->altLogPath;
 } else {
 // set default log file for Linux and other systems
 $log_file_default = self::DEFAULT_LOG_PATH;
 // define log file from lfile method or use previously set default
 $lfile = $this->log_file ? $this->log_file : $log_file_default;
 // open log file for writing only and place file pointer at the end of the file
 // (if the file does not exist, try to create it)
 $this->fp = fopen($lfile, 'a') or exit("Can't open $lfile!");

 * Returns client IP address.
 * @return string IP address.
 public function getIpAddress()
 $ip = $this->getIpAddressFromProxy();
 if ($ip) {
 return $ip;

 // direct IP address
 if (isset($_SERVER['REMOTE_ADDR'])) {
 return $_SERVER['REMOTE_ADDR'];

 return '';

 * Attempt to get the IP address for a proxied client
 * @see
 * @return false|string
 protected function getIpAddressFromProxy()
 if (!$this->useProxy
 || (isset($_SERVER['REMOTE_ADDR']) && !in_array($_SERVER['REMOTE_ADDR'], $this->trustedProxies))
 ) {
 return false;

 $header = $this->proxyHeader;
 if (!isset($_SERVER[$header]) || empty($_SERVER[$header])) {
 return false;

 // Extract IPs
 $ips = explode(',', $_SERVER[$header]);
 // trim, so we can compare against trusted proxies properly
 $ips = array_map('trim', $ips);
 // remove trusted proxy IPs
 $ips = array_diff($ips, $this->trustedProxies);

 // Any left?
 if (empty($ips)) {
 return false;

 // Since we've removed any known, trusted proxy servers, the right-most
 // address represents the first IP we do not know about -- i.e., we do
 // not know if it is a proxy server, or a client. As such, we treat it
 // as the originating IP.
 // @see
 $ip = array_pop($ips);
 return $ip;

Linux file sync rsync usages including sync from remote server


This article lists examples for secure copy (RSYNC) on Linux.

Local to Remote

File from local to remote.

rsync /some/local/directory/foobar.txt

All recursive contents in local directory to remote directory.

rsync --recursive /some/local/directory/

All recursive contents in local directory to remote directory. Only copy if newer or missing. Delete remote that are not local. Keep owner, group and permissions the same. Keep executable flag the same.

rsync --verbose --recursive --update --archive --delete --executability /some/local/directory/

Local to Local

All recursive content in source local directory to target local directory. Such as, and attached USB Storage device.

rsync -va /some/local/directory /some/other/local/directory
rsync -va /Users/jdoe /Volumes/usbdrive/Users/


       rsync — a fast, versatile, remote (and local) file-copying tool

       Local:  rsync [OPTION...] SRC... [DEST]

       Access via remote shell:
         Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
         Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

       Access via rsync daemon:
         Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
               rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
         Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
               rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

       Usages with just one SRC arg and no DEST arg will list the source files instead of copying.

       Here  is  a short summary of the options available in rsync. Please refer to the detailed description below for a
       complete description.

        -v, --verbose               increase verbosity
        -q, --quiet                 suppress non-error messages
            --no-motd               suppress daemon-mode MOTD (see caveat)
        -c, --checksum              skip based on checksum, not mod-time & size
        -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
            --no-OPTION             turn off an implied OPTION (e.g. --no-D)
        -r, --recursive             recurse into directories
        -R, --relative              use relative path names
            --no-implied-dirs       don’t send implied dirs with --relative
        -b, --backup                make backups (see --suffix & --backup-dir)
            --backup-dir=DIR        make backups into hierarchy based in DIR
            --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
        -u, --update                skip files that are newer on the receiver
            --inplace               update destination files in-place
            --append                append data onto shorter files
            --append-verify         --append w/old data in file checksum
        -d, --dirs                  transfer directories without recursing using
                                    "-r --exclude=’/*/*’" (rsync 2.6.x compatible)
            --new-dirs              transfer directories without recursing
                                    (rsync 3.0.x compatible)
        -l, --links                 copy symlinks as symlinks
        -L, --copy-links            transform symlink into referent file/dir
            --copy-unsafe-links     only "unsafe" symlinks are transformed
            --safe-links            ignore symlinks that point outside the tree
        -k, --copy-dirlinks         transform symlink to dir into referent dir
        -K, --keep-dirlinks         treat symlinked dir on receiver as dir
        -H, --hard-links            preserve hard links
        -p, --perms                 preserve permissions
        -E, --executability         preserve executability
            --chmod=CHMOD           affect file and/or directory permissions
        -A, --acls                  preserve ACLs (implies -p)
        -X, --xattrs                preserve extended attributes
        -o, --owner                 preserve owner (super-user only)
        -g, --group                 preserve group
            --devices               preserve device files (super-user only)
            --specials              preserve special files
        -D                          same as --devices --specials
        -t, --times                 preserve modification times
        -O, --omit-dir-times        omit directories from --times
            --super                 receiver attempts super-user activities
            --fake-super            store/recover privileged attrs using xattrs
        -S, --sparse                handle sparse files efficiently
        -n, --dry-run               perform a trial run with no changes made
        -W, --whole-file            copy files whole (w/o delta-xfer algorithm)
        -x, --one-file-system       don’t cross filesystem boundaries
        -B, --block-size=SIZE       force a fixed checksum block-size
        -e, --rsh=COMMAND           specify the remote shell to use
            --rsync-path=PROGRAM    specify the rsync to run on remote machine
            --existing              skip creating new files on receiver
            --ignore-existing       skip updating files that exist on receiver
            --remove-source-files   sender removes synchronized files (non-dir)
            --del                   an alias for --delete-during
            --delete                delete extraneous files from dest dirs
            --delete-before         receiver deletes before transfer (default)
            --delete-during         receiver deletes during xfer, not before
            --delete-delay          find deletions during, delete after
            --delete-after          receiver deletes after transfer, not before
            --delete-excluded       also delete excluded files from dest dirs
            --ignore-errors         delete even if there are I/O errors
            --force                 force deletion of dirs even if not empty
            --max-delete=NUM        don’t delete more than NUM files
            --max-size=SIZE         don’t transfer any file larger than SIZE
            --min-size=SIZE         don’t transfer any file smaller than SIZE
            --partial               keep partially transferred files
            --partial-dir=DIR       put a partially transferred file into DIR
            --delay-updates         put all updated files into place at end
        -m, --prune-empty-dirs      prune empty directory chains from file-list
            --numeric-ids           don’t map uid/gid values by user/group name
            --timeout=SECONDS       set I/O timeout in seconds
            --contimeout=SECONDS    set daemon connection timeout in seconds
        -I, --ignore-times          don’t skip files that match size and time
            --size-only             skip files that match in size
            --modify-window=NUM     compare mod-times with reduced accuracy
        -T, --temp-dir=DIR          create temporary files in directory DIR
        -y, --fuzzy                 find similar file for basis if no dest file
            --compare-dest=DIR      also compare received files relative to DIR
            --copy-dest=DIR         ... and include copies of unchanged files
            --link-dest=DIR         hardlink to files in DIR when unchanged
        -z, --compress              compress file data during the transfer
            --compress-level=NUM    explicitly set compression level
            --skip-compress=LIST    skip compressing files with suffix in LIST
        -C, --cvs-exclude           auto-ignore files in the same way CVS does
        -f, --filter=RULE           add a file-filtering RULE
        -F                          same as --filter=’dir-merge /.rsync-filter’
                                    repeated: --filter=’- .rsync-filter’
            --exclude=PATTERN       exclude files matching PATTERN
            --exclude-from=FILE     read exclude patterns from FILE
            --include=PATTERN       don’t exclude files matching PATTERN
            --include-from=FILE     read include patterns from FILE
            --files-from=FILE       read list of source-file names from FILE
        -0, --from0                 all *from/filter files are delimited by 0s
        -s, --protect-args          no space-splitting; wildcard chars only
            --address=ADDRESS       bind address for outgoing socket to daemon
            --port=PORT             specify double-colon alternate port number
            --sockopts=OPTIONS      specify custom TCP options
            --blocking-io           use blocking I/O for the remote shell
            --stats                 give some file-transfer stats
        -8, --8-bit-output          leave high-bit chars unescaped in output
        -h, --human-readable        output numbers in a human-readable format
            --progress              show progress during transfer
        -P                          same as --partial --progress
        -i, --itemize-changes       output a change-summary for all updates
            --out-format=FORMAT     output updates using the specified FORMAT
            --log-file=FILE         log what we’re doing to the specified FILE
            --log-file-format=FMT   log updates using the specified FMT
            --password-file=FILE    read daemon-access password from FILE
            --list-only             list the files instead of copying them
            --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
            --write-batch=FILE      write a batched update to FILE
            --only-write-batch=FILE like --write-batch but w/o updating dest
            --read-batch=FILE       read a batched update from FILE
            --protocol=NUM          force an older protocol version to be used
            --iconv=CONVERT_SPEC    request charset conversion of filenames
            --checksum-seed=NUM     set block/file checksum seed (advanced)
        -4, --ipv4                  prefer IPv4
        -6, --ipv6                  prefer IPv6
            --version               print version number
       (-h) --help                  show this help (see below for -h comment)

       Rsync can also be run as a daemon, in which case the following options are accepted:

            --daemon                run as an rsync daemon
            --address=ADDRESS       bind to the specified address
            --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
            --config=FILE           specify alternate rsyncd.conf file
            --no-detach             do not detach from the parent
            --port=PORT             listen on alternate port number
            --log-file=FILE         override the "log file" setting
            --log-file-format=FMT   override the "log format" setting
            --sockopts=OPTIONS      specify custom TCP options
        -v, --verbose               increase verbosity
        -4, --ipv4                  prefer IPv4
        -6, --ipv6                  prefer IPv6
        -h, --help                  show this help (if used after --daemon)



Exclude directory

$ rsync -avz --exclude 'dir1' source/ destination/

Exclude directories that has a pattern

$ rsync -avz --exclude 'dir*' source/ destination/

Exclude a specified file

$ rsync -avz --exclude 'dir1/dir2/file3.txt' source/ destination/

Exclude path is relative as you can see the following two commands had the same effect

$ rsync -avz --exclude '/dir1/dir2/file3.txt' source/ destination/
$ rsync -avz --exclude 'dir1/dir2/file3.txt' source/ destination/

Exclude a file type specified

$ rsync -avz --exclude '*.txt' source/ destination/

Exclude multiple files and directories at the same time

$ rsync -avz --exclude file1.txt --exclude dir3/file4.txt source/ destination/

To use with a file list within a date range, first run find command to generate a file list

$ find /home/ -type f -newermt "2016-12-10 00:00:00" ! -newermt "2017-02-23 18:50:00" > filetosync.txt

You’ll need to change the absolute path to relative path in this file. Then refer in the rsync command to run. vv will

$ sudo rsync -arogzlvv --files-from=filetosync.txt -e 'ssh -p 3636' /home/ > rsync.liverun.log

Further reading:

The rsync algorithm

Extras when added -i option to show results

Let’s take a look at how rsync works and better understand the cryptic result lines:

1 – A huge advantage of rsync is that after an interruption the next time it continues smoothly.

The next rsync invocation will not transfer the files again, that it had already transferred, if they were not changed in the meantime. But it will start checking all the files again from the beginning to find out, as it is not aware that it had been interrupted.

2 – Each character is a code that can be translated if you read the section for -i, --itemize-changesin man rsync

Decoding your example log file from the question:


> - the item is received
f - it is a regular file
s - the file size is different
t - the time stamp is different


. - the item is not being updated (though it might have attributes 
    that are being modified)
d - it is a directory
t - the time stamp is different


> - the item is received
f - a regular file
+++++++++ - this is a newly created item

The relevant part of the rsync man page:

-i, –itemize-changes

Requests a simple itemized list of the changes that are being made to each file, including attribute changes. This is exactly the same as specifying –out-format=’%i %n%L’. If you repeat the option, unchanged files will also be output, but only if the receiving rsync is at least version 2.6.7 (you can use -vv with older versions of rsync, but that also turns on the output of other verbose mes- sages).

The “%i” escape has a cryptic output that is 11 letters long. The general format is like the string YXcstpoguax, where Y is replaced by the type of update being done, X is replaced by the file-type, and the other letters represent attributes that may be output if they are being modified.

The update types that replace the Y are as follows:

  • A < means that a file is being transferred to the remote host (sent).
  • A > means that a file is being transferred to the local host (received).
  • A c means that a local change/creation is occurring for the item (such as the creation of a directory or the changing of a symlink, etc.).
  • A h means that the item is a hard link to another item (requires –hard-links).
  • A . means that the item is not being updated (though it might have attributes that are being modified).
  • A * means that the rest of the itemized-output area contains a message (e.g. “deleting”).

The file-types that replace the X are: f for a file, a d for a directory, an L for a symlink, a D for a device, and a S for a special file (e.g. named sockets and fifos).

The other letters in the string above are the actual letters that will be output if the associated attribute for the item is being updated or a “.” for no change. Three exceptions to this are: (1) a newly created item replaces each letter with a “+”, (2) an identical item replaces the dots with spaces, and (3) an unknown attribute replaces each letter with a “?” (this can happen when talking to an older rsync).

The attribute that is associated with each letter is as follows:

  • A c means either that a regular file has a different checksum (requires –checksum) or that a symlink, device, or special file has a changed value. Note that if you are sending files to an rsync prior to 3.0.1, this change flag will be present only for checksum-differing regular files.
  • A s means the size of a regular file is different and will be updated by the file transfer.
  • A t means the modification time is different and is being updated to the sender’s value (requires –times). An alternate value of T means that the modification time will be set to the transfer time, which happens when a file/symlink/device is updated without –times and when a symlink is changed and the receiver can’t set its time. (Note: when using an rsync 3.0.0 client, you might see the s flag combined with t instead of the proper T flag for this time-setting failure.)
  • A p means the permissions are different and are being updated to the sender’s value (requires –perms).
  • An o means the owner is different and is being updated to the sender’s value (requires –owner and super-user privileges).
  • A g means the group is different and is being updated to the sender’s value (requires –group and the authority to set the group).
  • The u slot is reserved for future use.
  • The a means that the ACL information changed.
  • The x means that the extended attribute information changed.

One other output is possible: when deleting files, the “%i” will output the string “*deleting” for each item that is being removed (assuming that you are talking to a recent enough rsync that it logs deletions instead of outputting them as a verbose message).


Delete all Duplicate Rows except for One record in MySQL

NB – You need to do this first on a test copy of your table!

When I did it, I found that unless I also included AND <>, it deleted every row in the table.

1) If you want to keep the row with the lowest id value:

DELETE n1 FROM names n1, names n2 WHERE > AND =

2) If you want to keep the row with the highest id value:

DELETE n1 FROM names n1, names n2 WHERE < AND =

I used this method in MySQL 5.1

Not sure about other versions.

Update: Since people Googling for removing duplicates end up here
Although the OP’s question is about DELETE, please be advised that using INSERT and DISTINCT is much faster. For a database with 8 million rows, the below query took 13 minutes, while using DELETE, it took more than 2 hours and yet didn’t complete.

INSERT INTO tempTableName(cellId,attributeId,entityRowId,value)
 SELECT DISTINCT cellId,attributeId,entityRowId,value
 FROM tableName;


Additional information

 tTable t1, tTable t2 
 t1.fieldName = t2.fieldName AND >


create another table as below

CREATE TABLE myTable_new (ID INT PRIMARY KEY, Title varchar(20))

and add values as

INSERT INTO myTable_new (ID, Title) SELECT ID, DISTINCT Title FROM old_table

considering old_table is the earlier table…


bash shell script to check all the cron jobs running for all cpanel users

vi /root/


cd /var/spool/cron

ls -1 > /cronusers

for i in ` cat /cronusers`


echo “#########################CRON DETAILS FOR USER $i ” >> /crondetils
echo “” >> /crondetils
cat $i >> /crondetils
echo “” >> /crondetils
echo “####################################################” >>/crondetils
echo “” >> /crondetils


bash /root/

view the cron details from the file “/crondetils ”

User specified cron jobs are located in
Use any text editor to open them and you’ll find out.
Additional bash shell script doing the same thing:
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

A list of tools detect what CMS / server / os is used for a website

Sometime, when you found a site looked amazing and functional, you want to know what technology / platform / CMS that was used for building that site. The following is a list of tools that can help you check what kind of components that the site operates with.

But you may also wonder how these online CMS / platform detection work. I think by checking the site urls, and file extensions, HTTP response headers, source code for comments, or standard JS libraries, it could give some clues, as CMS using combinations of components can leave some unique libs and patterns, exactly as “signatures” of a particular platform.