rsync sync directories with resume

rsync -rPtz –progress -e ssh /local_backup_path/ remote_host:/remote_backup_path/

The -e ssh tells rsync to use a ssh client instead of rsh. The -z option compresses the file. -t preserves time attributes and the -P option resumes incomplete file transfers.

If you run this command from the command line you can use the –progress option, that will show you a progress bar during transfer. Very useful with large files.

С етикет: , ,
Публикувано в linux

strip first words from a string

<?php echo implode(‘ ‘, array_slice(explode(‘ ‘, strip_tags($introtext) ), 0, 30));?> …

С етикет: , , ,
Публикувано в Joomla

preg_match_all image

$matches = array();
preg_match_all(‘/<img.+src=[\'“]([^\'“]+)[\'“].*\/>/i’ , $article->text , $matches);

if($matches[0][0]){
echo $matches[0][0];
}

С етикет: , , , , ,
Публикувано в Joomla

virtuemart empty cart link

go to /components/com_virtuemart/controllers/cart.php and add this fuction

public function deleteall() {
$mainframe = JFactory::getApplication();

$cart = VirtueMartCart::getCart();
$cart->emptyCart();
$mainframe->redirect(JRoute::_(‘index.php?option=com_virtuemart&view=cart’));
}

Go to your cart template and add

<a title=“<?php echo JText::_(‘COM_VIRTUEMART_CART_DELETE’) ?>“ align=“middle“ href=“<?php echo JRoute::_(‘index.php?option=com_virtuemart&view=cart&task=deleteall’) ?>“><i></i></a>

С етикет: , , ,
Публикувано в Joomla