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 | |
# By Sebastijan Placento [email protected] | |
# simple backup routine for Owncloud for easier backup (needed for colleges). | |
# Insert drive with uuid 57313b9d-2aef-4ddc-879f-a8b4b256c922 | |
MOUNTPOINT=/mnt/ext | |
MOUNTDRIVE=/dev/sdc | |
UUID=57313b9d-2aef-4ddc-879f-a8b4b256c922 | |
IS_DRIVE_AVAILABLE=$(lsblk -f | grep -wq "$UUID" && echo true || echo false) | |
OWNCLOUD_DB_PASS=$(sudo -u www-data php /var/www/owncloud/occ config:system:get dbpassword) #GET DB password |
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
magento2 db server was crashing and we had to investigate why. | |
Long story short: it ran out of space. 220GB ssd with 0 bytes free. | |
Mysql folder size 70GB while db itself is somewhere near 300MB. | |
So most of space was used by: | |
FTS_0000000000274d82_000000000031bd04_INDEX_1.ibd | |
FTS_0000000000274d82_000000000031bd04_INDEX_2.ibd | |
FTS_0000000000274d82_000000000031bd04_INDEX_3.ibd | |
FTS_0000000000274d82_000000000031bd04_INDEX_4.ibd | |
FTS_0000000000274d82_000000000031bd04_INDEX_5.ibd | |
FTS_0000000000274d82_000000000031bd04_INDEX_6.ibd |
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
//please use layout xml for loading static blocks.. But if you just want to echo some html or something like that without editing xml; | |
$block = Mage::getModel('cms/block')->setStoreId(Mage::app()->getStore()->getId())->load('static_block_name'); | |
echo $block->getTitle(); | |
echo $block->getContent(); | |
or | |
echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('some_block_id')->toHtml(); |
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
/usr/bin/host has been preloaded; | |
grep -ri --include=*.php "/usr/bin/host" ./ | |
check all cronjobs: | |
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done | |
check running processes: | |
ps -aux |
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
$collection = $productModel->getCollection() | |
->addAttributeToSelect(array('sku', 'price', 'my_attribute')) //load only stuff you need | |
->addAttributeToFilter('attribute_set_id','16') //from attribute set 16 | |
->joinField('qty', | |
'cataloginventory/stock_item', | |
'qty', | |
'product_id=entity_id', | |
'{{table}}.stock_id=1', | |
'left'); //add qty | |
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 | |
/* | |
* code by David Walsh - http://davidwalsh.name/backup-mysql-database-php | |
* slight modification by Sebastijan Placento - [email protected] | |
*/ | |
$host="localhost"; | |
$username=""; | |
$password=""; |
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
Replace in file app/code/core/Mage/Install/etc/config.xml (near 71th string) this | |
<extensions> | |
<pdo_mysql/> | |
</extensions> | |
with this | |
<extensions> | |
<pdo_mysql>1</pdo_mysql> | |
</extensions> |
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 | |
// Copyright by Sebastijan Placento, [email protected] | |
// use this script on your own risk. | |
$dir= "/var/www/domain.com/web/templates/"; | |
$search="/var/www/templates/"; | |
$replace="/var/www/domain.com/web/templates/"; | |
/** | |
DONT CHANGE PAST THIS COMMENT! |
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 | |
$catID=2; | |
$_categories = Mage::getModel('catalog/category')->getCategories($catID,1,true,true,true); | |
//foreach($_categories as .... |
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
create directory (for example "veleprodaja"): | |
mkdir veleprodaja | |
chmod 755 veleprodaja | |
cp index.php veleprodaja/ | |
cp .htaccess veleprodaja/ | |
ln -s ../app ./app | |
ln -s ../errors ./errors | |
ln -s ../includes ./includes | |
ln -s ../js ./js |