我有很多每日备份档案.为了管理磁盘使用情况,我需要一个bash脚本来删除超过1个月的所有文件,但是保留所有文件在星期一创建,即使它们超过1个月.
例如,这将删除超过30天前修改的所有文件:
find /path/to/files* -type f -mtime +30 -delete
Run Code Online (Sandbox Code Playgroud)
但我真的不知道如何保存星期一创建的文件.
我有csv文件,并希望将其上传到远程FTP服务器.我看到Magento有Varien_Io_Ftp类,但我找不到任何好的文档或它的用法示例.有人可以帮助我并举个好榜样吗?
我是一个网站的新开发者.以前的开发人员留下了大量垃圾和不稳定的代码.但主要的问题是,当我打开这个网站并尝试浏览页面(只需尝试1-2个链接)时,它会崩溃我的IE 9-10. 打开页面后,IE完全冻结,我无法做任何事情.
我的问题是:
如何跟踪问题(可能是某种调试器或在线模拟器)?您能否推荐一些软件或在线工具来跟踪JS/HTML错误,我可以用它来了解崩溃原因?
html javascript debugging internet-explorer-9 internet-explorer-10
我得到了一个产品的所有图像
Mage::getModel('catalog/product')->load($prod->getId())->getMediaGalleryImages()->getItems();
Run Code Online (Sandbox Code Playgroud)
以下是一个项目的内容:
<i>protected</i> '_data' <font color='#888a85'>=></font>
<b>array</b> <i>(size=11)</i>
'value_id' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'204'</font> <i>(length=3)</i>
'file' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'/m/a/magento-red-furniture-set.jpg'</font> <i>(length=34)</i>
'label' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'test label'</font> <i>(length=10)</i>
'position' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'disabled' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'label_default' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'test label'</font> <i>(length=10)</i>
'position_default' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'disabled_default' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'url' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'http://work.my/m1702/media/catalog/product/m/a/magento-red-furniture-set.jpg'</font> <i>(length=76)</i>
'id' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'204'</font> …Run Code Online (Sandbox Code Playgroud) 在Magento的核心代码中,Mage::getModel('core/resource_transaction')这个模型做了什么以及在什么情况下我们想要启动和使用这个核心模型类?该模型在Magento数据库中是否有对应的表?
I'm using Magento and got PHP Segmentation fault during rollback database from admin. I make and investigation and see that the reason is such line:
preg_replace("/'(\\'|\\\\{2}|[^'])*'/", '', $sql);
Run Code Online (Sandbox Code Playgroud)
$sql string is big enough, I'm attaching it.
https://drive.google.com/file/d/0B9UbKYbywcABOTRSVG5KRl9La0k/edit?usp=sharing
You may use such script to reproduce the problem:
<?php
$test = file_get_contents('test.txt');
$sql = preg_replace("/'(\\'|\\\\{2}|[^'])*'/", '', $test);
Run Code Online (Sandbox Code Playgroud)
May be somebody knows about this problem and can help me to solve it?
P.S. Class that directly causes the problem is abstract class Zend_Db_Statement …
我有2个自定义收藏.平面数据的常用集合.我需要加入他们给客户选择.它适用于innerJoin,但对连接字段的过滤和排序不起作用.我怎么解决这个问题?
_prepareCollection()示例
$collection = Mage::getResourceModel('customer/customer_collection')
->addNameToSelect()
->addAttributeToSelect('email');
$collection
->getSelect()
->joinInner(array('my_table' => $collection->getTable('my/table')), 'e.entity_id = my_table.customer_id', array('custom_field' => my_table.custom_field))
->joinInner(array('my_table1' => $collection->getTable('my/table1')), 'my_table1.other_id = my_table.id', array('custom_field1' => my_table1.custom_field));
$this->setCollection($collection);
return parent::_prepareCollection();
Run Code Online (Sandbox Code Playgroud)
因此,排序和过滤不适用于custom_field和custom_field1
添加列调用:
$this->addColumn('custom_field',
array(
'header'=>$this->__('Shopping club name'),
'index'=>'custom_field',
'filter_index'=>'my_table.custom_field',
));
Run Code Online (Sandbox Code Playgroud)
过滤时我得到了致命的错误:
Call to a member function getBackend() on a non-object
Run Code Online (Sandbox Code Playgroud)
排序不起作用,没有显示错误
如果您将平面连接到平面表,'filter_index'可以正常工作.但这里平坦加入了EAV.
例如,我有文件结构:
app
- media
media
Run Code Online (Sandbox Code Playgroud)
如果我添加线
media
Run Code Online (Sandbox Code Playgroud)
到.hgignore,将排除两个文件夹(媒体,应用/媒体).但我想从项目根目录(./media)中仅排除媒体文件夹.我需要一个可以在Linux和Windows中运行的解决方案.
我有3个数组:
array(1, 5, 1);
array(3, 2, 7, 5 ,4);
array(4, 3, 6, 5)
Run Code Online (Sandbox Code Playgroud)
我想合并它们并得到这样的结果:
array(
array(1, 3, 4),
array(5, 2, 3),
array(1, 7, 6),
array(5, 5),
array(4)
);
Run Code Online (Sandbox Code Playgroud)
什么是最简单的方法?
我要重命名的所有.hg_gg文件夹/var/www到.hg.我该怎么做?我知道如何重新命名.hg到.hg_gg.
find /var/www -name ".hg" -exec bash -c 'mv $0 $0_gg' {} \;
Run Code Online (Sandbox Code Playgroud)
但不知道如何进行逆向改变.