This file contains 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 | |
//OnDocFormSave | |
$img_path = $modx->getOption('imagesPath',$scriptProperties, MODX_ASSETS_URL."static/images/"); | |
$imgName = $modx->getOption('ImageName',$scriptProperties,'default.png'); | |
$TvValue = $modx->getOption('TV',$scriptProperties,'firstImage'); | |
$def_img = $img_path.$imgName; | |
$img = $resource->GetTVValue($TvValue); | |
$text = $resource->content; | |
if(empty($img)) { |
This file contains 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 | |
//OnBeforeDocFormSave | |
$introlength = $modx->getOption('IntrotextOptions',$scriptProperties,'400'); | |
$introtext= $resource ->introtext; | |
$text =$modx->stripTags($resource->content); | |
if(empty($introtext)){ | |
if (strlen($text) > $introlength) { | |
$cuttext = mb_substr($text, 0, $introlength,"UTF-8"); | |
$pos = mb_strrpos($cuttext, ' ',"UTF-8"); |
This file contains 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 | |
# MySQL root password | |
ROOTPASS="password" | |
TIMEZONE="Europe/Moscow" | |
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
############## |
This file contains 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 | |
dir=/var/www/site | |
user=userofsite | |
echo "Set permissions for $dir..."; | |
echo "CHOWN files..."; | |
chown -R $user:$user "$dir"; | |
echo "CHMOD directories..."; | |
find "$dir" -type d -exec chmod 0755 '{}' \; |
This file contains 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 | |
ROOTPASS="password" | |
echo "Enter username to delete:" | |
read USERNAME | |
mysql -uroot --password=$ROOTPASS -e "DROP USER $USERNAME@localhost" | |
mysql -uroot --password=$ROOTPASS -e "DROP DATABASE $USERNAME" | |
rm -f /etc/nginx/sites-enabled/$USERNAME.conf |
This file contains 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 | |
# MySQL root password | |
KEYLOCATION="/modx/.ssh/key.pem" | |
REMOTEUSERSERVER="[email protected]" | |
ROOTPASS="password" | |
TIMEZONE="Europe/Moscow" | |
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` |
This file contains 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 | |
echo "Enter username" | |
read USERNAME | |
############## | |
echo "Updating MODx" | |
cd /var/www/$USERNAME/www/ |
This file contains 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 | |
require_once dirname(__FILE__).'/config.core.php'; | |
include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; | |
$modx= new modX(); | |
$modx->initialize('mgr'); | |
$modx->setLogLevel(modX::LOG_LEVEL_INFO); | |
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); | |
header("Content-type: text/plain"); |
This file contains 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 | |
// provider id => array of packages | |
$listPackagesToInstall = array( | |
1 => array( // standart modx provider | |
'sdStore' | |
, 'translit' | |
, 'TinyMCE' | |
, 'FormIt' | |
, 'Analytics' |