This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Example for yii2 project | |
| # VirtualHost in @app/web directory | |
| php -S localhost:8888 -t web web/index.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Single # (#) - run from root; | |
| ## Double # (##) - comment | |
| ## Backup Action | |
| # slapcat -v -b "dc=domain,dc=com" -l <filename>-$( date +%y%m%d-%H%M ).ldif && gzip -9 <filename>-$( date +%y%m%d-%H%M ).ldif | |
| ## Example | |
| # /usr/local/sbin/slapcat -v -b "dc=mail,dc=gorodavto,dc=com" -l addressbook-$( date +%y%m%d-%H%M ).ldif && gzip -9 addressbook-$( date +%y%m%d-%H%M ).ldif | |
| ## Restore Action |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #for run backup function from this script need run: | |
| # source </path/to/this_script_name>.sh; backup>/dev/null 2>&1 | |
| #for run restore function from this script need run: | |
| # source </path/to/this_script_name>.sh; restore>/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # <arg> - argument (r/s): r - for restart, s - for shutdown | |
| # <time> - time in seconds | |
| # <ws> - ip-address, hostname or fqdn | |
| shutdown -<arg> -f -t <time> -m \\<ws> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (Yii::$app->user->can('root')) { | |
| echo 'Hello, Root!'; | |
| } | |
| elseif (Yii::$app->user->can('admin')) { | |
| echo 'Hello, Admin!'; | |
| } | |
| elseif (Yii::$app->user->can('head')) { | |
| echo 'Hello, Head!'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Export to file (Full Database or custom tables) data only | |
| mysqldump -u[username] -p[password] --no-create-info [dbname] [table_n1, ... , table_n] > [filename].sql | |
| # Export to file (Full Database or custom tables) structure only | |
| mysqldump -u [username] -p[password] --no-data [dbname] [table_n1, ... , table_n] > [filename].sql | |
| # To import to database from file | |
| mysql -u [username] -p[password] [dbname] < [filename].sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| echo Yii::$app->controller->id; | |
| echo Yii::$app->controller->action->id; | |
| echo Yii::$app->controller->module->id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $formatter = new \yii\i18n\Formatter; | |
| $formatter->dateFormat = 'php:Y-m-d'; | |
| $formatter->timeZone = 'UTC'; | |
| echo $formatter->asDate('NOW'); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.pjax.reload({container:'#idofyourpjaxwidget'}) |