Created
October 3, 2014 10:47
-
-
Save fballiano/5c8fd381da79d14ddcf1 to your computer and use it in GitHub Desktop.
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 'abstract.php'; | |
class Shell_Delete_Old_Enterprise_Staging_Backups extends Mage_Shell_Abstract | |
{ | |
public function run() | |
{ | |
$actions = Mage::getModel("enterprise_staging/staging_action")->getCollection() | |
->addFieldToFilter("type", "backup") | |
->addFieldToFilter("status", "completed") | |
->addFieldToFilter("updated_at", array("lt"=>date("Y-m-d H:i:s", strtotime("-7days")))) | |
->setOrder("updated_at", "ASC"); | |
foreach ($actions as $action) { | |
echo "Removed staging backup {$action->getId()} {$action->getUpdatedAt()} {$action->getStagingTablePrefix()}\n"; | |
$action->setIsDeleteTables(true); | |
$action->delete(); | |
} | |
} | |
} | |
$shell = new Shell_Delete_Old_Enterprise_Staging_Backups(); | |
$shell->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment